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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
#**************************************************************************
#* *
#* 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 GNU Lesser General Public License version 2.1, with the *
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
# Insertion sort in awk, because asort is a GNU extension. Lifted carefully
# with tongs out of the mawk manpage.
function isort(A, n) {
for (i = 1; i < n; i++) {
hold = A[j = i];
while (A[j-1] > hold) {
j--;
A[j+1] = A[j];
}
A[j] = hold;
}
}
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();
if (!(key in RESULTS)) ++nresults;
RESULTS[key] = "p";
delete SKIPPED[curdir];
clear();
}
function record_skip() {
check();
if (!(key in RESULTS)) ++nresults;
RESULTS[key] = "s";
if (curdir in SKIPPED) SKIPPED[curdir] = 1;
clear();
}
function record_na() {
check();
if (!(key in RESULTS)) ++nresults;
RESULTS[key] = "n";
if (curdir in SKIPPED) SKIPPED[curdir] = 1;
clear();
}
function record_fail() {
check();
if (!(key in RESULTS)) ++nresults;
RESULTS[key] = "f";
delete SKIPPED[curdir];
clear();
}
function record_unexp() {
if (!(key in RESULTS) || RESULTS[key] == "s"){
if (!(key in RESULTS)) ++nresults;
RESULTS[key] = "e";
}
delete SKIPPED[curdir];
clear();
}
/^> / {
next;
}
/Running tests from '[^']*'/ {
if (in_test) record_unexp();
match($0, /Running tests from '[^']*'/);
curdir = substr($0, RSTART+20, RLENGTH - 21);
# Use SKIPPED[curdir] as a sentinel to detect no output
SKIPPED[curdir] = 0;
key = curdir;
DIRS[key] = key;
curfile = "";
}
/ ... testing.* ... testing/ {
printf("error at line %d: found two test results on the same line\n", NR);
errored = 1;
}
/^ ... testing '[^']*' with / {
if (in_test) record_unexp();
next;
}
/^ ... testing '[^']*'/ {
if (in_test) record_unexp();
match($0, /... testing '[^']*'/);
curfile = substr($0, RSTART+13, RLENGTH-14);
if (match($0, /\(wall clock: .*s\)/)){
duration = substr($0, RSTART+13, RLENGTH-15);
if (duration + 0.0 > 10.0)
slow[slowcount++] = sprintf("%s: %s", curfile, duration);
}
key = sprintf ("%s/%s", curdir, curfile);
DIRS[key] = curdir;
in_test = 1;
}
/=> passed/ {
record_pass();
}
/=> skipped/ {
record_skip();
}
/=> n\/a/ {
record_na();
}
/=> failed/ {
record_fail();
}
/=> unexpected error/ {
record_unexp();
}
/make[^:]*: \*\*\* \[[^]]*\] Error/ {
errored = 1;
}
END {
if (ENVIRON["GITHUB_ACTIONS"] == "true") start_group = "::group::";
if (in_test) record_unexp();
if (errored){
printf ("\n#### Some fatal error occurred during testing.\n\n");
exit (3);
}else{
for (key in SKIPPED){
if (!SKIPPED[key]){
++ empty;
blanks[emptyidx++] = key;
delete SKIPPED[key];
}
}
for (key in RESULTS){
r = RESULTS[key];
if (r == "p"){
++ passed;
}else if (r == "f"){
++ failed;
fail[failidx++] = key;
}else if (r == "e"){
++ unexped;
unexp[unexpidx++] = key;
}else if (r == "s"){
++ skipped;
curdir = DIRS[key];
if (curdir in SKIPPED){
if (SKIPPED[curdir]){
SKIPPED[curdir] = 0;
skips[skipidx++] = curdir;
}
}else{
skips[skipidx++] = key;
}
}else if (r == "n"){
++ ignored;
}
}
isort(skips, skipidx);
isort(blanks, empty);
isort(fail, failed);
isort(unexp, unexped);
isort(slow, slowcount);
printf("\n");
if (skipped != 0){
printf("\n%sList of skipped tests:\n", start_group);
for (i=0; i < skipidx; i++) printf(" %s\n", skips[i]);
if (ENVIRON["GITHUB_ACTIONS"] == "true") print "::endgroup::";
}
if (slowcount != 0){
printf("\n\n%sTests taking longer than 10s:\n", start_group);
for (i=0; i < slowcount; i++) printf(" %s\n", slow[i]);
if (ENVIRON["GITHUB_ACTIONS"] == "true") print "::endgroup::";
}
if (empty != 0){
printf("\nList of directories returning no results:\n");
for (i=0; i < empty; i++) printf(" %s\n", blanks[i]);
}
if (failed != 0){
printf("\nList of failed tests:\n");
for (i=0; i < failed; i++) printf(" %s\n", fail[i]);
}
if (unexped != 0){
printf("\nList of unexpected errors:\n");
for (i=0; i < unexped; i++) printf(" %s\n", unexp[i]);
}
printf("\n");
printf("Summary:\n");
printf(" %4d tests passed\n", passed);
printf(" %4d tests skipped\n", skipped);
printf(" %4d tests failed\n", failed);
printf(" %4d tests not started (parent test skipped or failed)\n",
ignored);
printf(" %4d unexpected errors\n", unexped);
printf(" %4d tests considered", nresults);
if (nresults != passed + skipped + ignored + failed + unexped){
printf (" (totals don't add up??)");
}
printf ("\n");
if (failed || unexped){
printf("#### Something failed. Exiting with error status.\n\n");
exit 4;
}
}
}
|