2 # This is probably horrific code to any Perl coder. I'm sorry,
3 # I'm not one. It runs.
5 # Proposed Coding Standard:
7 # * Subroutines starting with test_ should be TAP tests
8 # utilizing ok(), is(), etc... and return the number
9 # of tests run if they get that far (could exit early
15 sub check_command_binary {
18 BAIL_OUT("Cannot find $c");
22 # TAP test: test_command_man_pages
24 # Gather a list of a command's subcommands (like listvol for vos)
25 # by running a command with the "help" argument. From that list
26 # of subcommands spit out, see if a man page exists for that
29 # Arguments: two scalars:
31 # builddir : A path to the OpenAFS build directory,
34 # fullpathcommand : The full path to the actual command's
35 # binary, such as /tmp/1.4.14/src/volser/vos
37 # Returns: the number of tests run
39 sub test_command_man_pages {
40 my ($builddir, $fullpathcommand) = @_;
42 my $command = basename($fullpathcommand);
44 # build up our list of available commands from the help output
45 open(HELPOUT, "$fullpathcommand help 2>&1 |") or BAIL_OUT("can't fork: $!");
49 # Skip the header thingy
50 next if /Commands are/;
52 push(@subcommlist, $comm[0]);
55 @subcommlist = sort(@subcommlist);
57 # The following is because File::Find makes no sense to me
58 # for this purpose, and actually seems totally misnamed
62 # Since we don't know what man section it might be in,
63 # search all existing man page files for a filename match
64 my @mandirglob = glob("$builddir/doc/man-pages/man[1-8]/*");
65 # For every subcommand, see if command_subcommand.[1-8] exists
66 # in our man page build dir.
67 foreach (@subcommlist) {
70 my $frex = $command . '_' . $subcommand . '.[1-8]';
71 # diag("Looking for $frex");
72 foreach my $x (@mandirglob) {
81 $testcount = $testcount + 1;
82 ok($found eq 1, "existence of man page for $command" . "_$subcommand");