18 'wanted' => \
&find_callback
,
32 my $max_keyword_len = 0;
33 foreach $keyword (keys %$keywords)
34 { if($max_keyword_len < length($keyword)) { $max_keyword_len = length($keyword); } }
36 $max_keyword_len += length($delim) + length(' ');
38 my $last_keyword = '';
42 my ($keyword, $val) = @_;
44 if(!exists($$keywords{$keyword}))
46 print STDERR
"error: keyword $keyword not in \$keywords set\n";
52 if($keyword ne $last_keyword)
54 print("$keyword"); print($delim);
55 $keyword_len = length($keyword) + length($delim);
57 if($max_keyword_len > $keyword_len)
59 my $num_spaces = $max_keyword_len - $keyword_len;
60 print(' ' x
$num_spaces);
65 $last_keyword = $keyword;
70 $root = &realpath
($root);
71 print_line
("root", "$root\n");
73 find
($find_opts, $root);
77 if(exists($$makefiles{$_}))
80 my $reldir = $File::Find
::dir
;
81 $reldir =~ s
|^$root/||;
83 &print_line
("cwd", "\$root/$reldir\n");
86 my $arg; foreach $arg (@ARGV) { push @
$cmd, $arg; } # better way to do this?
87 &print_line
("cmd", "@$cmd\n");
89 open(SAVEOUT
, ">&STDOUT") || die("$!");
90 open(SAVEERR
, ">&STDERR") || die("$!");
91 open(STDOUT
, ">/tmp/unit-tests-stdout") || die("$!");
92 open(STDERR
, ">/tmp/unit-tests-stderr") || die("$!");
94 $ENV{UNIT_TEST_NAME
} = $reldir;
95 my $exit = system(@
$cmd);
97 close(STDOUT
) || die("$!");
98 close(STDERR
) || die("$!");
99 open(STDOUT
, ">&SAVEOUT") || die("$!");
100 open(STDERR
, ">&SAVEERR") || die("$!");
102 &print_line
("exit", "$exit\n");
104 open(OUT
, "</tmp/unit-tests-stdout") || die("$!");
107 &print_line
("stdout", "$_");
109 close(OUT
) || die("$!");
110 unlink("/tmp/unit-tests-stdout");
112 open(ERR
, "</tmp/unit-tests-stderr") || die("$!");
115 &print_line
("stderr", "$_");
117 close(ERR
) || die("$!");
119 unlink("/tmp/unit-tests-stderr");