cex: tests: be robust to variations in time limit reports

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.
This commit is contained in:
Akim Demaille
2020-05-17 09:57:12 +02:00
parent 482b370540
commit e0cb91a922
2 changed files with 25 additions and 16 deletions

View File

@@ -17,6 +17,15 @@
AT_BANNER([[Counterexamples.]]) 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. ## ## Simple Unifying S/R. ##
## --------------------- ## ## --------------------- ##
@@ -34,7 +43,7 @@ x: B | B C;
y: A | A B; y: A | A B;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
1: 3 a: A . 1: 3 a: A .
1: 8 y: A . B 1: 8 y: A . B
@@ -66,7 +75,7 @@ a: A | A a;
bc: B bc C | B C; bc: B bc C | B C;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
1: 7 a: A . 1: 7 a: A .
1: 5 b: . B 1: 5 b: . B
@@ -99,7 +108,7 @@ y: %empty | Y y;
xby: B | X xby Y; xby: B | X xby Y;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
1: 4 x: . %empty 1: 4 x: . %empty
1: 9 xby: . B 1: 9 xby: . B
@@ -141,7 +150,7 @@ cd: C D;
bc: B C; bc: B C;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
2: 7 b: B . 2: 7 b: B .
2: 9 bc: B . C 2: 9 bc: B . C
@@ -173,7 +182,7 @@ x: A;
y: A A B; y: A A B;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
1: 5 x: A . 1: 5 x: A .
1: 6 y: A . A B 1: 6 y: A . A B
@@ -209,7 +218,7 @@ xy: X Y;
y: Y; y: Y;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
4: 3 r: b . 4: 3 r: b .
4: 7 s: b . A xx y 4: 7 s: b . A xx y
@@ -248,7 +257,7 @@ a : A b ;
b : A | b; b : A | b;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Reduce-Reduce Conflict: [[Reduce-Reduce Conflict:
4: 1 a: A b . 4: 1 a: A b .
4: 3 b: b . 4: 3 b: b .
@@ -278,7 +287,7 @@ a: D;
b: D; b: D;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Reduce-Reduce Conflict: [[Reduce-Reduce Conflict:
2: 5 a: D . 2: 5 a: D .
2: 6 b: D . 2: 6 b: D .
@@ -309,7 +318,7 @@ a: H i;
i: X | i J K; i: X | i J K;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
5: 2 a: H i . 5: 2 a: H i .
5: 4 i: i . J K 5: 4 i: i . J K
@@ -345,7 +354,7 @@ a: A;
b: A B C | A B D; b: A B C | A B D;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
4: 7 a: A . 4: 7 a: A .
4: 8 b: A . B C 4: 8 b: A . B C
@@ -380,7 +389,7 @@ B : A b A;
C : A c A; C : A c A;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Reduce-Reduce Conflict: [[Reduce-Reduce Conflict:
3: 3 A: B . 3: 3 A: B .
3: 5 A: . %empty 3: 5 A: . %empty
@@ -418,7 +427,7 @@ c : ;
d : a | c A | d; d : a | c A | d;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Reduce-Reduce Conflict: [[Reduce-Reduce Conflict:
0: 3 b: . %empty 0: 3 b: . %empty
0: 4 c: . %empty 0: 4 c: . %empty
@@ -518,7 +527,7 @@ a: H i J J
i: %empty | i J; i: %empty | i J;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
7: 5 i: i J . 7: 5 i: i J .
7: 3 a: H i J . J 7: 3 a: H i J . J
@@ -553,7 +562,7 @@ C: %empty
D: d; D: d;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
3: 5 C: . %empty 3: 5 C: . %empty
3: 6 D: . d 3: 6 D: . d
@@ -586,7 +595,7 @@ C: %empty
D: d; D: d;
]]) ]])
AT_BISON_CHECK([-Wcounterexample input.y], [], [], AT_BISON_CHECK_CEX([input.y], [], [],
[[Shift-Reduce Conflict: [[Shift-Reduce Conflict:
3: 5 C: . %empty 3: 5 C: . %empty
3: 6 D: . d 3: 6 D: . d

View File

@@ -1102,7 +1102,7 @@ m4_define([AT_BISON_CHECK_WARNINGS_],
# added after the grammar file name, so skip these checks in that # added after the grammar file name, so skip these checks in that
# case. # case.
if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
]AT_SAVE_SPECIAL_FILES[ ]AT_SAVE_SPECIAL_FILES[
# To avoid expanding it repeatedly, store specified stdout. # To avoid expanding it repeatedly, store specified stdout.
]AT_DATA([expout], [$3])[ ]AT_DATA([expout], [$3])[