From aceeb3c7145132d3b0eb839a043798b41a75b8c6 Mon Sep 17 00:00:00 2001 From: Dan Dedrick Date: Wed, 16 Nov 2016 09:31:24 -0500 Subject: tests: fix building out of place The path to the source files should be top_srcdir not top_builddir. When building in place these are both the same so this doesn't fail but is technically wrong. This change will allow both cases to work. To demonstrace how this was broken before and to ensure it is fixed now you can do the following: ./autogen.sh && mkdir -p build && cd build && ../configure && make Running make check out of place still doesn't work but that will require a bit more change. --- tests/internals/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/internals/Makefile.am b/tests/internals/Makefile.am index 3006399..c35d9be 100644 --- a/tests/internals/Makefile.am +++ b/tests/internals/Makefile.am @@ -1,14 +1,14 @@ noinst_HEADERS = test_common.h noinst_PROGRAMS = test_internals test_rate_limiter -test_internals_SOURCES = test_internals.c test_common.c $(top_builddir)/src/misc.c -test_rate_limiter_SOURCES = test_rate_limiter.c test_common.c $(top_builddir)/src/rate_limiter.c +test_internals_SOURCES = test_internals.c test_common.c $(top_srcdir)/src/misc.c +test_rate_limiter_SOURCES = test_rate_limiter.c test_common.c $(top_srcdir)/src/rate_limiter.c -test_internals_CPPFLAGS = ${my_CPPFLAGS} ${fuse_CFLAGS} -I. -I$(top_builddir)/src +test_internals_CPPFLAGS = ${my_CPPFLAGS} ${fuse_CFLAGS} -I. -I$(top_srcdir)/src test_internals_CFLAGS = ${my_CFLAGS} test_internals_LDADD = ${my_LDFLAGS} -test_rate_limiter_CPPFLAGS = ${my_CPPFLAGS} ${fuse_CFLAGS} -I. -I$(top_builddir)/src +test_rate_limiter_CPPFLAGS = ${my_CPPFLAGS} ${fuse_CFLAGS} -I. -I$(top_srcdir)/src test_rate_limiter_CFLAGS = ${my_CFLAGS} test_rate_limiter_LDADD = ${my_LDFLAGS} -- cgit v1.2.3 From 37380cba4379897674d0ff8c5115f10691d4474a Mon Sep 17 00:00:00 2001 From: Dan Dedrick Date: Wed, 16 Nov 2016 16:10:01 -0500 Subject: tests: Fix run make check out of place When building out of the place the executables are not in the same location as the scripts being called. This means that the test scripts need to be able to handle the executables being the in the current directory and the script/source files being in a different directory. This will work now work with both building in place and building out of place and can be tested as follows: /autogen.sh && mkdir -p build && cd build && ../configure && make check --- tests/internals/test_internals_valgrind.sh | 4 +++- tests/internals/test_rate_limiter_valgrind.sh | 4 +++- tests/test_bindfs.rb | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/internals/test_internals_valgrind.sh b/tests/internals/test_internals_valgrind.sh index a84c664..4511ccd 100755 --- a/tests/internals/test_internals_valgrind.sh +++ b/tests/internals/test_internals_valgrind.sh @@ -1,3 +1,5 @@ #!/bin/sh -cd `dirname "$0"` +if [ ! -x ./test_internals ]; then + cd `dirname "$0"` +fi valgrind --error-exitcode=100 ./test_internals diff --git a/tests/internals/test_rate_limiter_valgrind.sh b/tests/internals/test_rate_limiter_valgrind.sh index e291360..bf0a7cd 100755 --- a/tests/internals/test_rate_limiter_valgrind.sh +++ b/tests/internals/test_rate_limiter_valgrind.sh @@ -1,3 +1,5 @@ #!/bin/sh -cd `dirname "$0"` +if [ ! -x ./test_rate_limiter ]; then + cd `dirname "$0"` +fi valgrind --error-exitcode=100 ./test_rate_limiter diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index 48611b2..39f709e 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -18,7 +18,10 @@ # along with bindfs. If not, see . # -require './common.rb' +# if we are being run by make check it will set srcdir and we should use it +localsrc_path = ENV['srcdir'] || '.' + +require localsrc_path + '/common.rb' include Errno @@ -39,7 +42,7 @@ $nobody_uid = nobody_uid = Etc.getpwnam('nobody').uid $nobody_gid = nobody_gid = Etc.getpwnam('nobody').gid $nobody_group = nobody_group = Etc.getgrgid(nobody_gid).name -$tests_dir = File.dirname(File.realpath(__FILE__)) +$tests_dir = File.realpath('.') testenv("") do -- cgit v1.2.3