aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorumarcor <unai.martinezcorral@ehu.eus>2021-04-23 03:09:39 +0200
committertgingold <tgingold@users.noreply.github.com>2021-04-23 05:34:09 +0200
commite8a44b3c366027f0199d1a6fde0b761a7b2b03c5 (patch)
treea63f1501d88e1ba8ccda02bc50ec787211db8a0b
parenta73daf35f1ba5b5eeaddb05947ce9088c78ea6d2 (diff)
downloadghdl-e8a44b3c366027f0199d1a6fde0b761a7b2b03c5.tar.gz
ghdl-e8a44b3c366027f0199d1a6fde0b761a7b2b03c5.tar.bz2
ghdl-e8a44b3c366027f0199d1a6fde0b761a7b2b03c5.zip
testsuite: add function 'ghw_diff' to testenv
-rw-r--r--testsuite/gna/README3
-rwxr-xr-xtestsuite/gna/issue1323/testsuite.sh20
-rw-r--r--testsuite/testenv.sh12
3 files changed, 19 insertions, 16 deletions
diff --git a/testsuite/gna/README b/testsuite/gna/README
index 58f99572e..d5af291ac 100644
--- a/testsuite/gna/README
+++ b/testsuite/gna/README
@@ -47,6 +47,7 @@ you should test if the feature is supported. From issue158:
--------------------------------------------------
if ghdl_has_feature repro ghw; then
simulate repro --wave=repro.ghw
- # How to test the ghw ? Use ghwdump ?
+ ghw_diff repro
+ rm -f repro.txt repro.ghw
fi
--------------------------------------------------
diff --git a/testsuite/gna/issue1323/testsuite.sh b/testsuite/gna/issue1323/testsuite.sh
index c9c7091e1..2cc9ca2c9 100755
--- a/testsuite/gna/issue1323/testsuite.sh
+++ b/testsuite/gna/issue1323/testsuite.sh
@@ -4,22 +4,12 @@
analyze mydesign.vhdl
elab myentity
-
-simulate myentity --wave=dump.ghw | tee mydesign.out
-
-gcc ../../../src/grt/ghwdump.c ../../../src/grt/ghwlib.c -I../../../src/grt/ -o ghwdump
-
-# We're just checking that ghwdump doesn't crash on a zero length signal.
-./ghwdump -ths dump.ghw > dump.txt
-
-if diff --strip-trailing-cr dump.txt golden_dump.txt; then
- echo "The ghw dump matches."
-else
- echo "The ghw dump does not match what is expected."
- exit 1
+if ghdl_has_feature myentity ghw; then
+ elab_simulate myentity --wave=dump.ghw | tee mydesign.out
+ ghw_diff dump
+ rm -f mydesign.out dump.txt dump.ghw
fi
-#rm -f mydesign.out ghwdump dump.txt dump.ghw
clean
-echo "Test Success"
+echo "Test successful"
diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh
index a8097eb11..7db202097 100644
--- a/testsuite/testenv.sh
+++ b/testsuite/testenv.sh
@@ -103,6 +103,18 @@ elab_simulate_failure ()
"$GHDL" --elab-run $GHDL_STD_FLAGS $GHDL_FLAGS $@ --expect-failure
}
+# Compare the dump of a GHW wave and a previous golden dump
+ghw_diff ()
+{
+ ghwdump -ths "$1".ghw > "$1".txt
+ 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