From f4ab3767b7e65028b93e731da6f09ee385c51daf Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 11 Nov 2019 20:34:07 -0600 Subject: [PATCH] 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 --- tests/Makefile.in | 2 +- tests/auth/Makefile.in | 2 +- tests/cmd/Makefile.in | 2 +- tests/common/Makefile.in | 2 +- tests/opr/Makefile.in | 2 +- tests/opr/softsig-t | 12 +++++++++++- tests/rx/Makefile.in | 2 +- tests/util/Makefile.in | 2 +- tests/volser/Makefile.in | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/Makefile.in b/tests/Makefile.in index 23f1fa096a..7859028f32 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 ed4ed27ae7..78bc0c803d 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 57dfe8fe2c..9c042ffeb0 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 f71d9d37f9..3bc6096972 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 96601775a9..d9a37f63df 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 533feb4fd3..09f4e50595 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 f5b4cf9244..373aac6efa 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 08e8fda206..28debc01d7 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 6ba9d46d6a..57ddd0b533 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)