Adding better testing; not relying on previous tests results.
[packages/hpc.git] / tests / hpcrun.pl
1 #
2 # This command wraps round a command execution, adding some hpc tests.
3 #
4
5 while($ARGV[0] =~ /^--/) {
6 $arg = shift @ARGV;
7 if ($arg =~ /--hpc=(.*)/) {
8 $HPC = $1;
9 }
10 if ($ARGV[0] =~ /--report/) {
11 shift @ARGV;
12 $REPORT = 1;
13 }
14 elsif ($arg =~ /--exeext=(.*)/) {
15 $exeext = $1;
16 }
17 else {
18 die "Bad arg: $arg"
19 }
20 }
21
22
23 die "no option --hpc=* provided\n" if (!defined($HPC));
24
25 $binary = $ARGV[0] . $exeext;
26
27 system("rm -f $binary.tix") if (defined($CLEAR));
28
29 system(@ARGV);
30 print "\n\n";
31 system("$HPC report $binary.tix");
32 print "\n\n";
33 system("$HPC report $binary.tix --per-module");
34 print "\n\n";
35 open(MARKUP,"$HPC markup $binary.tix| ");
36 while(<MARKUP>) {
37 my $line = $_;
38 print $line;
39 if (/Writing: (\S+.html)/) {
40 system("cat $1");
41 }
42 }
43 print "\n\n";