From 062ff5b6a41caf93e03c417e31a8a6471993abf1 Mon Sep 17 00:00:00 2001 From: Marlon James Date: Wed, 3 Mar 2021 12:06:53 -0800 Subject: VHPI: add tests for loading libraries --- testsuite/vhpi/002load_entrypoint/testsuite.sh | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 testsuite/vhpi/002load_entrypoint/testsuite.sh (limited to 'testsuite/vhpi/002load_entrypoint/testsuite.sh') diff --git a/testsuite/vhpi/002load_entrypoint/testsuite.sh b/testsuite/vhpi/002load_entrypoint/testsuite.sh new file mode 100755 index 000000000..bdc2e8a6a --- /dev/null +++ b/testsuite/vhpi/002load_entrypoint/testsuite.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze mydesign.vhdl +elab myentity + +if c_compiler_is_available && ghdl_has_feature myentity vhpi; then + $GHDL --vpi-compile -v gcc -c vhpi_lib.c + $GHDL --vpi-link -v gcc -o vhpi_lib.vhpi vhpi_lib.o + + add_vpi_path + + simulate myentity --vhpi=./vhpi_lib.vhpi:my_startup | tee myentity.out + if grep -q Error myentity.out; then + echo "Error in output" + exit 1; + fi + if grep -q error myentity.out; then + echo "error in output" + exit 1; + fi + if ! grep -q "VHPI lib" myentity.out; then + echo "VHPI Library not loaded" + exit 1; + fi + + rm -f vhpi_lib.vhpi vhpi_lib.o myentity.out +fi +clean + +echo "Test successful" -- cgit v1.2.3