use strict;
use warnings;
-use File::Basename;
-use lib "./tests-lib/perl5";
+use lib $ENV{SOURCE} . "/tests-lib/perl5";
use mancheck_utils;
-# Set this to the bare command to test
-my $command = 'bos';
-my $builddir = $ENV{BUILD};
-if (!$builddir) {
- $builddir = dirname($0) . "/..";
-}
-$builddir .= "/..";
-# Set this to the directory holding $command
-my $srcdir = "$builddir/src/bozo";
-
-#---------------------------------------------------------------------
-
-my @sub_commands = lookup_sub_commands($srcdir, $command);
-plan tests => scalar @sub_commands;
-
-test_command_man_pages($builddir, $command, @sub_commands);
-
+run_manpage_tests("src/bozo", "bos");
use strict;
use warnings;
-use File::Basename;
-use lib "./tests-lib/perl5";
+use lib $ENV{SOURCE} . "/tests-lib/perl5";
use mancheck_utils;
-# Set this to the bare command to test
-my $command = 'backup';
-my $builddir = $ENV{BUILD};
-if (!$builddir) {
- $builddir = dirname($0) . "/..";
-}
-$builddir .= "/..";
-# Set this to the directory holding $command
-my $srcdir = "$builddir/src/bucoord";
-
-#---------------------------------------------------------------------
-
-my @sub_commands = lookup_sub_commands($srcdir, $command);
-plan tests => scalar @sub_commands;
-
-test_command_man_pages($builddir, $command, @sub_commands);
-
+run_manpage_tests("src/bucoord", "backup");
use strict;
use warnings;
-use File::Basename;
-use lib "./tests-lib/perl5";
+use lib $ENV{SOURCE} . "/tests-lib/perl5";
use mancheck_utils;
-# Set this to the bare command to test
-my $command = 'kas';
-my $builddir = $ENV{BUILD};
-if (!$builddir) {
- $builddir = dirname($0) . "/..";
-}
-$builddir .= "/..";
-# Set this to the directory holding $command
-my $srcdir = "$builddir/src/kauth";
-
-#---------------------------------------------------------------------
-
-my @sub_commands = lookup_sub_commands($srcdir, $command);
-plan tests => scalar @sub_commands;
-
-test_command_man_pages($builddir, $command, @sub_commands);
-
+run_manpage_tests("src/kauth", "kas");
use strict;
use warnings;
-use File::Basename;
-use lib "./tests-lib/perl5";
+use lib $ENV{SOURCE} . "/tests-lib/perl5";
use mancheck_utils;
-# Set this to the bare command to test
-my $command = 'pts';
-my $builddir = $ENV{BUILD};
-if (!$builddir) {
- $builddir = dirname($0) . "/..";
-}
-$builddir .= "/..";
-# Set this to the directory holding $command
-my $srcdir = "$builddir/src/ptserver";
-
-#---------------------------------------------------------------------
-
-my @sub_commands = lookup_sub_commands($srcdir, $command);
-plan tests => scalar @sub_commands;
-
-test_command_man_pages($builddir, $command, @sub_commands);
-
+run_manpage_tests("src/ptserver", "pts");
#
# Arguments:
#
-# builddir : A path to the OpenAFS build directory,
+# srcdir : A path to the OpenAFS source directory,
# such as /tmp/1.4.14
#
# command : the name of the command (e.g. vos)
# subcommlist : a list of sub-commands for command
#
sub test_command_man_pages {
- my ($builddir, $command, @subcommlist) = @_;
+ my ($srcdir, $command, @subcommlist) = @_;
# The following is because File::Find makes no sense to me
# for this purpose, and actually seems totally misnamed
my $frex = "";
# Since we don't know what man section it might be in,
# search all existing man page files for a filename match
- my @mandirglob = glob("$builddir/doc/man-pages/man[1-8]/*");
+ my @mandirglob = glob("$srcdir/doc/man-pages/man[1-8]/*");
# For every subcommand, see if command_subcommand.[1-8] exists
- # in our man page build dir.
+ # in our man page source dir.
foreach (@subcommlist) {
my $subcommand = $_;
$found = 0;
ok($found eq 1, "existence of man page for $command" . "_$subcommand");
}
}
+
+#
+# Setup the test plan and run all of the tests for the given command suite.
+#
+# Call like so:
+# run_manpage_tests("src/ptserver", "pts");
+#
+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} . "/..";
+
+ my @sub_commands = lookup_sub_commands("$objdir/$subdir", $command);
+ die("No subcommands found in $objdir/$subdir/$command?") unless(@sub_commands);
+
+ plan tests => scalar @sub_commands;
+
+ test_command_man_pages($srcdir, $command, @sub_commands);
+}
1;
use strict;
use warnings;
-use File::Basename;
-use lib "./tests-lib/perl5";
+use lib $ENV{SOURCE} . "/tests-lib/perl5";
use mancheck_utils;
-# Set this to the bare command to test
-my $command = 'fs';
-my $builddir = $ENV{BUILD};
-if (!$builddir) {
- $builddir = dirname($0) . "/..";
-}
-$builddir .= "/..";
-# Set this to the directory holding $command
-my $srcdir = "$builddir/src/venus";
-
-#---------------------------------------------------------------------
-
-my @sub_commands = lookup_sub_commands($srcdir, $command);
-plan tests => scalar @sub_commands;
-
-test_command_man_pages($builddir, $command, @sub_commands);
-
+run_manpage_tests("src/venus", "fs");
use strict;
use warnings;
-use File::Basename;
-use lib "./tests-lib/perl5";
+use lib $ENV{SOURCE} . "/tests-lib/perl5";
use mancheck_utils;
-# Set this to the bare command to test
-my $command = 'vos';
-my $builddir = $ENV{BUILD};
-if (!$builddir) {
- $builddir = dirname($0) . "/..";
-}
-$builddir .= "/..";
-# Set this to the directory holding $command
-my $srcdir = "$builddir/src/volser";
-
-#---------------------------------------------------------------------
-
-my @sub_commands = lookup_sub_commands($srcdir, $command);
-plan tests => scalar @sub_commands;
-
-test_command_man_pages($builddir, $command, @sub_commands);
+run_manpage_tests("src/volser", "vos");