diff --git a/tests/test_fix_seed/test.sh b/tests/test_fix_seed/test.sh index 377516ce..b1585a9f 100755 --- a/tests/test_fix_seed/test.sh +++ b/tests/test_fix_seed/test.sh @@ -1,12 +1,19 @@ #!/bin/bash -set -e +Check_status() { + if [[ $? != 0 ]]; then + echo "error: test failed" + exit 1 + fi +} Check_difference() { - diff -q $1 $2 - if [[ $? == 0 ]]; then + ret=$(diff -q $1 $2) + if [[ $ret == 0 ]]; then echo "error: files must be different" exit 1 + else + echo fi } @@ -50,6 +57,7 @@ Check() { echo "Checking" verificarlo-c -O0 test.c -o test +Check_status Check 53 echo -e "\nsuccess" diff --git a/tests/test_logger/test.sh b/tests/test_logger/test.sh index c840b133..c4ea0497 100755 --- a/tests/test_logger/test.sh +++ b/tests/test_logger/test.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -e - OUTPUT_FILE=output ERROR_FILE=error @@ -63,6 +61,10 @@ check_backend_info() { compile() { verificarlo test.c -o test + if [[ $? != 0 ]]; then + echo "Compilation failed" + exit 1 + fi } run() { diff --git a/tests/test_usercall_change_precision/test.sh b/tests/test_usercall_change_precision/test.sh index 3b6971f9..334a9623 100755 --- a/tests/test_usercall_change_precision/test.sh +++ b/tests/test_usercall_change_precision/test.sh @@ -1,6 +1,11 @@ #!/bin/bash -set -e +check_status() { + if [ $? -ne 0 ]; then + echo "Test fail" + exit 1 + fi +} clean() { rm -f *.log @@ -8,6 +13,7 @@ clean() { clean verificarlo-c test.c -o test +check_status VFC_BACKENDS="libinterflop_mca.so --precision-binary32 23 --seed=1234" ./test 0 0 >23.log 2>/dev/null VFC_BACKENDS="libinterflop_mca.so --precision-binary32 10 --seed=1234" ./test 0 0 >10.log 2>/dev/null diff --git a/tests/test_usercall_inexact/Makefile b/tests/test_usercall_inexact/Makefile new file mode 100644 index 00000000..839fbacd --- /dev/null +++ b/tests/test_usercall_inexact/Makefile @@ -0,0 +1,17 @@ +ifndef type +$(error type is not set) +endif + +ifndef N +$(error N is not set) +endif + +CC=verificarlo-c +CFLAGS=-Og -Wall -DREAL=$(type) -DN=$(N) +LDFLAGS= +SOURCE=test.c +BINARY=test_$(type) + +all: + $(CC) $(CFLAGS) -c $(SOURCE) -o $(BINARY).o + $(CC) $(BINARY).o -o $(BINARY) $(LDFLAGS) diff --git a/tests/test_usercall_inexact/test.sh b/tests/test_usercall_inexact/test.sh index 10f7538b..a3a0921b 100755 --- a/tests/test_usercall_inexact/test.sh +++ b/tests/test_usercall_inexact/test.sh @@ -1,10 +1,15 @@ #!/bin/bash -set -e - export VFC_BACKENDS_LOGGER=False export N=30 +check_status() { + if [[ $? != 0 ]]; then + echo "Test fail" + exit 1 + fi +} + clean() { rm -f bfr.* aft.* } @@ -26,7 +31,8 @@ run_test() { } # Move out compilation to faster test -parallel --header : "verificarlo-c -Og test.c -DREAL={type} -DN=${N} -o test_{type}" ::: type float double +parallel --header : "make --silent type={type} N=${N}" ::: type float double +check_status clean for REAL in float double; do diff --git a/verificarlo.in.in b/verificarlo.in.in index 0fb679c2..fa009ac8 100644 --- a/verificarlo.in.in +++ b/verificarlo.in.in @@ -271,7 +271,7 @@ def compiler_mode(sources, options, output, args): if args.inst_func: # Apply function's instrumentation pass - if 13 <= int(llvm_version) <= 17: + if 13 <= int(llvm_version) < 17: shell( f"{opt} -S -enable-new-pm=0 -load {libvfcfuncinstrument} -vfclibfunc {ir.name} -o {ins.name}" )