From 624219a1b2192e5c7b6b45e2cbe784a9c5f33a96 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Tue, 4 Aug 2020 10:34:07 -0400 Subject: [PATCH 1/1] 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 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk --- tests/Makefile.in | 6 +++--- tests/auth/keys-t.c | 6 +++--- tests/auth/writeoldkey-t | 8 ++++---- tests/bozo/bos-man-t | 2 +- tests/bucoord/backup-man-t | 2 +- tests/cmd/command-t.c | 4 ++-- tests/common/servers.c | 2 +- tests/kauth/kas-man-t | 2 +- tests/opr/softsig-t | 8 ++++---- tests/ptserver/pt_util-t | 2 +- tests/ptserver/pts-man-t | 2 +- tests/rx/perf-t | 2 +- tests/tests-lib/perl5/mancheck_utils.pm | 12 ++++++------ tests/venus/fs-man-t | 2 +- tests/volser/vos-man-t | 2 +- tests/volser/vos-t.c | 2 +- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/Makefile.in b/tests/Makefile.in index 7859028..29559ba 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -6,8 +6,8 @@ abs_top_builddir=@abs_top_builddir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread -MODULE_CFLAGS = -DSOURCE='"$(abs_top_srcdir)/tests"' \ - -DBUILD='"$(abs_top_builddir)/tests"' +MODULE_CFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \ + -DC_TAP_BUILD='"$(abs_top_builddir)/tests"' SUBDIRS = tap common auth util cmd volser opr rx @@ -23,7 +23,7 @@ runtests.o: $(srcdir)/runtests.c check test tests: runtests @for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done 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: diff --git a/tests/auth/keys-t.c b/tests/auth/keys-t.c index 789b49b..f0556ce 100644 --- a/tests/auth/keys-t.c +++ b/tests/auth/keys-t.c @@ -128,11 +128,11 @@ int main(int argc, char **argv) goto out; /* 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 */ - if (getenv("SOURCE") == NULL) { + * the C_TAP_SOURCE environment variable, then assume it is in our CWD */ + if (getenv("C_TAP_SOURCE") == NULL) { keyfilesrc = strdup("KeyFile"); } else { - if (asprintf(&keyfilesrc, "%s/auth/KeyFile", getenv("SOURCE")) == -1) + if (asprintf(&keyfilesrc, "%s/auth/KeyFile", getenv("C_TAP_SOURCE")) == -1) goto out; } diff --git a/tests/auth/writeoldkey-t b/tests/auth/writeoldkey-t index 1238dce..3240212 100755 --- a/tests/auth/writeoldkey-t +++ b/tests/auth/writeoldkey-t @@ -20,16 +20,16 @@ if (!defined(gethostbyname(hostname()))) { plan tests => 1; my $cmd; -if (defined($ENV{BUILD})) { - $cmd = $ENV{BUILD} . "/auth/writekeyfile"; +if (defined($ENV{C_TAP_BUILD})) { + $cmd = $ENV{C_TAP_BUILD} . "/auth/writekeyfile"; } else { $cmd = $Bin . "/writekeyfile"; } $cmd = abs_path($cmd); my $keyfile; -if (defined($ENV{SOURCE})) { - $keyfile = $ENV{SOURCE} . "/auth/KeyFile.short"; +if (defined($ENV{C_TAP_SOURCE})) { + $keyfile = $ENV{C_TAP_SOURCE} . "/auth/KeyFile.short"; } else { $keyfile = $Bin . "/KeyFile.short"; } diff --git a/tests/bozo/bos-man-t b/tests/bozo/bos-man-t index cfdc809..40758e8 100755 --- a/tests/bozo/bos-man-t +++ b/tests/bozo/bos-man-t @@ -2,7 +2,7 @@ use strict; use warnings; -use lib $ENV{SOURCE} . "/tests-lib/perl5"; +use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use mancheck_utils; run_manpage_tests("src/bozo", "bos"); diff --git a/tests/bucoord/backup-man-t b/tests/bucoord/backup-man-t index 2366e79..95343d7 100755 --- a/tests/bucoord/backup-man-t +++ b/tests/bucoord/backup-man-t @@ -2,7 +2,7 @@ use strict; use warnings; -use lib $ENV{SOURCE} . "/tests-lib/perl5"; +use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use mancheck_utils; run_manpage_tests("src/bucoord", "backup"); diff --git a/tests/cmd/command-t.c b/tests/cmd/command-t.c index 796ff22..71efd39 100644 --- a/tests/cmd/command-t.c +++ b/tests/cmd/command-t.c @@ -360,10 +360,10 @@ main(int argc, char **argv) cmd_FreeArgv(tv); /* Now, try adding a configuration file into the mix */ - if (getenv("SOURCE") == NULL) + if (getenv("C_TAP_SOURCE") == NULL) path = strdup("test1.conf"); 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; } if (path != NULL) { diff --git a/tests/common/servers.c b/tests/common/servers.c index 70dd366..716b0ca 100644 --- a/tests/common/servers.c +++ b/tests/common/servers.c @@ -33,7 +33,7 @@ afstest_StartVLServer(char *dirname, pid_t *serverPid) char *binPath, *logPath, *dbPath, *build; /* Child */ - build = getenv("BUILD"); + build = getenv("C_TAP_BUILD"); if (build == NULL) build = ".."; diff --git a/tests/kauth/kas-man-t b/tests/kauth/kas-man-t index a877b73..bb78302 100755 --- a/tests/kauth/kas-man-t +++ b/tests/kauth/kas-man-t @@ -2,7 +2,7 @@ use strict; use warnings; -use lib $ENV{SOURCE} . "/tests-lib/perl5"; +use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use mancheck_utils; run_manpage_tests("src/kauth", "kas"); diff --git a/tests/opr/softsig-t b/tests/opr/softsig-t index 2932edc..d750d98 100755 --- a/tests/opr/softsig-t +++ b/tests/opr/softsig-t @@ -36,10 +36,10 @@ use FindBin qw($Bin); 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"; +# path, use the C_TAP_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{C_TAP_BUILD})) { + $softsig_helper = $ENV{C_TAP_BUILD} . "/opr/softsig-helper"; } else { $softsig_helper = $Bin . "/softsig-helper"; } diff --git a/tests/ptserver/pt_util-t b/tests/ptserver/pt_util-t index 723b858..553b2be 100755 --- a/tests/ptserver/pt_util-t +++ b/tests/ptserver/pt_util-t @@ -6,7 +6,7 @@ use warnings; use File::Basename; use Test::More tests=>2; -my $builddir = $ENV{BUILD}; +my $builddir = $ENV{C_TAP_BUILD}; if (!$builddir) { $builddir = dirname($0)."/.."; } diff --git a/tests/ptserver/pts-man-t b/tests/ptserver/pts-man-t index 4bfabee..0376f02 100755 --- a/tests/ptserver/pts-man-t +++ b/tests/ptserver/pts-man-t @@ -2,7 +2,7 @@ use strict; use warnings; -use lib $ENV{SOURCE} . "/tests-lib/perl5"; +use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use mancheck_utils; run_manpage_tests("src/ptserver", "pts"); diff --git a/tests/rx/perf-t b/tests/rx/perf-t index 19ec85a..a6ce387 100755 --- a/tests/rx/perf-t +++ b/tests/rx/perf-t @@ -7,7 +7,7 @@ use Test::More tests=>4; use POSIX qw(:sys_wait_h :signal_h); my $port = 4000; -my $build = $ENV{BUILD}; +my $build = $ENV{C_TAP_BUILD}; $build = ".." if (!defined($build)); my $rxperf = $build."/../src/tools/rxperf/rxperf"; diff --git a/tests/tests-lib/perl5/mancheck_utils.pm b/tests/tests-lib/perl5/mancheck_utils.pm index 90a9e0a..62e1693 100644 --- a/tests/tests-lib/perl5/mancheck_utils.pm +++ b/tests/tests-lib/perl5/mancheck_utils.pm @@ -99,12 +99,12 @@ sub test_command_man_pages { sub run_manpage_tests($$) { my ($subdir, $command) = @_; - # When run from 'runtests', our cwd will be TOP_OBJDIR/tests. $SOURCE is - # set to TOP_SRCDIR/tests, and $BUILD is set to TOP_OBJDIR/tests. We want - # the top-level src and obj dirs, in order to find the relevant binaries - # and manpages. - my $srcdir = $ENV{SOURCE} . "/.."; - my $objdir = $ENV{BUILD} . "/.."; + # When run from 'runtests', our cwd will be TOP_OBJDIR/tests. $C_TAP_SOURCE + # is set to TOP_SRCDIR/tests, and $C_TAP_BUILD is set to TOP_OBJDIR/tests. + # We want the top-level src and obj dirs, in order to find the relevant + # binaries and manpages. + my $srcdir = $ENV{C_TAP_SOURCE} . "/.."; + my $objdir = $ENV{C_TAP_BUILD} . "/.."; my @sub_commands = lookup_sub_commands("$objdir/$subdir", $command); die("No subcommands found in $objdir/$subdir/$command?") unless(@sub_commands); diff --git a/tests/venus/fs-man-t b/tests/venus/fs-man-t index 952b6bb..219a33a 100755 --- a/tests/venus/fs-man-t +++ b/tests/venus/fs-man-t @@ -2,7 +2,7 @@ use strict; use warnings; -use lib $ENV{SOURCE} . "/tests-lib/perl5"; +use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use mancheck_utils; run_manpage_tests("src/venus", "fs"); diff --git a/tests/volser/vos-man-t b/tests/volser/vos-man-t index 8bd7259..af0fb30 100755 --- a/tests/volser/vos-man-t +++ b/tests/volser/vos-man-t @@ -2,7 +2,7 @@ use strict; use warnings; -use lib $ENV{SOURCE} . "/tests-lib/perl5"; +use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5"; use mancheck_utils; run_manpage_tests("src/volser", "vos"); diff --git a/tests/volser/vos-t.c b/tests/volser/vos-t.c index 758535e..05ec8fd 100644 --- a/tests/volser/vos-t.c +++ b/tests/volser/vos-t.c @@ -69,7 +69,7 @@ TestListAddrs(struct ubik_client *client, char *dirname) close(outpipe[0]); close(outpipe[1]); - build = getenv("BUILD"); + build = getenv("C_TAP_BUILD"); if (build == NULL) build = ".."; -- 1.9.4