]> granicus.if.org Git - re2c/commitdiff
run_tests.sh: use paths relative to build directory, not to source directory.
authorUlya Trofimovich <skvadrik@gmail.com>
Sat, 29 Dec 2018 21:40:08 +0000 (21:40 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Sat, 29 Dec 2018 21:40:08 +0000 (21:40 +0000)
Otherwise test results aren't reproducible: they depend on the
location of build directory relative to source directory.

re2c/run_tests.sh.in
re2c/test/include/include001.c
re2c/test/include/include002.c
re2c/test/include/include003.c

index 981f06669f7f8e28a4f5ffc660b60eb5557bc70a..63c75f64ab6201c60b3c3f23950efbe3d5d3781c 100644 (file)
@@ -58,22 +58,26 @@ test_blddir="test_"`date +%y%m%d%H%M%S`
 rm -rf $test_blddir && mkdir $test_blddir
 
 # preserve directory structure unless given explicit args
-testdirs=
 if [ ${#tests[@]} -eq 0 ]; then
-    for d in "@top_srcdir@/test" "@top_srcdir@/examples" ; do
-        testdirs="$testdirs $(find $d -type d)"
-        cp -R $d/* $test_blddir
-    done
+    cp -R "@top_srcdir@/test/"* "@top_srcdir@/examples/"*  $test_blddir
 else
     for f in ${tests[@]}; do
         cp $f ${f%.re}.c $test_blddir
-        testdirs="$testdirs $(dirname $f)"
     done
 fi
 chmod -R u+w $test_blddir
-find $test_blddir -type f ! -name '*.re' -a ! -name '*.c' -exec rm {} \;
+find $test_blddir -type f \
+    ! -name '*.re' -a \
+    ! -name '*.c' -a \
+    ! -name '*.inc' \
+    -exec rm {} \;
 tests=(`find $test_blddir -name '*.re' | sort`)
 
+# set include paths
+cd $test_blddir \
+    && incpaths=$(find * -type d -exec echo "-I ../{}" \;) \
+    && cd ..
+
 tests_per_thread=$((${#tests[@]} / threads + 1))
 packs=()
 for ((i = 0; i < threads; i++))
@@ -144,8 +148,6 @@ run_pack() {
                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} $incpaths $switches "../$x" 2>"$outc.stderr"
@@ -171,8 +173,6 @@ run_pack() {
                        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" \
index c1a634eddbd603f06c2eeda5795ab6590da77671..ba21a33a0bc3ad7e7ebee7b817034bde4f4d36d0 100644 (file)
@@ -1,10 +1,10 @@
 /* Generated by re2c */
 #line 1 "include/include001.re"
-#line 3 "../../../test/include/include001.re.c.inc"
+#line 3 "../include/include001.re.c.inc"
 
 
 
-#line 5 "../../../test/include/include001.re.b.inc"
+#line 5 "../include/include001.re.b.inc"
 
 
 
index 224e3d91c0be41a40d0f4800ac0c84c9d891deb5..6c8da02cea27079b2b1d5d91b399f7b3a5195e0e 100644 (file)
@@ -1,7 +1,7 @@
 /* Generated by re2c */
 #line 1 "include/include002.re"
 
-#line 3 "../../../test/include/nested/nested/include002.re.bd.inc"
+#line 3 "../include/nested/nested/include002.re.bd.inc"
 
 
 
        }
 yy2:
        ++YYCURSOR;
-#line 7 "../../../test/include/nested/include002.re.b.inc"
+#line 7 "../include/nested/include002.re.b.inc"
        {}
 #line 24 "include/include002.c"
 yy4:
        ++YYCURSOR;
-#line 6 "../../../test/include/nested/include002.re.b.inc"
+#line 6 "../include/nested/include002.re.b.inc"
        {}
 #line 29 "include/include002.c"
 }
-#line 8 "../../../test/include/nested/include002.re.b.inc"
+#line 8 "../include/nested/include002.re.b.inc"
 
 
-#line 3 "../../../test/include/nested/nested/include002.re.be.inc"
+#line 3 "../include/nested/nested/include002.re.be.inc"
 
 
 
@@ -47,16 +47,16 @@ yy4:
        }
 yy8:
        ++YYCURSOR;
-#line 15 "../../../test/include/nested/include002.re.b.inc"
+#line 15 "../include/nested/include002.re.b.inc"
        {}
 #line 53 "include/include002.c"
 yy10:
        ++YYCURSOR;
-#line 14 "../../../test/include/nested/include002.re.b.inc"
+#line 14 "../include/nested/include002.re.b.inc"
        {}
 #line 58 "include/include002.c"
 }
-#line 16 "../../../test/include/nested/include002.re.b.inc"
+#line 16 "../include/nested/include002.re.b.inc"
 
 
 
@@ -93,7 +93,7 @@ yy18:
 
 
 
-#line 3 "../../../test/include/nested/nested/include002.re.cd.inc"
+#line 3 "../include/nested/nested/include002.re.cd.inc"
 
 
 
@@ -110,19 +110,19 @@ yy18:
        }
 yy22:
        ++YYCURSOR;
-#line 8 "../../../test/include/nested/include002.re.c.inc"
+#line 8 "../include/nested/include002.re.c.inc"
        {}
 #line 116 "include/include002.c"
 yy24:
        ++YYCURSOR;
-#line 7 "../../../test/include/nested/include002.re.c.inc"
+#line 7 "../include/nested/include002.re.c.inc"
        {}
 #line 121 "include/include002.c"
 }
-#line 9 "../../../test/include/nested/include002.re.c.inc"
+#line 9 "../include/nested/include002.re.c.inc"
 
 
-#line 3 "../../../test/include/nested/nested/include002.re.ce.inc"
+#line 3 "../include/nested/nested/include002.re.ce.inc"
 
 
 
@@ -139,16 +139,16 @@ yy24:
        }
 yy28:
        ++YYCURSOR;
-#line 16 "../../../test/include/nested/include002.re.c.inc"
+#line 16 "../include/nested/include002.re.c.inc"
        {}
 #line 145 "include/include002.c"
 yy30:
        ++YYCURSOR;
-#line 15 "../../../test/include/nested/include002.re.c.inc"
+#line 15 "../include/nested/include002.re.c.inc"
        {}
 #line 150 "include/include002.c"
 }
-#line 17 "../../../test/include/nested/include002.re.c.inc"
+#line 17 "../include/nested/include002.re.c.inc"
 
 
 
index 3fdef907bba2f091250687c258a1f1803975d891..2047598be4bc46e269b9bf0080c802991d3f64c2 100644 (file)
@@ -1,9 +1,9 @@
 /* Generated by re2c */
 #line 1 "include/include003.re"
-#line 3 "../../../test/include/include003.re.b.inc"
+#line 3 "../include/include003.re.b.inc"
 
 
-#line 3 "../../../test/include/include003.re.c.inc"
+#line 3 "../include/include003.re.c.inc"