Skip to content

Commit

Permalink
Remove 'set -e' for test using code ret 1 as intermediate results
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanchatelain committed Apr 25, 2024
1 parent 9062f77 commit 677ebd5
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
14 changes: 11 additions & 3 deletions tests/test_fix_seed/test.sh
Original file line number Diff line number Diff line change
@@ -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
}

Expand Down Expand Up @@ -50,6 +57,7 @@ Check() {

echo "Checking"
verificarlo-c -O0 test.c -o test
Check_status
Check 53

echo -e "\nsuccess"
6 changes: 4 additions & 2 deletions tests/test_logger/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

set -e

OUTPUT_FILE=output
ERROR_FILE=error

Expand Down Expand Up @@ -63,6 +61,10 @@ check_backend_info() {

compile() {
verificarlo test.c -o test
if [[ $? != 0 ]]; then
echo "Compilation failed"
exit 1
fi
}

run() {
Expand Down
8 changes: 7 additions & 1 deletion tests/test_usercall_change_precision/test.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#!/bin/bash

set -e
check_status() {
if [ $? -ne 0 ]; then
echo "Test fail"
exit 1
fi
}

clean() {
rm -f *.log
}

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
Expand Down
17 changes: 17 additions & 0 deletions tests/test_usercall_inexact/Makefile
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 9 additions & 3 deletions tests/test_usercall_inexact/test.sh
Original file line number Diff line number Diff line change
@@ -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.*
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion verificarlo.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)
Expand Down

0 comments on commit 677ebd5

Please sign in to comment.