2013-04-29 06:01:02 -07:00
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# OCaml #
|
|
|
|
# #
|
|
|
|
# Damien Doligez, projet Gallium, INRIA Rocquencourt #
|
|
|
|
# #
|
|
|
|
# Copyright 2013 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 check() {
|
|
|
|
if (!in_test){
|
|
|
|
printf("error at line %d: found test result without test start\n", NR);
|
|
|
|
errored = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clear() {
|
|
|
|
curfile = "";
|
|
|
|
in_test = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function record_pass() {
|
|
|
|
check();
|
|
|
|
++ passed;
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
2013-05-17 08:06:37 -07:00
|
|
|
function record_skip() {
|
|
|
|
check();
|
|
|
|
++ skipped;
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
2013-04-29 06:01:02 -07:00
|
|
|
function record_fail() {
|
|
|
|
check();
|
|
|
|
++ failed;
|
|
|
|
fail[failidx++] = sprintf ("%s/%s", curdir, curfile);
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
function record_unexp() {
|
|
|
|
++ unexped;
|
|
|
|
unexp[unexpidx++] = sprintf ("%s/%s", curdir, curfile);
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/Running tests from '[^']*'/ {
|
|
|
|
if (in_test) record_unexp();
|
|
|
|
match($0, /Running tests from '[^']*'/);
|
|
|
|
curdir = substr($0, RSTART+20, RLENGTH - 21);
|
|
|
|
curfile = "";
|
|
|
|
}
|
|
|
|
|
2013-05-14 10:05:21 -07:00
|
|
|
/ ... testing.* ... testing/ {
|
|
|
|
printf("error at line %d: found two test results on the same line\n", NR);
|
|
|
|
errored = 1;
|
|
|
|
}
|
|
|
|
|
2013-04-29 06:01:02 -07:00
|
|
|
/^ ... testing '[^']*'/ {
|
|
|
|
if (in_test) record_unexp();
|
|
|
|
match($0, /... testing '[^']*'/);
|
|
|
|
curfile = substr($0, RSTART+13, RLENGTH-14);
|
|
|
|
in_test = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/^ ... testing with / {
|
|
|
|
if (in_test) record_unexp();
|
|
|
|
in_test = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/=> passed/ {
|
|
|
|
record_pass();
|
|
|
|
}
|
|
|
|
|
2013-05-17 08:06:37 -07:00
|
|
|
/=> skipped/ {
|
|
|
|
record_skip();
|
|
|
|
}
|
|
|
|
|
2013-04-29 06:01:02 -07:00
|
|
|
/=> failed/ {
|
|
|
|
record_fail();
|
|
|
|
}
|
|
|
|
|
|
|
|
/=> unexpected error/ {
|
|
|
|
record_unexp();
|
|
|
|
}
|
|
|
|
|
2013-05-17 08:06:37 -07:00
|
|
|
# Not displaying "skipped" for the moment, as most of the skipped tests
|
|
|
|
# print nothing at all and are not counted.
|
|
|
|
|
2013-04-29 06:01:02 -07:00
|
|
|
END {
|
|
|
|
if (errored){
|
2013-05-14 10:05:21 -07:00
|
|
|
printf ("\n#### Some fatal error occurred during testing.\n\n");
|
2013-04-29 06:01:02 -07:00
|
|
|
exit (3);
|
|
|
|
}else{
|
|
|
|
printf("\n");
|
|
|
|
printf("Summary:\n");
|
|
|
|
printf(" %3d test(s) passed\n", passed);
|
|
|
|
printf(" %3d test(s) failed\n", failed);
|
|
|
|
printf(" %3d unexpected error(s)\n", unexped);
|
|
|
|
if (failed != 0){
|
|
|
|
printf("\nList of failed tests:\n");
|
2013-04-29 10:02:29 -07:00
|
|
|
for (i=0; i < failed; i++) printf(" %s\n", fail[i]);
|
2013-04-29 06:01:02 -07:00
|
|
|
}
|
|
|
|
if (unexped != 0){
|
|
|
|
printf("\nList of unexpected errors:\n");
|
2013-04-29 10:02:29 -07:00
|
|
|
for (i=0; i < unexped; i++) printf(" %s\n", unexp[i]);
|
2013-04-29 06:01:02 -07:00
|
|
|
}
|
|
|
|
printf("\n");
|
2013-04-29 12:15:28 -07:00
|
|
|
if (failed || unexped){
|
|
|
|
printf("#### Some tests failed. Exiting with error status.\n\n");
|
|
|
|
exit 4;
|
|
|
|
}
|
2013-04-29 06:01:02 -07:00
|
|
|
}
|
|
|
|
}
|