summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2017-01-03 20:44:59 +0800
committerWill Estes <westes575@gmail.com>2017-01-25 10:33:06 -0500
commit3c0ccc45203b19335e6523ec37c82369eff77dda (patch)
treed85a1659c56508b1a8ecd79df327edfa35a86f33
parent546851ba357d956b05b14cfd5ec89dcad4a1576a (diff)
test: Skip bison tests if bison is not available
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/no_bison_stub.c39
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ea170ae..6b37705 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -129,12 +129,18 @@ array_nr_SOURCES = array_nr.l
array_r_SOURCES = array_r.l
basic_nr_SOURCES = basic_nr.l
basic_r_SOURCES = basic_r.l
+if HAVE_BISON
bison_nr_SOURCES = bison_nr_scanner.l bison_nr_parser.y bison_nr_main.c
nodist_bison_nr_SOURCES = bison_nr_parser.h bison_nr_scanner.h
bison_yylloc_SOURCES = bison_yylloc_scanner.l bison_yylloc_parser.y bison_yylloc_main.c
nodist_bison_yylloc_SOURCES = bison_yylloc_parser.h bison_yylloc_scanner.h
bison_yylval_SOURCES = bison_yylval_scanner.l bison_yylval_parser.y bison_yylval_main.c
nodist_bison_yylval_SOURCES = bison_yylval_parser.h bison_yylval_scanner.h
+else
+bison_nr_SOURCES = no_bison_stub.c
+bison_yylloc_SOURCES = no_bison_stub.c
+bison_yylval_SOURCES = no_bison_stub.c
+endif
c_cxx_nr_SOURCES = c_cxx_nr.lll
c_cxx_r_SOURCES = c_cxx_r.lll
ccl_SOURCES = ccl.l
diff --git a/tests/no_bison_stub.c b/tests/no_bison_stub.c
new file mode 100644
index 0000000..5fb3a9d
--- /dev/null
+++ b/tests/no_bison_stub.c
@@ -0,0 +1,39 @@
+/* This stub will be used when Bison is not available on the user's host. */
+
+/* This file is part of flex.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+#include <stdio.h>
+
+int main (int argc, char *argv[])
+{
+ (void)argc;
+ (void)argv;
+ puts(
+ "This test requires Bison. Install Bison and re-run \"configure && make check\"\n"
+ "to perform this test. (This file is stub code.)"
+ );
+
+ /* Exit status for a skipped test */
+ return 77;
+}
+
+/* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */