blob: aa0cfaaea505d7efb42b0c9b71b97db615f59f4a (
plain)
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
|
#########################################################################
# #
# OCaml #
# #
# Damien Doligez, Jane Street Capital #
# #
# Copyright 2014 Institut National de Recherche en Informatique et #
# en Automatique. All rights reserved. This file is distributed #
# under the terms of the Q Public License version 1.0. #
# #
#########################################################################
function error(msg) {
printf("unexpected error (%s) at line %d:\n", msg, NR);
printf(" %s\n", $0);
got_error = 1;
}
/^Testing .* \.\.\. pass$/ { ++npass; next; }
/^Testing .* \.\.\. skip$/ { ++nskip; next; }
/^Testing .* \.\.\. FAIL$/ {
sub(/^Testing/, "");
sub(/ ... FAIL$/, "");
failed[nfail++] = $0;
next;
}
{ error("invalid test result"); next; }
END {
printf("\n");
printf(" tests passed: %4d\n", npass);
printf(" tests skipped: %4d\n", nskip);
printf(" tests failed: %4d\n", nfail);
if (expected != ""){
total = npass + nskip + nfail;
printf(" total..........%4d (expected %d)\n", total, expected);
}
printf("\n");
if (nfail > 0){
printf("Failed tests:\n");
for (i in failed){
printf(" %s\n", failed[i]);
}
printf("\nSOME TESTS FAILED\n\n");
result = 3;
}
if (expected != "" && total != expected) {
printf("ERROR: wrong number of test results\n\n");
result = 4;
}
if (got_error){
printf("ERROR: unexpected errors in test scripts\n\n");
result = 5;
}
if (result == 0){
printf("ALL TESTS PASSED\n\n");
}
exit(result);
}
|