Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
3 | # $Header: TEST,v 1.0 87/12/18 13:11:34 root Exp $ |
4 | |
5 | # This is written in a peculiar style, since we're trying to avoid |
6 | # most of the constructs we'll be testing for. |
7 | |
8 | if ($ARGV[0] eq '-v') { |
9 | $verbose = 1; |
10 | shift; |
11 | } |
12 | |
13 | if ($ARGV[0] eq '') { |
14 | @ARGV = split(/[ \n]/,`echo base.* comp.* cmd.* io.* op.*`); |
15 | } |
16 | |
17 | $bad = 0; |
18 | while ($test = shift) { |
19 | print "$test..."; |
20 | open(results,"$test|") || (print "can't run.\n"); |
21 | $ok = 0; |
22 | while (<results>) { |
23 | if ($verbose) { |
24 | print $_; |
25 | } |
26 | unless (/^#/) { |
27 | if (/^1\.\.([0-9]+)/) { |
28 | $max = $1; |
29 | $next = 1; |
30 | $ok = 1; |
31 | } else { |
32 | if (/^ok (.*)/ && $1 == $next) { |
33 | $next = $next + 1; |
34 | } else { |
35 | $ok = 0; |
36 | } |
37 | } |
38 | } |
39 | } |
40 | $next = $next - 1; |
41 | if ($ok && $next == $max) { |
42 | print "ok\n"; |
43 | } else { |
44 | $next += 1; |
45 | print "FAILED on test $next\n"; |
46 | $bad = $bad + 1; |
47 | $_ = $test; |
48 | if (/^base/) { |
49 | die "Failed a basic test--cannot continue."; |
50 | } |
51 | } |
52 | } |
53 | |
54 | if ($bad == 0) { |
55 | if ($ok) { |
56 | print "All tests successful.\n"; |
57 | } else { |
58 | die "FAILED--no tests were run for some reason."; |
59 | } |
60 | } else { |
61 | if ($bad == 1) { |
62 | die "Failed 1 test."; |
63 | } else { |
64 | die "Failed $bad tests."; |
65 | } |
66 | } |
67 | ($user,$sys,$cuser,$csys) = times; |
68 | print sprintf("u=%g s=%g cu=%g cs=%g\n",$user,$sys,$cuser,$csys); |