diff options
-rw-r--r-- | testsuite/gna/README | 2 | ||||
-rwxr-xr-x | testsuite/gna/bug0101/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/bug0120/testsuite.sh | 4 | ||||
-rwxr-xr-x | testsuite/gna/bug0122/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/bug063/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue1256/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue1771/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue394/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue450/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue672/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue685/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue719/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/gna/issue880/testsuite.sh | 4 | ||||
-rwxr-xr-x | testsuite/gna/ticket24/testsuite.sh | 4 | ||||
-rwxr-xr-x | testsuite/synth/issue1428/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/synth/sns01/testsuite.sh | 2 | ||||
-rwxr-xr-x | testsuite/synth/snsuns01/testsuite.sh | 2 | ||||
-rw-r--r-- | testsuite/testenv.sh | 64 |
18 files changed, 59 insertions, 45 deletions
diff --git a/testsuite/gna/README b/testsuite/gna/README index d5af291ac..293122f0c 100644 --- a/testsuite/gna/README +++ b/testsuite/gna/README @@ -24,7 +24,7 @@ Here are some tips for portability. they aren't (SIGPIPE doesn't exist) and reports errors. So avoid program that may exit before reading all the input: * instead of 'grep -q xxx', use 'grep xxx > /dev/null' -- reference files use unix end of line. Use 'diff --strip-trailing-cr' to +- reference files use unix end of line. Use 'diff_nocr' (from testenv.sh) to compare expected output with a reference file. - don't forget that executable files have a .exe suffix on windows, but most cygwin tools transparently add the suffix. diff --git a/testsuite/gna/bug0101/testsuite.sh b/testsuite/gna/bug0101/testsuite.sh index 4162baab2..f87eafe05 100755 --- a/testsuite/gna/bug0101/testsuite.sh +++ b/testsuite/gna/bug0101/testsuite.sh @@ -4,7 +4,7 @@ # Expect only one error. analyze_failure repro1.vhdl 2> repro1.err -if ! diff --strip-trailing-cr repro1.err repro1.ref; then +if ! diff_nocr repro1.err repro1.ref; then echo "unexpected output" exit 1; fi diff --git a/testsuite/gna/bug0120/testsuite.sh b/testsuite/gna/bug0120/testsuite.sh index dc4eed9b0..dd3fcfbe4 100755 --- a/testsuite/gna/bug0120/testsuite.sh +++ b/testsuite/gna/bug0120/testsuite.sh @@ -3,9 +3,9 @@ . ../../testenv.sh $GHDL fmt --std=08 --level=space print1.vhdl > print1.out -diff --strip-trailing-cr print1.ref print1.out +diff_nocr print1.ref print1.out $GHDL fmt --std=08 --range=10:10 print1.vhdl > print2.out -diff --strip-trailing-cr print2.ref print2.out +diff_nocr print2.ref print2.out echo "Test successful" diff --git a/testsuite/gna/bug0122/testsuite.sh b/testsuite/gna/bug0122/testsuite.sh index 88f3ba309..daa3869c1 100755 --- a/testsuite/gna/bug0122/testsuite.sh +++ b/testsuite/gna/bug0122/testsuite.sh @@ -3,6 +3,6 @@ . ../../testenv.sh analyze_failure tab1.vhdl 2> tab1.err -diff --strip-trailing-cr tab1.ref tab1.err +diff_nocr tab1.ref tab1.err echo "Test successful" diff --git a/testsuite/gna/bug063/testsuite.sh b/testsuite/gna/bug063/testsuite.sh index e3ffefd9f..2231ff5a0 100755 --- a/testsuite/gna/bug063/testsuite.sh +++ b/testsuite/gna/bug063/testsuite.sh @@ -3,7 +3,7 @@ . ../../testenv.sh analyze_failure dff.vhdl 2> dff.out -diff --strip-trailing-cr dff.out dff.expected +diff_nocr dff.out dff.expected rm -f dff.out clean diff --git a/testsuite/gna/issue1256/testsuite.sh b/testsuite/gna/issue1256/testsuite.sh index c2cff4957..f7453088b 100755 --- a/testsuite/gna/issue1256/testsuite.sh +++ b/testsuite/gna/issue1256/testsuite.sh @@ -12,7 +12,7 @@ if c_compiler_is_available && ghdl_has_feature enum_test vpi; then $GHDL --vpi-link -v gcc -o vpi_plugin.vpi vpi_plugin.o simulate enum_test --vpi=./vpi_plugin.vpi > enum_test.out - diff --strip-trailing-cr enum_test.ref enum_test.out + diff_nocr enum_test.ref enum_test.out rm -f vpi_plugin.vpi vpi_plugin.o fi diff --git a/testsuite/gna/issue1771/testsuite.sh b/testsuite/gna/issue1771/testsuite.sh index 0c37e3b1d..b8cee31e0 100755 --- a/testsuite/gna/issue1771/testsuite.sh +++ b/testsuite/gna/issue1771/testsuite.sh @@ -8,7 +8,7 @@ elab_simulate tf analyze add_carry_ghdl_testbench.vhdl elab_simulate add_carry_ghdl_testbench > add_carry_testbench.out -diff --strip-trailing-cr add_carry_testbench.ref add_carry_testbench.out +diff_nocr add_carry_testbench.ref add_carry_testbench.out clean diff --git a/testsuite/gna/issue394/testsuite.sh b/testsuite/gna/issue394/testsuite.sh index cbdaf11d5..c385e9db5 100755 --- a/testsuite/gna/issue394/testsuite.sh +++ b/testsuite/gna/issue394/testsuite.sh @@ -4,7 +4,7 @@ analyze bug.vhdl elab_simulate bug > out.txt 2> err.txt -diff --strip-trailing-cr -q out.txt out.ref +diff_nocr -q out.txt out.ref rm -f out.txt err.txt clean diff --git a/testsuite/gna/issue450/testsuite.sh b/testsuite/gna/issue450/testsuite.sh index f67324459..590964905 100755 --- a/testsuite/gna/issue450/testsuite.sh +++ b/testsuite/gna/issue450/testsuite.sh @@ -12,7 +12,7 @@ if c_compiler_is_available && ghdl_has_feature disptree vpi; then $GHDL --vpi-link -v gcc -o vpi2.vpi vpi2.o simulate disptree --vpi=./vpi2.vpi | tee disptree.out - diff --strip-trailing-cr -q disptree.ref disptree.out + diff_nocr -q disptree.ref disptree.out rm -f vpi2.o vpi2.vpi disptree.out fi diff --git a/testsuite/gna/issue672/testsuite.sh b/testsuite/gna/issue672/testsuite.sh index fb7eaa96b..59d28b17a 100755 --- a/testsuite/gna/issue672/testsuite.sh +++ b/testsuite/gna/issue672/testsuite.sh @@ -10,7 +10,7 @@ if ! simulate --time-resolution=fs sqrtb --stop-time=1us; then echo "skip --time-resolution tests" else simulate --time-resolution=ns sqrtb --stop-time=1us --disp-time | sed -e 's/.*info/info/' > sqrtb.out - diff --strip-trailing-cr sqrtb.ref sqrtb.out + diff_nocr sqrtb.ref sqrtb.out fi rm -f sqrtb.out diff --git a/testsuite/gna/issue685/testsuite.sh b/testsuite/gna/issue685/testsuite.sh index 80e646d99..bef0fbb98 100755 --- a/testsuite/gna/issue685/testsuite.sh +++ b/testsuite/gna/issue685/testsuite.sh @@ -9,7 +9,7 @@ elab wb_demux_tb if ghdl_has_feature wb_demux_tb ghw; then simulate wb_demux_tb --trace-signals | grep wb_demux_tb | cut -d ' ' -f 1,3- > tb.out - diff --strip-trailing-cr tb.out tb.ref + diff_nocr tb.out tb.ref fi rm -f tb.out diff --git a/testsuite/gna/issue719/testsuite.sh b/testsuite/gna/issue719/testsuite.sh index 992c36968..4408d6a7e 100755 --- a/testsuite/gna/issue719/testsuite.sh +++ b/testsuite/gna/issue719/testsuite.sh @@ -3,7 +3,7 @@ . ../../testenv.sh analyze tb.vhdl 2> tb.out -diff --strip-trailing-cr -q tb.ref tb.out +diff_nocr -q tb.ref tb.out rm -f tb.out clean diff --git a/testsuite/gna/issue880/testsuite.sh b/testsuite/gna/issue880/testsuite.sh index 136317e17..1bef788f2 100755 --- a/testsuite/gna/issue880/testsuite.sh +++ b/testsuite/gna/issue880/testsuite.sh @@ -8,7 +8,7 @@ elab psl if ghdl_has_feature psl psl; then simulate psl --psl-report=psl.out - if ! diff --strip-trailing-cr psl.out psl.ref > /dev/null; then + if ! diff_nocr psl.out psl.ref > /dev/null; then echo "report mismatch" exit 1 fi @@ -24,7 +24,7 @@ elab -fpsl psl if ghdl_has_feature psl psl; then simulate psl --psl-report=psl.out - diff --strip-trailing-cr -q psl.out psl.ref + diff_nocr -q psl.out psl.ref rm -f psl.out fi diff --git a/testsuite/gna/ticket24/testsuite.sh b/testsuite/gna/ticket24/testsuite.sh index 136317e17..1bef788f2 100755 --- a/testsuite/gna/ticket24/testsuite.sh +++ b/testsuite/gna/ticket24/testsuite.sh @@ -8,7 +8,7 @@ elab psl if ghdl_has_feature psl psl; then simulate psl --psl-report=psl.out - if ! diff --strip-trailing-cr psl.out psl.ref > /dev/null; then + if ! diff_nocr psl.out psl.ref > /dev/null; then echo "report mismatch" exit 1 fi @@ -24,7 +24,7 @@ elab -fpsl psl if ghdl_has_feature psl psl; then simulate psl --psl-report=psl.out - diff --strip-trailing-cr -q psl.out psl.ref + diff_nocr -q psl.out psl.ref rm -f psl.out fi diff --git a/testsuite/synth/issue1428/testsuite.sh b/testsuite/synth/issue1428/testsuite.sh index d7d647dd1..9ad80ad25 100755 --- a/testsuite/synth/issue1428/testsuite.sh +++ b/testsuite/synth/issue1428/testsuite.sh @@ -5,7 +5,7 @@ for t in rec1 rec2 rec3 repro1 repro2 repro3 repro4b repro4 repro5b repro5 repro6 do synth --expect-failure $t.vhdl -e 2>&1 | grep $t.vhdl: > $t.out - diff --strip-trailing-cr $t.out $t.ref + diff_nocr $t.out $t.ref done echo "Test successful" diff --git a/testsuite/synth/sns01/testsuite.sh b/testsuite/synth/sns01/testsuite.sh index 4a4ff76cd..20f3372c6 100755 --- a/testsuite/synth/sns01/testsuite.sh +++ b/testsuite/synth/sns01/testsuite.sh @@ -14,7 +14,7 @@ for f in adds subs unaries muls cmplt cmple cmpgt cmpge cmpeq cmpne shrs exts; d analyze tb_$f.vhdl elab_simulate tb_$f > $f.out - diff --strip-trailing-cr $f.out $f.ref + diff_nocr $f.out $f.ref done for t in sns01; do diff --git a/testsuite/synth/snsuns01/testsuite.sh b/testsuite/synth/snsuns01/testsuite.sh index 453469303..7c67c425c 100755 --- a/testsuite/synth/snsuns01/testsuite.sh +++ b/testsuite/synth/snsuns01/testsuite.sh @@ -15,7 +15,7 @@ for s in u s; do analyze tb_$f.vhdl elab_simulate tb_$f > $s$f.out - diff --strip-trailing-cr $s$f.out $s$f.ref + diff_nocr $s$f.out $s$f.ref done clean diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh index aa3735fe1..ffa6851ca 100644 --- a/testsuite/testenv.sh +++ b/testsuite/testenv.sh @@ -107,31 +107,6 @@ elab_simulate_failure () "$GHDL" --elab-run $GHDL_STD_FLAGS $GHDL_FLAGS $@ --expect-failure } -# Call ghwdump -ghw_dump () -{ - if [ x"$GHWDUMP" = x ]; then - case "$GHDL" in - */*) export GHWDUMP=$(dirname $GHDL)/ghwdump;; - *) export GHWDUMP=ghwdump;; - esac - fi - - "$GHWDUMP" -ths "$1".ghw > "$1".txt -} - -# Compare the dump of a GHW wave and a previous golden dump -ghw_diff () -{ - ghw_dump "$1" - if diff --strip-trailing-cr "$1".txt golden_"$1".txt; then - echo "The ghw dump matches." - else - echo "The ghw dump does not match what is expected." - exit 1 - fi -} - synth() { echo "Synthesis of $@" >&2 @@ -243,3 +218,42 @@ clean () esac fi } + + +# Like diff but ignore CR ('\r') end-of-line on windows (as the reference file +# was generated on a UNIX platform). +# The --strip-trailing-cr option is available with GNU diff but not on BSD +# platforms. +diff_nocr () +{ + if [ "$OS" = "Windows_NT" ]; then + diff --strip-trailing-cr $@ + else + diff $@ + fi +} + +# Call ghwdump +ghw_dump () +{ + if [ x"$GHWDUMP" = x ]; then + case "$GHDL" in + */*) export GHWDUMP=$(dirname $GHDL)/ghwdump;; + *) export GHWDUMP=ghwdump;; + esac + fi + + "$GHWDUMP" -ths "$1".ghw > "$1".txt +} + +# Compare the dump of a GHW wave and a previous golden dump +ghw_diff () +{ + ghw_dump "$1" + if diff_nocr "$1".txt golden_"$1".txt; then + echo "The ghw dump matches." + else + echo "The ghw dump does not match what is expected." + exit 1 + fi +} |