From 0d72d5def31ba701bfce8750820bcd9bb9f4ad5c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 19 Aug 2017 05:05:31 +0200 Subject: Add sanity/ testsuite. --- testsuite/sanity/000hello/hello.vhdl | 7 +++++ testsuite/sanity/000hello/testsuite.sh | 10 +++++++ testsuite/sanity/001hello87/err87.vhdl | 11 ++++++++ testsuite/sanity/001hello87/hello.vhdl | 7 +++++ testsuite/sanity/001hello87/testsuite.sh | 20 +++++++++++++ testsuite/sanity/002hello2008/err93.vhdl | 10 +++++++ testsuite/sanity/002hello2008/hello.vhdl | 7 +++++ testsuite/sanity/002hello2008/testsuite.sh | 20 +++++++++++++ testsuite/sanity/testsuite.sh | 45 ++++++++++++++++++++++++++++++ 9 files changed, 137 insertions(+) create mode 100644 testsuite/sanity/000hello/hello.vhdl create mode 100755 testsuite/sanity/000hello/testsuite.sh create mode 100644 testsuite/sanity/001hello87/err87.vhdl create mode 100644 testsuite/sanity/001hello87/hello.vhdl create mode 100755 testsuite/sanity/001hello87/testsuite.sh create mode 100644 testsuite/sanity/002hello2008/err93.vhdl create mode 100644 testsuite/sanity/002hello2008/hello.vhdl create mode 100755 testsuite/sanity/002hello2008/testsuite.sh create mode 100755 testsuite/sanity/testsuite.sh diff --git a/testsuite/sanity/000hello/hello.vhdl b/testsuite/sanity/000hello/hello.vhdl new file mode 100644 index 000000000..792aae2bd --- /dev/null +++ b/testsuite/sanity/000hello/hello.vhdl @@ -0,0 +1,7 @@ +entity hello is +end hello; + +architecture behav of hello is +begin + assert false report "Hello VHDL world" severity note; +end behav; diff --git a/testsuite/sanity/000hello/testsuite.sh b/testsuite/sanity/000hello/testsuite.sh new file mode 100755 index 000000000..09af7b899 --- /dev/null +++ b/testsuite/sanity/000hello/testsuite.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. ../../testenv.sh + +analyze hello.vhdl +elab_simulate hello + +clean + +echo "test successful" diff --git a/testsuite/sanity/001hello87/err87.vhdl b/testsuite/sanity/001hello87/err87.vhdl new file mode 100644 index 000000000..e918352ce --- /dev/null +++ b/testsuite/sanity/001hello87/err87.vhdl @@ -0,0 +1,11 @@ +entity err87 is +end err87; + +architecture behav of err87 is +begin + process + begin + report "not valid in vhdl-87" severity note; + wait; + end process; +end behav; diff --git a/testsuite/sanity/001hello87/hello.vhdl b/testsuite/sanity/001hello87/hello.vhdl new file mode 100644 index 000000000..792aae2bd --- /dev/null +++ b/testsuite/sanity/001hello87/hello.vhdl @@ -0,0 +1,7 @@ +entity hello is +end hello; + +architecture behav of hello is +begin + assert false report "Hello VHDL world" severity note; +end behav; diff --git a/testsuite/sanity/001hello87/testsuite.sh b/testsuite/sanity/001hello87/testsuite.sh new file mode 100755 index 000000000..a02c6a1b4 --- /dev/null +++ b/testsuite/sanity/001hello87/testsuite.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +. ../../testenv.sh + +GHDL_STD_FLAGS=--std=87 +analyze hello.vhdl +elab_simulate hello + +# Check that vhdl-87 is used +analyze_failure err87.vhdl + +clean + +# Check that err87 is a valid vhdl-93 source file +GHDL_STD_FLAGS= +analyze err87.vhdl + +clean + +echo "test successful" diff --git a/testsuite/sanity/002hello2008/err93.vhdl b/testsuite/sanity/002hello2008/err93.vhdl new file mode 100644 index 000000000..f33ec4c7f --- /dev/null +++ b/testsuite/sanity/002hello2008/err93.vhdl @@ -0,0 +1,10 @@ +entity err93 is +end err93; + +architecture behav of err93 is +begin + process (all) is + begin + report "not valid in vhdl-93" severity note; + end process; +end behav; diff --git a/testsuite/sanity/002hello2008/hello.vhdl b/testsuite/sanity/002hello2008/hello.vhdl new file mode 100644 index 000000000..792aae2bd --- /dev/null +++ b/testsuite/sanity/002hello2008/hello.vhdl @@ -0,0 +1,7 @@ +entity hello is +end hello; + +architecture behav of hello is +begin + assert false report "Hello VHDL world" severity note; +end behav; diff --git a/testsuite/sanity/002hello2008/testsuite.sh b/testsuite/sanity/002hello2008/testsuite.sh new file mode 100755 index 000000000..c8ce4478f --- /dev/null +++ b/testsuite/sanity/002hello2008/testsuite.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +. ../../testenv.sh + +GHDL_STD_FLAGS=--std=08 +analyze hello.vhdl +elab_simulate hello + +# Check that vhdl-08 is used +analyze err93.vhdl + +clean + +# Check that err93 is not valid in vhdl-93 +GHDL_STD_FLAGS= +analyze_failure err93.vhdl + +clean + +echo "test successful" diff --git a/testsuite/sanity/testsuite.sh b/testsuite/sanity/testsuite.sh new file mode 100755 index 000000000..96150da88 --- /dev/null +++ b/testsuite/sanity/testsuite.sh @@ -0,0 +1,45 @@ +#! /bin/sh + +# Driver for sanity checks + +set -e + +dirs="[0-9]*" + +failures="" +full=n + +for opt; do + case "$opt" in + -k | --keep-going) full=y ;; + --list-tests) echo $dirs; exit 0;; + *) echo "Unknown option $opt" + exit 2 + ;; + esac +done + +singlerun() { + echo "" + echo "sanity $1:" + cd $1 + if ! ./testsuite.sh; then + echo "#################################################################" + echo "######### FAILURE: $1" + echo "#################################################################" + if [ $2 = "y" ]; then + failures="$failures $1" + else + exit 1; + fi + fi + cd .. +} + +for i in $dirs; do singlerun $i $full; done + +if [ x"$failures" = x"" ]; then + echo "sanity tests are successful" && exit 0 +else + echo "sanity test failed ($failures)" && exit 1 +fi -- cgit v1.2.3