LANG=C LC_ALL=C "$@"
}
-abspath() {
- case "$1" in
- /*) echo "$1";;
- *) echo "$PWD/$1";;
- esac
-}
-
valgrind=""
skeleton=0
keep_tmp_files=0
rm -rf $test_blddir && mkdir $test_blddir
# preserve directory structure unless given explicit args
+testdirs=
if [ ${#tests[@]} -eq 0 ]; then
- cp -R "@top_srcdir@/test"/* "@top_srcdir@/examples"/* $test_blddir
- incpaths=`find "@top_srcdir@/test" "@top_srcdir@/examples" -type d -exec echo "-I $(abspath {})" \;`
+ for d in "@top_srcdir@/test" "@top_srcdir@/examples" ; do
+ testdirs="$testdirs $(find $d -type d)"
+ cp -R $d/* $test_blddir
+ done
else
- incpaths=
for f in ${tests[@]}; do
cp $f ${f%.re}.c $test_blddir
- incpaths="$incpaths -I $(abspath $(dirname $f))"
+ testdirs="$testdirs $(dirname $f)"
done
fi
chmod -R u+w $test_blddir
# file extensions are case-insensitive on some platforms
printf "%s" "$switches" | lc_run grep -q "[A-Z]" \
&& { echo "bad file extension: '$outx' (uppercase letters are not allowed)"; exit 1; }
- local switches="$switches $incpaths -o $outc --no-version --no-generation-date"
+ local switches="$switches -o $outc --no-version --no-generation-date"
# enable warnings globally
local switches="$switches -W"
then
rm -f "$outc"
+ incpaths=; for d in $testdirs; do incpaths="$incpaths -I ../$d"; done
+
local switches="$switches --skeleton -Werror-undefined-control-flow"
- ${valgrind} ${wine} ../${re2c} $switches "../$x" 2>"$outc.stderr"
+ ${valgrind} ${wine} ../${re2c} $incpaths $switches "../$x" 2>"$outc.stderr"
local status=$(echo $?)
[ $status -eq 0 ] && { @CC@ -Wall -Wextra -o "$outc.out" "$outc" 2>>"$outc.stderr" || status=2; }
[ $status -eq 0 ] && { ./"$outc.out" 2>>"$outc.stderr" || status=3; }
local c="${outx%.re}.c.orig"
mv "$outc" "$c"
+ incpaths=; for d in $testdirs; do incpaths="$incpaths -I ../../$d"; done
+
# create sandbox
tmpdir="tmp_$log" \
&& mkdir "$tmpdir" \
&& mkdir -p `dirname "$outx"` \
&& cp "../../$x" "$outx"
# run re2c
- $valgrind $wine ../../$re2c $switches "$outx" 2>"$outc.stderr" 1>&2
+ $valgrind $wine ../../$re2c $incpaths $switches "$outx" 2>"$outc.stderr" 1>&2
# on windows output contains CR LF, cut CR to match test results
for f in "$outc" "$outc.stderr"; do
[ -f "$f" ] \
/* Generated by re2c */
-#line 1 "include/include001a.re"
-#line 3 "include001c.re"
+#line 1 "include/include001.re"
+#line 3 "../../../test/include/include001.re.c.inc"
-#line 5 "include001b.re"
+#line 5 "../../../test/include/include001.re.b.inc"
-#line 13 "include/include001a.c"
+#line 13 "include/include001.c"
{
YYCTYPE yych;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yy2:
yy3:
++YYCURSOR;
-#line 4 "include/include001a.re"
+#line 4 "include/include001.re"
{}
-#line 28 "include/include001a.c"
+#line 28 "include/include001.c"
yy5:
++YYCURSOR;
-#line 5 "include/include001a.re"
+#line 5 "include/include001.re"
{}
-#line 33 "include/include001a.c"
+#line 33 "include/include001.c"
}
-#line 6 "include/include001a.re"
+#line 6 "include/include001.re"
re2c: warning: line 6: control flow is undefined for strings that match '[\x0-\x61\x64-\xFF]', use default rule '*' [-Wundefined-control-flow]
--- /dev/null
+/*!include:re2c "include001.re.b.inc" */
+
+/*!re2c
+ b {}
+ c {}
+*/
--- /dev/null
+/*!include:re2c "include001.re.c.inc" */
+
+/*!re2c
+ b = "b";
+*/
+++ /dev/null
-/*!include:re2c "include001b.re" */
-
-/*!re2c
- b {}
- c {}
-*/
+++ /dev/null
-/* Generated by re2c */
-#line 1 "include/include001b.re"
-#line 3 "include001c.re"
-
-
-
-#line 5 "include/include001b.re"
-
+++ /dev/null
-/*!include:re2c "include001c.re" */
-
-/*!re2c
- b = "b";
-*/
+++ /dev/null
-/* Generated by re2c */
-#line 1 "include/include001c.re"
-#line 3 "include/include001c.re"
-
--- /dev/null
+/* Generated by re2c */
+#line 1 "include/include002.re"
+
+#line 3 "../../../test/include/nested/nested/include002.re.bd.inc"
+
+
+
+
+#line 10 "include/include002.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'B':
+ case 'd': goto yy4;
+ default: goto yy2;
+ }
+yy2:
+ ++YYCURSOR;
+#line 7 "../../../test/include/nested/include002.re.b.inc"
+ {}
+#line 24 "include/include002.c"
+yy4:
+ ++YYCURSOR;
+#line 6 "../../../test/include/nested/include002.re.b.inc"
+ {}
+#line 29 "include/include002.c"
+}
+#line 8 "../../../test/include/nested/include002.re.b.inc"
+
+
+#line 3 "../../../test/include/nested/nested/include002.re.be.inc"
+
+
+
+
+#line 39 "include/include002.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'B':
+ case 'e': goto yy10;
+ default: goto yy8;
+ }
+yy8:
+ ++YYCURSOR;
+#line 15 "../../../test/include/nested/include002.re.b.inc"
+ {}
+#line 53 "include/include002.c"
+yy10:
+ ++YYCURSOR;
+#line 14 "../../../test/include/nested/include002.re.b.inc"
+ {}
+#line 58 "include/include002.c"
+}
+#line 16 "../../../test/include/nested/include002.re.b.inc"
+
+
+
+
+#line 65 "include/include002.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '1':
+ case 'b': goto yy16;
+ case '2': goto yy18;
+ default: goto yy14;
+ }
+yy14:
+ ++YYCURSOR;
+#line 6 "include/include002.re"
+ {}
+#line 80 "include/include002.c"
+yy16:
+ ++YYCURSOR;
+#line 4 "include/include002.re"
+ {}
+#line 85 "include/include002.c"
+yy18:
+ ++YYCURSOR;
+#line 5 "include/include002.re"
+ {}
+#line 90 "include/include002.c"
+}
+#line 7 "include/include002.re"
+
+
+
+
+#line 3 "../../../test/include/nested/nested/include002.re.cd.inc"
+
+
+
+
+#line 102 "include/include002.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'C':
+ case 'd': goto yy24;
+ default: goto yy22;
+ }
+yy22:
+ ++YYCURSOR;
+#line 8 "../../../test/include/nested/include002.re.c.inc"
+ {}
+#line 116 "include/include002.c"
+yy24:
+ ++YYCURSOR;
+#line 7 "../../../test/include/nested/include002.re.c.inc"
+ {}
+#line 121 "include/include002.c"
+}
+#line 9 "../../../test/include/nested/include002.re.c.inc"
+
+
+#line 3 "../../../test/include/nested/nested/include002.re.ce.inc"
+
+
+
+
+#line 131 "include/include002.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'C':
+ case 'e': goto yy30;
+ default: goto yy28;
+ }
+yy28:
+ ++YYCURSOR;
+#line 16 "../../../test/include/nested/include002.re.c.inc"
+ {}
+#line 145 "include/include002.c"
+yy30:
+ ++YYCURSOR;
+#line 15 "../../../test/include/nested/include002.re.c.inc"
+ {}
+#line 150 "include/include002.c"
+}
+#line 17 "../../../test/include/nested/include002.re.c.inc"
+
+
+
+
+#line 157 "include/include002.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '1':
+ case 'c': goto yy36;
+ case '2': goto yy38;
+ default: goto yy34;
+ }
+yy34:
+ ++YYCURSOR;
+#line 14 "include/include002.re"
+ {}
+#line 172 "include/include002.c"
+yy36:
+ ++YYCURSOR;
+#line 12 "include/include002.re"
+ {}
+#line 177 "include/include002.c"
+yy38:
+ ++YYCURSOR;
+#line 13 "include/include002.re"
+ {}
+#line 182 "include/include002.c"
+}
+#line 15 "include/include002.re"
+
--- /dev/null
+/*!include:re2c "nested/include002.re.b.inc" */
+
+/*!re2c
+ b1 {}
+ b2 {}
+ * {}
+*/
+
+/*!include:re2c "nested/include002.re.c.inc" */
+
+/*!re2c
+ c1 {}
+ c2 {}
+ * {}
+*/
--- /dev/null
+/* Generated by re2c */
+#line 1 "include/include003.re"
+#line 3 "../../../test/include/include003.re.b.inc"
+
+
+#line 3 "../../../test/include/include003.re.c.inc"
+
+
+
+
+#line 12 "include/include003.c"
+{
+ YYCTYPE yych;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'b': goto yy4;
+ case 'c': goto yy6;
+ default: goto yy2;
+ }
+yy2:
+ ++YYCURSOR;
+#line 7 "include/include003.re"
+ {}
+#line 26 "include/include003.c"
+yy4:
+ ++YYCURSOR;
+#line 5 "include/include003.re"
+ {}
+#line 31 "include/include003.c"
+yy6:
+ ++YYCURSOR;
+#line 6 "include/include003.re"
+ {}
+#line 36 "include/include003.c"
+}
+#line 8 "include/include003.re"
+
--- /dev/null
+/*!include:re2c "include003.re.b.inc" */
+/*!include:re2c "include003.re.c.inc" */
+
+/*!re2c
+ b {}
+ c {}
+ * {}
+*/
--- /dev/null
+/*!re2c
+ b = "b";
+*/
--- /dev/null
+/*!re2c
+ c = "c";
+*/
--- /dev/null
+
+/*!include:re2c "nested/include002.re.bd.inc" */
+
+/*!re2c
+ b1 = [b1];
+ bd {}
+ * {}
+*/
+
+/*!include:re2c "nested/include002.re.be.inc" */
+
+/*!re2c
+ b2 = [b2];
+ be {}
+ * {}
+*/
--- /dev/null
+
+
+/*!include:re2c "nested/include002.re.cd.inc" */
+
+/*!re2c
+ c1 = [c1];
+ cd {}
+ * {}
+*/
+
+/*!include:re2c "nested/include002.re.ce.inc" */
+
+/*!re2c
+ c2 = [c2];
+ ce {}
+ * {}
+*/
--- /dev/null
+/*!re2c
+ bd = [Bd];
+*/
--- /dev/null
+/*!re2c
+ be = [Be];
+*/
--- /dev/null
+/*!re2c
+ cd = [Cd];
+*/
--- /dev/null
+/*!re2c
+ ce = [Ce];
+*/