From 277ca7463070d1250a3168ce01762149bd0fb445 Mon Sep 17 00:00:00 2001 From: Lukas Vik <2767848-LukasVik@users.noreply.gitlab.com> Date: Tue, 17 Nov 2020 11:26:54 +0100 Subject: Skip some test if gcc is not installed --- testsuite/gna/bug097/testsuite.sh | 18 ++++++++++-------- testsuite/gna/issue1226/testsuite.sh | 2 +- testsuite/gna/issue1228/testsuite.sh | 2 +- testsuite/gna/issue1233/testsuite.sh | 2 +- testsuite/gna/issue1256/testsuite.sh | 2 +- testsuite/gna/issue1326/testsuite.sh | 9 ++++++--- testsuite/gna/issue450/testsuite.sh | 2 +- testsuite/gna/issue531/testsuite.sh | 2 +- testsuite/gna/issue98/testsuite.sh | 2 +- testsuite/testenv.sh | 9 +++++++++ testsuite/vpi/vpi001/testsuite.sh | 2 +- testsuite/vpi/vpi002/testsuite.sh | 2 +- testsuite/vpi/vpi003/testsuite.sh | 2 +- 13 files changed, 35 insertions(+), 21 deletions(-) diff --git a/testsuite/gna/bug097/testsuite.sh b/testsuite/gna/bug097/testsuite.sh index b1836a423..c66369565 100755 --- a/testsuite/gna/bug097/testsuite.sh +++ b/testsuite/gna/bug097/testsuite.sh @@ -2,17 +2,19 @@ . ../../testenv.sh -if [ -z $CC ]; then - CC="gcc" -fi +if c_compiler_is_available; then + if [ -z $CC ]; then + CC="gcc" + fi -$CC -c -fPIC getrand.c -$CC -o getrand.so --shared getrand.o + $CC -c -fPIC getrand.c + $CC -o getrand.so --shared getrand.o -analyze tb.vhdl -elab_simulate tb + analyze tb.vhdl + elab_simulate tb + rm -f getrand.o getrand.so +fi clean -rm -f getrand.o getrand.so echo "Test successful" diff --git a/testsuite/gna/issue1226/testsuite.sh b/testsuite/gna/issue1226/testsuite.sh index 210e01058..c86134b19 100755 --- a/testsuite/gna/issue1226/testsuite.sh +++ b/testsuite/gna/issue1226/testsuite.sh @@ -5,7 +5,7 @@ analyze adder.vhdl elab adder -if ghdl_has_feature adder vpi; then +if c_compiler_is_available && ghdl_has_feature adder vpi; then add_vpi_path $GHDL --vpi-compile -v gcc -c vpi_plugin.c diff --git a/testsuite/gna/issue1228/testsuite.sh b/testsuite/gna/issue1228/testsuite.sh index 1f80a4ab1..67afbcf9e 100755 --- a/testsuite/gna/issue1228/testsuite.sh +++ b/testsuite/gna/issue1228/testsuite.sh @@ -5,7 +5,7 @@ analyze test_load.vhdl elab test_load -if ghdl_has_feature test_load vpi; then +if c_compiler_is_available && ghdl_has_feature test_load vpi; then add_vpi_path $GHDL --vpi-compile -v gcc $CFLAGS -c vpi1.c diff --git a/testsuite/gna/issue1233/testsuite.sh b/testsuite/gna/issue1233/testsuite.sh index 210e01058..c86134b19 100755 --- a/testsuite/gna/issue1233/testsuite.sh +++ b/testsuite/gna/issue1233/testsuite.sh @@ -5,7 +5,7 @@ analyze adder.vhdl elab adder -if ghdl_has_feature adder vpi; then +if c_compiler_is_available && ghdl_has_feature adder vpi; then add_vpi_path $GHDL --vpi-compile -v gcc -c vpi_plugin.c diff --git a/testsuite/gna/issue1256/testsuite.sh b/testsuite/gna/issue1256/testsuite.sh index 33226a0ef..c2cff4957 100755 --- a/testsuite/gna/issue1256/testsuite.sh +++ b/testsuite/gna/issue1256/testsuite.sh @@ -5,7 +5,7 @@ analyze enum_test.vhdl elab enum_test -if ghdl_has_feature enum_test vpi; then +if c_compiler_is_available && ghdl_has_feature enum_test vpi; then add_vpi_path $GHDL --vpi-compile -v gcc -c vpi_plugin.c diff --git a/testsuite/gna/issue1326/testsuite.sh b/testsuite/gna/issue1326/testsuite.sh index e6b3262c8..b90269d4b 100755 --- a/testsuite/gna/issue1326/testsuite.sh +++ b/testsuite/gna/issue1326/testsuite.sh @@ -7,10 +7,13 @@ elab mytestbench simulate mytestbench --wave=dump.ghw | tee mytestbench.out -gcc ../../../src/grt/ghwdump.c ../../../src/grt/ghwlib.c -I../../../src/grt/ -o ghwdump +if c_compiler_is_available; then -# We're just checking that ghwdump doesn't crash on a zero length signal. -./ghwdump -ths dump.ghw > dump.txt + 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 +fi rm -f mytestbench.out ghwdump dump.txt dump.ghw clean diff --git a/testsuite/gna/issue450/testsuite.sh b/testsuite/gna/issue450/testsuite.sh index 5110fb676..f67324459 100755 --- a/testsuite/gna/issue450/testsuite.sh +++ b/testsuite/gna/issue450/testsuite.sh @@ -5,7 +5,7 @@ analyze disptree.vhdl elab disptree -if ghdl_has_feature disptree vpi; then +if c_compiler_is_available && ghdl_has_feature disptree vpi; then add_vpi_path $GHDL --vpi-compile -v gcc -c vpi2.c diff --git a/testsuite/gna/issue531/testsuite.sh b/testsuite/gna/issue531/testsuite.sh index cf8d1b71b..56ce69ddc 100755 --- a/testsuite/gna/issue531/testsuite.sh +++ b/testsuite/gna/issue531/testsuite.sh @@ -5,7 +5,7 @@ analyze repro1.vhdl elab sliced_ex -if ghdl_has_feature sliced_ex vpi; then +if c_compiler_is_available && ghdl_has_feature sliced_ex vpi; then $GHDL --vpi-compile -v gcc -c vpi1.c $GHDL --vpi-link -v gcc -o vpi1.vpi vpi1.o diff --git a/testsuite/gna/issue98/testsuite.sh b/testsuite/gna/issue98/testsuite.sh index 6720d81eb..3a484cff1 100755 --- a/testsuite/gna/issue98/testsuite.sh +++ b/testsuite/gna/issue98/testsuite.sh @@ -5,7 +5,7 @@ analyze test_load.vhdl elab test_load -if ghdl_has_feature test_load vpi; then +if c_compiler_is_available && ghdl_has_feature test_load vpi; then add_vpi_path $GHDL --vpi-compile -v gcc -c vpi1.c diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh index f6f271cac..a8097eb11 100644 --- a/testsuite/testenv.sh +++ b/testsuite/testenv.sh @@ -148,6 +148,15 @@ synth_tb() clean } +# Check if a C compiler is installed on this system +c_compiler_is_available () +{ + if [ -z $CC ]; then + CC="gcc" + fi + which $CC +} + # Check if a feature is present ghdl_has_feature () { diff --git a/testsuite/vpi/vpi001/testsuite.sh b/testsuite/vpi/vpi001/testsuite.sh index a3edac791..4bbded6b4 100755 --- a/testsuite/vpi/vpi001/testsuite.sh +++ b/testsuite/vpi/vpi001/testsuite.sh @@ -5,7 +5,7 @@ analyze mydesign.vhdl elab myentity -if ghdl_has_feature myentity vpi; then +if c_compiler_is_available && ghdl_has_feature myentity vpi; then $GHDL --vpi-compile -v gcc -c vpi1.c $GHDL --vpi-link -v gcc -o vpi1.vpi vpi1.o diff --git a/testsuite/vpi/vpi002/testsuite.sh b/testsuite/vpi/vpi002/testsuite.sh index 508ad6b65..d97b3fb21 100755 --- a/testsuite/vpi/vpi002/testsuite.sh +++ b/testsuite/vpi/vpi002/testsuite.sh @@ -5,7 +5,7 @@ analyze mydesign.vhdl elab myentity -if ghdl_has_feature myentity vpi; then +if c_compiler_is_available && ghdl_has_feature myentity vpi; then $GHDL --vpi-compile -v gcc -c vpi1.c $GHDL --vpi-link -v gcc -o vpi1.vpi vpi1.o diff --git a/testsuite/vpi/vpi003/testsuite.sh b/testsuite/vpi/vpi003/testsuite.sh index 508ad6b65..d97b3fb21 100755 --- a/testsuite/vpi/vpi003/testsuite.sh +++ b/testsuite/vpi/vpi003/testsuite.sh @@ -5,7 +5,7 @@ analyze mydesign.vhdl elab myentity -if ghdl_has_feature myentity vpi; then +if c_compiler_is_available && ghdl_has_feature myentity vpi; then $GHDL --vpi-compile -v gcc -c vpi1.c $GHDL --vpi-link -v gcc -o vpi1.vpi vpi1.o -- cgit v1.2.3