Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip some tests if gcc is not installed #1510

Merged
merged 1 commit into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions testsuite/gna/bug097/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

. ../../testenv.sh

if [ -z $CC ]; then
CC="gcc"
fi
if c_compiler_is_available; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, echo a message and exit 0, instead of wrapping all the commands. See https://github.com/ghdl/ghdl/blob/master/testsuite/gna/bug032/testsuite.sh#L3-L7

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"
2 changes: 1 addition & 1 deletion testsuite/gna/issue1226/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testsuite/gna/issue1228/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testsuite/gna/issue1233/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testsuite/gna/issue1256/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions testsuite/gna/issue1326/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, maybe use $CC instead of gcc, in coherence with other tests.


# 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
Expand Down
2 changes: 1 addition & 1 deletion testsuite/gna/issue450/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testsuite/gna/issue531/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion testsuite/gna/issue98/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions testsuite/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth calling c_compiler_is_available from inside ghdl_has_feature. That will avoid most of the modifications to individual tests (except bug097 and issue1326).

{
Expand Down
2 changes: 1 addition & 1 deletion testsuite/vpi/vpi001/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of skipping each vpi test, I would skip the whole (sub)testsuite at the top of https://github.com/LukasVik/ghdl/blob/testsuite_gcc/testsuite/vpi/testsuite.sh

$GHDL --vpi-compile -v gcc -c vpi1.c
$GHDL --vpi-link -v gcc -o vpi1.vpi vpi1.o

Expand Down
2 changes: 1 addition & 1 deletion testsuite/vpi/vpi002/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion testsuite/vpi/vpi003/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down