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
  <tests/tap/basic.h>. 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 <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2019-11-11 20:34:07 -06:00 committed by Benjamin Kaduk
parent 847b63af92
commit f4ab3767b7
9 changed files with 19 additions and 9 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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)