#
use File::Basename;
use Test::More;
+use afstest qw(src_path obj_path);
sub check_command_binary {
my $c = shift(@_);
#
# 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) = @_;
+
+ my $srcdir = src_path();
+ my $objdir = obj_path();
+
+ 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;