diff options
author | umarcor <unai.martinezcorral@ehu.eus> | 2020-12-28 20:49:18 +0100 |
---|---|---|
committer | umarcor <unai.martinezcorral@ehu.eus> | 2020-12-28 22:55:46 +0100 |
commit | f940ff13f5aad6b2253017413182f80544546218 (patch) | |
tree | 94161a037294bbcebdb7844434e2abe553b32837 | |
parent | 9088c8c03a2203f655482d00444a46f10f987b39 (diff) | |
download | ghdl-f940ff13f5aad6b2253017413182f80544546218.tar.gz ghdl-f940ff13f5aad6b2253017413182f80544546218.tar.bz2 ghdl-f940ff13f5aad6b2253017413182f80544546218.zip |
merge testsuite/python into testsuite/pyunit
-rwxr-xr-x | dist/ci-run.sh | 4 | ||||
-rwxr-xr-x | testsuite/python/testsuite.sh | 53 | ||||
-rwxr-xr-x | testsuite/pyunit/testsuite.sh | 57 | ||||
-rw-r--r-- | testsuite/pyunit/units01/demo.vhdl (renamed from testsuite/python/units01/demo.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/units01/show_ports.py (renamed from testsuite/python/units01/show_ports.py) | 0 | ||||
-rwxr-xr-x | testsuite/pyunit/units01/show_units.py (renamed from testsuite/python/units01/show_units.py) | 0 | ||||
-rwxr-xr-x | testsuite/pyunit/units01/testsuite.sh (renamed from testsuite/python/units01/testsuite.sh) | 0 | ||||
-rwxr-xr-x | testsuite/testsuite.sh | 27 |
8 files changed, 83 insertions, 58 deletions
diff --git a/dist/ci-run.sh b/dist/ci-run.sh index cd4a2572b..eb82c7e99 100755 --- a/dist/ci-run.sh +++ b/dist/ci-run.sh @@ -420,12 +420,12 @@ ci_run () { if [ "x$IS_MACOS" = "xtrue" ]; then CC=clang \ prefix="`cd ./install-mcode; pwd`/usr/local" \ - ./testsuite/testsuite.sh sanity gna vests vpi + ./testsuite/testsuite.sh sanity pyunit gna vests vpi else # Build ghdl/ghdl:$GHDL_IMAGE_TAG image build_img_ghdl # Run test in docker container - tests="sanity" + tests="sanity pyunit" if [ "x$ISGPL" != "xtrue" ]; then tests="$tests gna" fi diff --git a/testsuite/python/testsuite.sh b/testsuite/python/testsuite.sh deleted file mode 100755 index 12b367f2c..000000000 --- a/testsuite/python/testsuite.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh - -# Driver for a testsuite. - -set -e - -# This is the only place where test dirs are specified. Do not duplicate this -# line -dirs="*[0-9]" - -failures="" -full=n - -for opt; do - case "$opt" in - -k | --keep-going) full=y ;; - --dir=*) dirs=`echo $opt | sed -e 's/--dir=//'` ;; - --skip=*) d=`echo $opt | sed -e 's/--skip=//'` - dirs=`echo "" $dirs | sed -e "s/ $d//"` ;; - --start-at=*) d=`echo $opt | sed -e 's/--start-at=//'` - dirs=`echo "" $dirs | sed -e "s/^.* $d//"` - dirs="$d $dirs" ;; - --list-tests) echo $dirs; exit 0;; - *) echo "Unknown option $opt" - exit 2 - ;; - esac -done - -singlerun() { - echo "" - echo "dir $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 "tests are successful" && exit 0 -else - echo "test failed ($failures)" && exit 1 -fi diff --git a/testsuite/pyunit/testsuite.sh b/testsuite/pyunit/testsuite.sh new file mode 100755 index 000000000..56cfdec01 --- /dev/null +++ b/testsuite/pyunit/testsuite.sh @@ -0,0 +1,57 @@ +#! /bin/sh + +# Driver for a testsuite. + +set -e + +# This is the only place where test dirs are specified. Do not duplicate this +# line +#dirs="*[0-9]" +# +#failures="" +#full=n +# +#for opt; do +# case "$opt" in +# -k | --keep-going) full=y ;; +# --dir=*) dirs=`echo $opt | sed -e 's/--dir=//'` ;; +# --skip=*) d=`echo $opt | sed -e 's/--skip=//'` +# dirs=`echo "" $dirs | sed -e "s/ $d//"` ;; +# --start-at=*) d=`echo $opt | sed -e 's/--start-at=//'` +# dirs=`echo "" $dirs | sed -e "s/^.* $d//"` +# dirs="$d $dirs" ;; +# --list-tests) echo $dirs; exit 0;; +# *) echo "Unknown option $opt" +# exit 2 +# ;; +# esac +#done +# +#singlerun() { +# echo "" +# echo "dir $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 "tests are successful" && exit 0 +#else +# echo "test failed ($failures)" && exit 1 +#fi + +cd $(dirname "$0") + +python -m unittest . diff --git a/testsuite/python/units01/demo.vhdl b/testsuite/pyunit/units01/demo.vhdl index ed98c936a..ed98c936a 100644 --- a/testsuite/python/units01/demo.vhdl +++ b/testsuite/pyunit/units01/demo.vhdl diff --git a/testsuite/python/units01/show_ports.py b/testsuite/pyunit/units01/show_ports.py index a11f2acbd..a11f2acbd 100644 --- a/testsuite/python/units01/show_ports.py +++ b/testsuite/pyunit/units01/show_ports.py diff --git a/testsuite/python/units01/show_units.py b/testsuite/pyunit/units01/show_units.py index 43baf9aed..43baf9aed 100755 --- a/testsuite/python/units01/show_units.py +++ b/testsuite/pyunit/units01/show_units.py diff --git a/testsuite/python/units01/testsuite.sh b/testsuite/pyunit/units01/testsuite.sh index f45d12ac3..f45d12ac3 100755 --- a/testsuite/python/units01/testsuite.sh +++ b/testsuite/pyunit/units01/testsuite.sh diff --git a/testsuite/testsuite.sh b/testsuite/testsuite.sh index fd686ccd0..b77ccdbc5 100755 --- a/testsuite/testsuite.sh +++ b/testsuite/testsuite.sh @@ -112,7 +112,7 @@ do_sanity () { [ "$failures" = "" ] || exit 1 } -# The GNA testsuite: regression testsuite using reports/issues from gna.org +# The GNA testsuite: regression testsuite using reports/issues from gna.org and from GitHub do_gna () { gstart "[GHDL - test] gna" cd gna @@ -138,6 +138,26 @@ do_gna () { [ "$failures" = "" ] || exit 1 } +# The Python Unit testsuite: regression testsuite for Python bindings to libghdl +do_pyunit () { + gstart "[GHDL - test] pyunit" + cd pyunit + + dirs=`./testsuite.sh --list-tests` + if ./testsuite.sh > test.log 2>&1 ; then + printf "pyunit: ${ANSI_GREEN}ok${ANSI_NOCOLOR}\n" + # Don't disp log + else + printf "pyunit: ${ANSI_RED}failed${ANSI_NOCOLOR}\n" + cat test.log + failures="$failures" + fi + + cd .. + gend + [ "$failures" = "" ] || exit 1 +} + # The VESTS testsuite: compliance testsuite, from: https://github.com/nickg/vests.git 388250486a do_vests () { gstart "[GHDL - test] vests" @@ -226,7 +246,7 @@ for opt; do esac done -if [ "x$tests" = "x" ]; then tests="sanity gna vests synth vpi"; fi +if [ "x$tests" = "x" ]; then tests="sanity pyunit gna vests synth vpi"; fi echo "tests: $tests" @@ -234,10 +254,11 @@ echo "tests: $tests" do_test() { case $1 in sanity) do_sanity;; + pyunit) do_pyunit;; gna) do_gna;; vests) do_vests;; synth) do_synth;; - vpi) do_vpi;; + vpi) do_vpi;; *) printf "${ANSI_RED}$0: test name '$1' is unknown${ANSI_NOCOLOR}\n" exit 1;; |