From: Andrew Deason Date: Tue, 12 Nov 2019 02:34:07 +0000 (-0600) Subject: tests: Fix most tests for objdir builds X-Git-Tag: openafs-devel-1_9_0~186 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=f4ab3767b7e65028b93e731da6f09ee385c51daf tests: Fix most tests for objdir builds Fix a few miscellaneous issues with building and running our tests in objdir builds: - Our C tests use -I$(srcdir)/../.. in the CFLAGS, so we can #include . However, basic.h actually gets copied from src/external/c-tap-harness/tests/tap/ to tests/tap/ during the build, and so basic.h is available in the objdir, not srcdir. For objdir builds, this causes building the tests to fail with failing to find basic.h. Fix this to use TOP_OBJDIR as the include path instead. - Our 'make check' in tests/ tries to run ./libwrap; but our cwd will be in the objdir for objdir builds, and libwrap is a script in our srcdir. Fix this to run libwrap from the srcdir path. - In tests/opr/softsig-t, it tries to find the 'softsig-helper' binary in the same dir as 'softsig-t'. However, softsig-t is just a script in the srcdir, but softsig-helper is a binary built in the objdir. Fix this to use the BUILD env var provided by the tests wrapper, by default. Change-Id: Iff642613bfc88d0d7e348660dc62f59e6fa8af75 Reviewed-on: https://gerrit.openafs.org/13939 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/tests/Makefile.in b/tests/Makefile.in index 23f1fa0..7859028 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -22,7 +22,7 @@ runtests.o: $(srcdir)/runtests.c check test tests: runtests @for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done - MAKECHECK=1 ./libwrap @TOP_OBJDIR@/lib \ + MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \ ./runtests $(abs_top_srcdir)/tests/TESTS install: diff --git a/tests/auth/Makefile.in b/tests/auth/Makefile.in index ed4ed27..78bc0c8 100644 --- a/tests/auth/Makefile.in +++ b/tests/auth/Makefile.in @@ -6,7 +6,7 @@ include @TOP_OBJDIR@/src/config/Makefile.pthread TESTS = authcon-t superuser-t keys-t realms-t -MODULE_CFLAGS=-I$(srcdir)/../.. -I$(srcdir)/../common/ +MODULE_CFLAGS=-I$(TOP_OBJDIR) -I$(srcdir)/../common/ all check test tests: $(TESTS) diff --git a/tests/cmd/Makefile.in b/tests/cmd/Makefile.in index 57dfe8f..9c042ff 100644 --- a/tests/cmd/Makefile.in +++ b/tests/cmd/Makefile.in @@ -5,7 +5,7 @@ abs_top_builddir=@abs_top_builddir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread -MODULE_CFLAGS = -I$(srcdir)/../.. +MODULE_CFLAGS = -I$(TOP_OBJDIR) LIBS = ../tap/libtap.a \ $(abs_top_builddir)/src/cmd/liboafs_cmd.la \ diff --git a/tests/common/Makefile.in b/tests/common/Makefile.in index f71d9d3..3bc6096 100644 --- a/tests/common/Makefile.in +++ b/tests/common/Makefile.in @@ -4,7 +4,7 @@ abs_top_builddir=@abs_top_builddir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread -MODULE_CFLAGS=-I$(srcdir)/.. -I$(srcdir)/../.. +MODULE_CFLAGS=-I$(TOP_OBJDIR) all check test tests: config.o servers.o ubik.o rxkad.o network.o diff --git a/tests/opr/Makefile.in b/tests/opr/Makefile.in index 9660177..d9a37f6 100644 --- a/tests/opr/Makefile.in +++ b/tests/opr/Makefile.in @@ -3,7 +3,7 @@ abs_top_builddir=@abs_top_builddir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread -MODULE_CFLAGS = -I$(srcdir)/../.. +MODULE_CFLAGS = -I$(TOP_OBJDIR) LIBS=../tap/libtap.a $(abs_top_builddir)/src/opr/liboafs_opr.la diff --git a/tests/opr/softsig-t b/tests/opr/softsig-t index 533feb4..09f4e50 100755 --- a/tests/opr/softsig-t +++ b/tests/opr/softsig-t @@ -32,7 +32,17 @@ use FindBin qw($Bin); # Start up our test process, and send it various signals. Check that these # signals make it to it correctly, and are reported on the command line. -my $softsig_helper = $Bin . "/softsig-helper"; + +my $softsig_helper; + +# Our softsig helper should be in $TOP_OBJDIR/tests/opr. To calculate that +# path, use the BUILD env var if the test harness has set it; otherwise, our +# next best guess is that it's in the same dir as this script. +if (defined($ENV{BUILD})) { + $softsig_helper = $ENV{BUILD} . "/opr/softsig-helper"; +} else { + $softsig_helper = $Bin . "/softsig-helper"; +} # This -dummy argument prevents Perl from putting an intermediate sh # -c between us and softsig-helper in the case where the build diff --git a/tests/rx/Makefile.in b/tests/rx/Makefile.in index f5b4cf9..373aac6 100644 --- a/tests/rx/Makefile.in +++ b/tests/rx/Makefile.in @@ -5,7 +5,7 @@ abs_top_builddir=@abs_top_builddir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread -MODULE_CFLAGS = -I$(srcdir)/../.. +MODULE_CFLAGS = -I$(TOP_OBJDIR) LIBS = ../tap/libtap.a \ $(abs_top_builddir)/src/rx/liboafs_rx.la diff --git a/tests/util/Makefile.in b/tests/util/Makefile.in index 08e8fda..28debc0 100644 --- a/tests/util/Makefile.in +++ b/tests/util/Makefile.in @@ -5,7 +5,7 @@ abs_top_builddir=@abs_top_builddir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.lwp -MODULE_CFLAGS = -I$(srcdir)/../.. +MODULE_CFLAGS = -I$(TOP_OBJDIR) LIBS = ../tap/libtap.a \ $(abs_top_builddir)/lib/util.a \ diff --git a/tests/volser/Makefile.in b/tests/volser/Makefile.in index 6ba9d46..57ddd0b 100644 --- a/tests/volser/Makefile.in +++ b/tests/volser/Makefile.in @@ -6,7 +6,7 @@ include @TOP_OBJDIR@/src/config/Makefile.pthread TESTS = vos-t -MODULE_CFLAGS=-I$(srcdir)/../.. -I$(srcdir)/../common/ +MODULE_CFLAGS=-I$(TOP_OBJDIR) -I$(srcdir)/../common/ all check test tests: $(TESTS)