File: checktests.in

package info (click to toggle)
mpich 4.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 423,384 kB
  • sloc: ansic: 1,088,434; cpp: 71,364; javascript: 40,763; f90: 22,829; sh: 17,463; perl: 14,773; xml: 14,418; python: 10,265; makefile: 9,246; fortran: 8,008; java: 4,355; asm: 324; ruby: 176; lisp: 19; php: 8; sed: 4
file content (100 lines) | stat: -rwxr-xr-x 2,320 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#! @PERL@
##
## Copyright (C) by Argonne National Laboratory
##     See COPYRIGHT in top-level directory
##

$debug   = 1;
$verbose = 1;
$ignoreBogusOutput = 0;
$filePattern = "runtests.*.status";

$testsPassed = 0;
$testsFailed = 0;

foreach $_ (@ARGV) {
    if (/^--?ignorebogus/) {
	$ignoreBogusOutput = 1;
    }
    else {
	print STDERR "checktests [ -ignorebogus ]\n";
	exit(1);
    }
}

open( RESULTS, "ls -1 $filePattern |" ) || die "Cannot list directory using ls -1 $filePattern\n";

while (<RESULTS>) {
    chop;
    $statusFile = $_;
    $resultsFile = $statusFile;
    $resultsFile =~ s/\.status/.out/;

    if ($resultsFile =~ /runtests\.([0-9]+)\.out/) {
	$count = $1;
    }
    else {
	$count = -1;
	print STDERR "Unable to determine test number from $resultsFile!\n";
	$testsFailed ++;
	next;
    }
    open (SFD, "<$statusFile" );
    while (<SFD>) {
	chop;
	$testStatus = $_;
    }
    close (SFD);
    
    if (-s $resultsFile) {
	open (RFD, "<$resultsFile");
	$runLine = <RFD>;
	$sawNoerrors = 0;
	# Successful output should contain ONLY the line No Errors
	while (<RFD>) {
	    chop;
	    $outLine = $_;
	    if ($outLine =~ /^\s+No [Ee]rrors\s*$/) {
		$sawNoerrors = 1;
	    }
	    else {
		# To filter out output that may be added to STDOUT
		# by a badly behaved runtime system, you can either
		# add a specific filter here (preferred) or set the
		# -ignorebogus option (considered a workaround)
		# The following is an example that accepts certain
		# kinds of output once "No Errors" is seen.
	        if ($sawNoerrors) {
		    if ( /^Application [0-9]+ resources: utime .*/) {
		        last;
                    }
                }
	        if (!$ignoreBogusOutput) {
		    # Any extraneous output is an error
		    $sawNoerrors = 0;
		}
	    }
	}
	close (RFD);
	if ($sawNoerrors == 1 && $testStatus == 0) {
	    $testsPassed ++;
	}
	else {
	    # Test wrote No Errors but then exited with a non-zero status
	    $testsFailed ++;
	    # Output the errors
	    if ($verbose) {
		print STDOUT "Test $count failed:\n";
		print STDOUT "Test status: $testStatus\n";
		print STDOUT "Test output:\n";
		system ("cat $resultsFile" );
	    }
	}
    }
    else {
	print STDERR "No $resultsFile\n" if $debug;
	$testsFailed ++;
    }
}

print "Tests passed: $testsPassed; test failed: $testsFailed\n";