From: Ulya Trofimovich Date: Sat, 29 Dec 2018 21:40:08 +0000 (+0000) Subject: run_tests.sh: use paths relative to build directory, not to source directory. X-Git-Tag: 1.2~271 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=136e617008f723c7be16c24a54ad7bb6a99e5e66;p=re2c run_tests.sh: use paths relative to build directory, not to source directory. Otherwise test results aren't reproducible: they depend on the location of build directory relative to source directory. --- diff --git a/re2c/run_tests.sh.in b/re2c/run_tests.sh.in index 981f0666..63c75f64 100644 --- a/re2c/run_tests.sh.in +++ b/re2c/run_tests.sh.in @@ -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" \ diff --git a/re2c/test/include/include001.c b/re2c/test/include/include001.c index c1a634ed..ba21a33a 100644 --- a/re2c/test/include/include001.c +++ b/re2c/test/include/include001.c @@ -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" diff --git a/re2c/test/include/include002.c b/re2c/test/include/include002.c index 224e3d91..6c8da02c 100644 --- a/re2c/test/include/include002.c +++ b/re2c/test/include/include002.c @@ -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" @@ -18,19 +18,19 @@ } 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" diff --git a/re2c/test/include/include003.c b/re2c/test/include/include003.c index 3fdef907..2047598b 100644 --- a/re2c/test/include/include003.c +++ b/re2c/test/include/include003.c @@ -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"