]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: do not overrid paths inside build
authorLucas De Marchi <lucas.demarchi@intel.com>
Wed, 7 Jan 2015 21:14:20 +0000 (19:14 -0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 7 Jan 2015 21:14:20 +0000 (19:14 -0200)
If we are accessing a file inside the build directory we should really
not trap the path. Right now this isn't important because we never do
such accesses. However it will be needed when gcov is integrated because
it dumps files to the same place where the binaries are located.

Makefile.am
testsuite/path.c

index b9fc8ea9b2d925399ad148a325994d3cac7b3cdc..5df38cb4f2fe88df0cb347a4be4fc21e4e091066 100644 (file)
@@ -241,6 +241,8 @@ check-am: rootfs check-sysconfdir
 check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
 
 testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
+testsuite_path_la_CPPFLAGS = $(AM_CPPFLAGS) \
+       -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
 testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
 
 testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
index ba9a51135c221439aef9adfa05149bc251e86a14..fa5fcebd18a15f79592ab02647c2164764f326b0 100644 (file)
@@ -29,6 +29,8 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <shared/util.h>
+
 #include "testsuite.h"
 
 static void *nextlib;
@@ -37,7 +39,8 @@ static size_t rootpathlen;
 
 static inline bool need_trap(const char *path)
 {
-       return path != NULL && path[0] == '/';
+       return path != NULL && path[0] == '/'
+               && !strstartswith(path, ABS_TOP_BUILDDIR);
 }
 
 static const char *trap_path(const char *path, char buf[PATH_MAX * 2])