tests: Accommodate c-tap-harness 4.7

The SOURCE and BUILD environment variables have been changed to
C_TAP_SOURCE and C_TAP_BUILD in the new version of c-tap-harness.  The
runtests command syntax has changed as well.

Convert all of the old SOURCE and BUILD environment variables to the new
C_TAP_SOURCE and C_TAP_BUILD names.

Add the required -l command line option to specify the test list.

Add the new runtests -v option to run the tests in verbose mode to make
it easier to see which tests failed.

Change-Id: I209a6dc13d6cd1507519234fce1564fc4641e70b
Reviewed-on: https://gerrit.openafs.org/14295
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Michael Meffie 2020-08-04 10:34:07 -04:00 committed by Benjamin Kaduk
parent 3f377aa117
commit 624219a1b2
16 changed files with 32 additions and 32 deletions

View File

@ -6,8 +6,8 @@ abs_top_builddir=@abs_top_builddir@
include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread include @TOP_OBJDIR@/src/config/Makefile.pthread
MODULE_CFLAGS = -DSOURCE='"$(abs_top_srcdir)/tests"' \ MODULE_CFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
-DBUILD='"$(abs_top_builddir)/tests"' -DC_TAP_BUILD='"$(abs_top_builddir)/tests"'
SUBDIRS = tap common auth util cmd volser opr rx SUBDIRS = tap common auth util cmd volser opr rx
@ -23,7 +23,7 @@ runtests.o: $(srcdir)/runtests.c
check test tests: runtests check test tests: runtests
@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done @for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \ MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \
./runtests $(abs_top_srcdir)/tests/TESTS ./runtests -v -l $(abs_top_srcdir)/tests/TESTS
install: install:

View File

@ -128,11 +128,11 @@ int main(int argc, char **argv)
goto out; goto out;
/* Work out the path to our KeyFile. If the test harness hasn't set /* Work out the path to our KeyFile. If the test harness hasn't set
* the SOURCE environment variable, then assume it is in our CWD */ * the C_TAP_SOURCE environment variable, then assume it is in our CWD */
if (getenv("SOURCE") == NULL) { if (getenv("C_TAP_SOURCE") == NULL) {
keyfilesrc = strdup("KeyFile"); keyfilesrc = strdup("KeyFile");
} else { } else {
if (asprintf(&keyfilesrc, "%s/auth/KeyFile", getenv("SOURCE")) == -1) if (asprintf(&keyfilesrc, "%s/auth/KeyFile", getenv("C_TAP_SOURCE")) == -1)
goto out; goto out;
} }

View File

@ -20,16 +20,16 @@ if (!defined(gethostbyname(hostname()))) {
plan tests => 1; plan tests => 1;
my $cmd; my $cmd;
if (defined($ENV{BUILD})) { if (defined($ENV{C_TAP_BUILD})) {
$cmd = $ENV{BUILD} . "/auth/writekeyfile"; $cmd = $ENV{C_TAP_BUILD} . "/auth/writekeyfile";
} else { } else {
$cmd = $Bin . "/writekeyfile"; $cmd = $Bin . "/writekeyfile";
} }
$cmd = abs_path($cmd); $cmd = abs_path($cmd);
my $keyfile; my $keyfile;
if (defined($ENV{SOURCE})) { if (defined($ENV{C_TAP_SOURCE})) {
$keyfile = $ENV{SOURCE} . "/auth/KeyFile.short"; $keyfile = $ENV{C_TAP_SOURCE} . "/auth/KeyFile.short";
} else { } else {
$keyfile = $Bin . "/KeyFile.short"; $keyfile = $Bin . "/KeyFile.short";
} }

View File

@ -2,7 +2,7 @@
use strict; use strict;
use warnings; use warnings;
use lib $ENV{SOURCE} . "/tests-lib/perl5"; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
use mancheck_utils; use mancheck_utils;
run_manpage_tests("src/bozo", "bos"); run_manpage_tests("src/bozo", "bos");

View File

@ -2,7 +2,7 @@
use strict; use strict;
use warnings; use warnings;
use lib $ENV{SOURCE} . "/tests-lib/perl5"; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
use mancheck_utils; use mancheck_utils;
run_manpage_tests("src/bucoord", "backup"); run_manpage_tests("src/bucoord", "backup");

View File

@ -360,10 +360,10 @@ main(int argc, char **argv)
cmd_FreeArgv(tv); cmd_FreeArgv(tv);
/* Now, try adding a configuration file into the mix */ /* Now, try adding a configuration file into the mix */
if (getenv("SOURCE") == NULL) if (getenv("C_TAP_SOURCE") == NULL)
path = strdup("test1.conf"); path = strdup("test1.conf");
else { else {
if (asprintf(&path, "%s/cmd/test1.conf", getenv("SOURCE")) < 0) if (asprintf(&path, "%s/cmd/test1.conf", getenv("C_TAP_SOURCE")) < 0)
path = NULL; path = NULL;
} }
if (path != NULL) { if (path != NULL) {

View File

@ -33,7 +33,7 @@ afstest_StartVLServer(char *dirname, pid_t *serverPid)
char *binPath, *logPath, *dbPath, *build; char *binPath, *logPath, *dbPath, *build;
/* Child */ /* Child */
build = getenv("BUILD"); build = getenv("C_TAP_BUILD");
if (build == NULL) if (build == NULL)
build = ".."; build = "..";

View File

@ -2,7 +2,7 @@
use strict; use strict;
use warnings; use warnings;
use lib $ENV{SOURCE} . "/tests-lib/perl5"; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
use mancheck_utils; use mancheck_utils;
run_manpage_tests("src/kauth", "kas"); run_manpage_tests("src/kauth", "kas");

View File

@ -36,10 +36,10 @@ use FindBin qw($Bin);
my $softsig_helper; my $softsig_helper;
# Our softsig helper should be in $TOP_OBJDIR/tests/opr. To calculate that # 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 # path, use the C_TAP_BUILD env var if the test harness has set it; otherwise,
# next best guess is that it's in the same dir as this script. # our next best guess is that it's in the same dir as this script.
if (defined($ENV{BUILD})) { if (defined($ENV{C_TAP_BUILD})) {
$softsig_helper = $ENV{BUILD} . "/opr/softsig-helper"; $softsig_helper = $ENV{C_TAP_BUILD} . "/opr/softsig-helper";
} else { } else {
$softsig_helper = $Bin . "/softsig-helper"; $softsig_helper = $Bin . "/softsig-helper";
} }

View File

@ -6,7 +6,7 @@ use warnings;
use File::Basename; use File::Basename;
use Test::More tests=>2; use Test::More tests=>2;
my $builddir = $ENV{BUILD}; my $builddir = $ENV{C_TAP_BUILD};
if (!$builddir) { if (!$builddir) {
$builddir = dirname($0)."/.."; $builddir = dirname($0)."/..";
} }

View File

@ -2,7 +2,7 @@
use strict; use strict;
use warnings; use warnings;
use lib $ENV{SOURCE} . "/tests-lib/perl5"; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
use mancheck_utils; use mancheck_utils;
run_manpage_tests("src/ptserver", "pts"); run_manpage_tests("src/ptserver", "pts");

View File

@ -7,7 +7,7 @@ use Test::More tests=>4;
use POSIX qw(:sys_wait_h :signal_h); use POSIX qw(:sys_wait_h :signal_h);
my $port = 4000; my $port = 4000;
my $build = $ENV{BUILD}; my $build = $ENV{C_TAP_BUILD};
$build = ".." if (!defined($build)); $build = ".." if (!defined($build));
my $rxperf = $build."/../src/tools/rxperf/rxperf"; my $rxperf = $build."/../src/tools/rxperf/rxperf";

View File

@ -99,12 +99,12 @@ sub test_command_man_pages {
sub run_manpage_tests($$) { sub run_manpage_tests($$) {
my ($subdir, $command) = @_; my ($subdir, $command) = @_;
# When run from 'runtests', our cwd will be TOP_OBJDIR/tests. $SOURCE is # When run from 'runtests', our cwd will be TOP_OBJDIR/tests. $C_TAP_SOURCE
# set to TOP_SRCDIR/tests, and $BUILD is set to TOP_OBJDIR/tests. We want # is set to TOP_SRCDIR/tests, and $C_TAP_BUILD is set to TOP_OBJDIR/tests.
# the top-level src and obj dirs, in order to find the relevant binaries # We want the top-level src and obj dirs, in order to find the relevant
# and manpages. # binaries and manpages.
my $srcdir = $ENV{SOURCE} . "/.."; my $srcdir = $ENV{C_TAP_SOURCE} . "/..";
my $objdir = $ENV{BUILD} . "/.."; my $objdir = $ENV{C_TAP_BUILD} . "/..";
my @sub_commands = lookup_sub_commands("$objdir/$subdir", $command); my @sub_commands = lookup_sub_commands("$objdir/$subdir", $command);
die("No subcommands found in $objdir/$subdir/$command?") unless(@sub_commands); die("No subcommands found in $objdir/$subdir/$command?") unless(@sub_commands);

View File

@ -2,7 +2,7 @@
use strict; use strict;
use warnings; use warnings;
use lib $ENV{SOURCE} . "/tests-lib/perl5"; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
use mancheck_utils; use mancheck_utils;
run_manpage_tests("src/venus", "fs"); run_manpage_tests("src/venus", "fs");

View File

@ -2,7 +2,7 @@
use strict; use strict;
use warnings; use warnings;
use lib $ENV{SOURCE} . "/tests-lib/perl5"; use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
use mancheck_utils; use mancheck_utils;
run_manpage_tests("src/volser", "vos"); run_manpage_tests("src/volser", "vos");

View File

@ -69,7 +69,7 @@ TestListAddrs(struct ubik_client *client, char *dirname)
close(outpipe[0]); close(outpipe[0]);
close(outpipe[1]); close(outpipe[1]);
build = getenv("BUILD"); build = getenv("C_TAP_BUILD");
if (build == NULL) if (build == NULL)
build = ".."; build = "..";