[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] tests: factor the execution of Java parsers
From: |
Akim Demaille |
Subject: |
[PATCH 8/8] tests: factor the execution of Java parsers |
Date: |
Thu, 21 Feb 2019 07:09:46 +0100 |
* tests/local.at (AT_MAIN_DEFINE(java)): Exit failure on failure.
(AT_PARSER_CHECK): If in Java, run AT_JAVA_PARSER_CHECK.
* tests/conflicts.at (AT_CONSISTENT_ERRORS_CHECK): Simplify.
---
tests/conflicts.at | 8 ++------
tests/local.at | 21 ++++++++++++++++-----
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/tests/conflicts.at b/tests/conflicts.at
index 10aa0758..430a8271 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -461,14 +461,10 @@ m4_pushdef([AT_EXPECTING], [m4_if($5, [ab], [[, expecting
'a' or 'b']],
$5, [a], [[, expecting 'a']],
$5, [b], [[, expecting 'b']])])
-AT_JAVA_IF([AT_JAVA_PARSER_CHECK([[input]], [[0]],
+AT_PARSER_CHECK([[input]], [[1]],
[[]],
[[syntax error, unexpected ]$4[]AT_EXPECTING[
-]])],
- [AT_PARSER_CHECK([[input]], [[1]],
-[[]],
-[[syntax error, unexpected ]$4[]AT_EXPECTING[
-]])])
+]])
m4_popdef([AT_EXPECTING])
AT_BISON_OPTION_POPDEFS
diff --git a/tests/local.at b/tests/local.at
index cbe8061a..a42e798f 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -727,7 +727,7 @@ m4_define([AT_MAIN_DEFINE(java)],
public static void main (String args[]) throws IOException
{
YYParser p = new YYParser ();
- p.parse ();
+ System.exit (p.parse () ? 0 : 1);
}
}]])
@@ -1020,7 +1020,7 @@ AT_COMPILE([c-only.o], [c-only.c])
AT_COMPILE_CXX([cxx-only.o], [cxx-only.cc])
AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS c-only.o cxx-only.o -o c-and-cxx ||
exit 77], [0], [ignore], [ignore])
-AT_PARSER_CHECK([c-and-cxx])
+AT_C_PARSER_CHECK([c-and-cxx])
])
@@ -1104,13 +1104,13 @@ AT_CHECK([@&address@hidden/exception || exit 77], [0],
[], [ignore])
## ---------------------------- ##
-# AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE])
-# ------------------------------------------------------------
+# AT_C_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE])
+# --------------------------------------------------------------
# So that we can run './testsuite PREPARSER='valgrind -q' for instance.
#
# Get rid of spurious messages when compiled with --coverage:
# +profiling:/[...]/lib/fprintf.gcda:Merge mismatch for summaries
-m4_define([AT_PARSER_CHECK],
+m4_define([AT_C_PARSER_CHECK],
[AT_CHECK([$5 $PREPARSER ./$1], [$2], [$3], [stderr])
AT_CHECK([sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr],
[0], [], [$4])
@@ -1123,6 +1123,17 @@ m4_define([AT_JAVA_PARSER_CHECK],
[AT_CHECK([$5[ $SHELL ../../../javaexec.sh ]$1], [$2], [$3], [$4])])
+# AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE])
+# ------------------------------------------------------------
+# If we know we are in Java (via AT_BISON_OPTION_PUSHDEFS/POPDEFS),
+# run AT_JAVA_PARSER_CHECK, otherwise AT_C_PARSER_CHECK.
+m4_define([AT_PARSER_CHECK],
+[m4_ifdef([AT_JAVA_IF],
+ [AT_JAVA_IF([AT_JAVA_PARSER_CHECK($@)],
+ [AT_C_PARSER_CHECK($@)])],
+ [AT_C_PARSER_CHECK($@)])])
+
+
# AT_TEST_TABLES_AND_PARSE(TITLE, COND-VALUE, TEST-SPEC,
# DECLS, GRAMMAR, INPUT,
# BISON-STDERR, TABLES-OR-LAST-STATE,
--
2.20.1
- [PATCH 0/8] Clean up the tests, Akim Demaille, 2019/02/21
- [PATCH 1/8] tests: formatting changes, Akim Demaille, 2019/02/21
- [PATCH 5/8] tests: java: factor the definition of Position, Akim Demaille, 2019/02/21
- [PATCH 2/8] tests: de-duplicate, Akim Demaille, 2019/02/21
- [PATCH 8/8] tests: factor the execution of Java parsers,
Akim Demaille <=
- [PATCH 3/8] tests: dispatch per lang on the definition of yylex, Akim Demaille, 2019/02/21
- [PATCH 7/8] tests: fix a Java tests, Akim Demaille, 2019/02/21
- [PATCH 6/8] tests: simplify AT_PARSER_CHECK usage, Akim Demaille, 2019/02/21
- [PATCH 4/8] tests: dispatch per lang on AT_DATA_GRAMMAR, Akim Demaille, 2019/02/21