From e0cb91a92262b52df2aa711977761c3cd66da39a Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 17 May 2020 09:57:12 +0200 Subject: [PATCH] cex: tests: be robust to variations in time limit reports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CI has "failures" such as (253, "Null nonterminals"): @@ -21,7 +21,7 @@ 3: 3 b: . %empty 3: 4 c: . %empty On Symbols: {A,} -time limit exceeded: 6.000000 +time limit exceeded: 11.000000 First Example c • c A A $end First derivation $accept ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ • ] d ::=[ c A A ] ] ] ] $end ] Second Example c • A $end * tests/counterexample.at (AT_BISON_CHECK_CEX): New. Use it to neutralize differences in timeout values. --- tests/counterexample.at | 39 ++++++++++++++++++++++++--------------- tests/local.at | 2 +- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/tests/counterexample.at b/tests/counterexample.at index a1cbd3e0..09a354cd 100644 --- a/tests/counterexample.at +++ b/tests/counterexample.at @@ -17,6 +17,15 @@ AT_BANNER([[Counterexamples.]]) +m4_define([AT_BISON_CHECK_CEX], +[AT_DATA([experr], [$4]) +sed -e ['s/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g'] \ + experr >expout +AT_BISON_CHECK([-Wcounterexample $1], [$2], [$3], [stderr]) +AT_CHECK([[sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr]], + [], [expout]) +]) + ## --------------------- ## ## Simple Unifying S/R. ## ## --------------------- ## @@ -34,7 +43,7 @@ x: B | B C; y: A | A B; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 1: 3 a: A . 1: 8 y: A . B @@ -66,7 +75,7 @@ a: A | A a; bc: B bc C | B C; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 1: 7 a: A . 1: 5 b: . B @@ -99,7 +108,7 @@ y: %empty | Y y; xby: B | X xby Y; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 1: 4 x: . %empty 1: 9 xby: . B @@ -141,7 +150,7 @@ cd: C D; bc: B C; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 2: 7 b: B . 2: 9 bc: B . C @@ -173,7 +182,7 @@ x: A; y: A A B; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 1: 5 x: A . 1: 6 y: A . A B @@ -209,7 +218,7 @@ xy: X Y; y: Y; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 4: 3 r: b . 4: 7 s: b . A xx y @@ -248,7 +257,7 @@ a : A b ; b : A | b; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Reduce-Reduce Conflict: 4: 1 a: A b . 4: 3 b: b . @@ -278,7 +287,7 @@ a: D; b: D; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Reduce-Reduce Conflict: 2: 5 a: D . 2: 6 b: D . @@ -309,7 +318,7 @@ a: H i; i: X | i J K; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 5: 2 a: H i . 5: 4 i: i . J K @@ -345,7 +354,7 @@ a: A; b: A B C | A B D; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 4: 7 a: A . 4: 8 b: A . B C @@ -380,7 +389,7 @@ B : A b A; C : A c A; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Reduce-Reduce Conflict: 3: 3 A: B . 3: 5 A: . %empty @@ -418,7 +427,7 @@ c : ; d : a | c A | d; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Reduce-Reduce Conflict: 0: 3 b: . %empty 0: 4 c: . %empty @@ -518,7 +527,7 @@ a: H i J J i: %empty | i J; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 7: 5 i: i J . 7: 3 a: H i J . J @@ -553,7 +562,7 @@ C: %empty D: d; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 3: 5 C: . %empty 3: 6 D: . d @@ -586,7 +595,7 @@ C: %empty D: d; ]]) -AT_BISON_CHECK([-Wcounterexample input.y], [], [], +AT_BISON_CHECK_CEX([input.y], [], [], [[Shift-Reduce Conflict: 3: 5 C: . %empty 3: 6 D: . d diff --git a/tests/local.at b/tests/local.at index 2e8532d0..ad40a877 100644 --- a/tests/local.at +++ b/tests/local.at @@ -1102,7 +1102,7 @@ m4_define([AT_BISON_CHECK_WARNINGS_], # added after the grammar file name, so skip these checks in that # case. if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then - ]AT_SAVE_SPECIAL_FILES[ + ]AT_SAVE_SPECIAL_FILES[ # To avoid expanding it repeatedly, store specified stdout. ]AT_DATA([expout], [$3])[