From: Ulya Trofimovich Date: Mon, 10 Aug 2015 12:16:56 +0000 (+0100) Subject: run_tests.sh: separate stdout and stderr, diff with -b on wine. X-Git-Tag: 0.15~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c61a7dd5234b9c6980c0af11d149f12b46e6c159;p=re2c run_tests.sh: separate stdout and stderr, diff with -b on wine. Found some errors while testing mingw-built re2c.exe on wine: 1. redirecting stderr to stdout resulted resulted in random mix in tests that triggered re2c warnings 2. removing all '\r' symbols in the generated files didn't work anymore since some tests that contain '\r' were added Fixed: 1. redirect both to different files and cat manually 2. diff with -b flag on wine --- diff --git a/re2c/run_tests.sh.in b/re2c/run_tests.sh.in index b33b0262..8583f25c 100644 --- a/re2c/run_tests.sh.in +++ b/re2c/run_tests.sh.in @@ -80,6 +80,13 @@ then echo $valgrind fi +diff_prog="diff" +if test -n "${wine}" +then + # ignore whitespace at the end of line + diff_prog="${diff_prog} -b" +fi + run_pack() { local log="$1" shift 1 @@ -101,11 +108,14 @@ run_pack() { local switches="$switches -W" local cmd="${valgrind} ${wine} ${re2c} $switches $x" - if test -n "${wine}" - then - local filter_newlines='-e s/\r//g' - fi - $cmd 2>&1 | LC_ALL=C sed -e "s,$x,`basename $x`,g" -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' ${filter_newlines} > $outname + local outname_stdout="${outname}.stdout" + local outname_stderr="${outname}.stderr" + $cmd 2>$outname_stderr >$outname_stdout + cat $outname_stderr > $outname && rm $outname_stderr + cat $outname_stdout >> $outname && rm $outname_stdout + LC_ALL=C sed -i $outname \ + -e "s,$x,`basename $x`,g" \ + -e 's,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g' if test -n "$genname" then cat $genname | sed \ @@ -122,7 +132,7 @@ run_pack() { local errcnt=$(($errcnt + 1)) cp -f $x $test_blddir else - local r=`diff ${x%.re}.c $outname > $outdiff; echo $?` + local r=`$diff_prog ${x%.re}.c $outname > $outdiff; echo $?` if [[ $r == 0 ]] then echo "OK $x: $switches" @@ -143,7 +153,7 @@ run_pack() { echo "FAIL missing ${x%.re}.h" local errcnt=$(($errcnt + 1)) cp -f $x $test_blddir - elif diff ${x%.re}.h $typname > $typdiff + elif $diff_prog ${x%.re}.h $typname > $typdiff then echo "OK $x: $switches" rm $typname