mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
tests: prepare LAC tests for more languages
* tests/regression.at: Use %expect to avoid warnings. Set the keywords to facilitate running specific tests. Use macros such as AT_YYLEX_DECLARE to facilitate tests for other languages. Likewise for AT_FULL_COMPILE.
This commit is contained in:
@@ -1302,6 +1302,7 @@ AT_CLEANUP
|
|||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
AT_SETUP([[LAC: Exploratory stack]])
|
AT_SETUP([[LAC: Exploratory stack]])
|
||||||
|
AT_KEYWORDS([lac])
|
||||||
|
|
||||||
m4_pushdef([AT_LAC_CHECK], [
|
m4_pushdef([AT_LAC_CHECK], [
|
||||||
|
|
||||||
@@ -1310,13 +1311,13 @@ AT_BISON_OPTION_PUSHDEFS([%debug $1])
|
|||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[%code {
|
[[%code {
|
||||||
]AT_YYERROR_DECLARE[
|
]AT_YYERROR_DECLARE[
|
||||||
int yylex (]AT_PURE_IF([[YYSTYPE *]], [[void]])[);
|
]AT_YYLEX_DECLARE[
|
||||||
}
|
}
|
||||||
%debug
|
%debug
|
||||||
]$1[
|
]$1[
|
||||||
%define parse.error verbose
|
%define parse.error verbose
|
||||||
%token 'c'
|
%token 'c'
|
||||||
|
%expect 21
|
||||||
%%
|
%%
|
||||||
|
|
||||||
// default reductions in inconsistent states
|
// default reductions in inconsistent states
|
||||||
@@ -1331,23 +1332,16 @@ C: %empty { printf ("consistent default reduction\n"); } ;
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
]AT_YYERROR_DEFINE[
|
]AT_YYERROR_DEFINE[
|
||||||
int
|
]AT_YYLEX_DEFINE(["bbbbc"])[
|
||||||
yylex (]AT_PURE_IF([[YYSTYPE *v]], [[void]])[)
|
|
||||||
{
|
|
||||||
static char const *input = "bbbbc";]AT_PURE_IF([[
|
|
||||||
*v = 0;]])[
|
|
||||||
return *input++;
|
|
||||||
}
|
|
||||||
|
|
||||||
]AT_MAIN_DEFINE[
|
]AT_MAIN_DEFINE[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
|
AT_FULL_COMPILE([[input]], [], [], [],
|
||||||
-Dparse.lac.memory-trace=full \
|
[[-Dparse.lac=full]AT_C_IF([ \
|
||||||
-o input.c input.y]], [[0]], [],
|
-Dparse.lac.es-capacity-initial=1 \
|
||||||
[[input.y: warning: 21 shift/reduce conflicts [-Wconflicts-sr]
|
-Dparse.lac.memory-trace=full])])
|
||||||
]])
|
|
||||||
AT_COMPILE([[input]])
|
|
||||||
AT_PARSER_CHECK([[input --debug > stdout.txt 2> stderr.txt]], [[1]])
|
AT_PARSER_CHECK([[input --debug > stdout.txt 2> stderr.txt]], [[1]])
|
||||||
|
|
||||||
# Make sure syntax error doesn't forget that 'a' is expected. It would
|
# Make sure syntax error doesn't forget that 'a' is expected. It would
|
||||||
@@ -1366,10 +1360,12 @@ AT_CHECK([[$PERL -0777 -ne 'print s/inconsistent default reduction//g;' \
|
|||||||
AT_CHECK([[$PERL -0777 -ne 'print s/\bconsistent default reduction//g;' \
|
AT_CHECK([[$PERL -0777 -ne 'print s/\bconsistent default reduction//g;' \
|
||||||
< stdout.txt || exit 77]], [[0]], [[2]])
|
< stdout.txt || exit 77]], [[0]], [[2]])
|
||||||
|
|
||||||
# Check number of reallocs to be sure reallocated memory isn't somehow
|
]AT_C_IF([[
|
||||||
# lost between LAC invocations.
|
# Check number of reallocs to be sure reallocated memory isn't somehow
|
||||||
AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
|
# lost between LAC invocations.
|
||||||
|| exit 77]], [[0]], [[3]])
|
AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
|
||||||
|
|| exit 77]], [[0]], [[3]])
|
||||||
|
]])[
|
||||||
|
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
])
|
])
|
||||||
@@ -1390,6 +1386,7 @@ AT_CLEANUP
|
|||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
AT_SETUP([[LAC: Memory exhaustion]])
|
AT_SETUP([[LAC: Memory exhaustion]])
|
||||||
|
AT_KEYWORDS([lac])
|
||||||
|
|
||||||
m4_pushdef([AT_LAC_CHECK],
|
m4_pushdef([AT_LAC_CHECK],
|
||||||
[AT_BISON_OPTION_PUSHDEFS([%debug])
|
[AT_BISON_OPTION_PUSHDEFS([%debug])
|
||||||
@@ -1401,7 +1398,7 @@ AT_DATA_GRAMMAR([input.y],
|
|||||||
}
|
}
|
||||||
%debug
|
%debug
|
||||||
%define parse.error verbose
|
%define parse.error verbose
|
||||||
|
%expect 8
|
||||||
%%
|
%%
|
||||||
|
|
||||||
S: A A A A A A A A A ;
|
S: A A A A A A A A A ;
|
||||||
@@ -1413,10 +1410,8 @@ A: %empty | 'a' ;
|
|||||||
]AT_MAIN_DEFINE[
|
]AT_MAIN_DEFINE[
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
|
AT_FULL_COMPILE([input], [], [], [],
|
||||||
-o input.c input.y]], [[0]], [],
|
[[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1]])
|
||||||
[[input.y: warning: 8 shift/reduce conflicts [-Wconflicts-sr]
|
|
||||||
]])
|
|
||||||
AT_COMPILE([[input]])
|
AT_COMPILE([[input]])
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user