Fixes to run_tests.sh script
- Use bash, not zsh (don't make people install zsh for no good reason) - Print help if -h command line option is given - Allow specifying the compilation target to use on the command line - If one or more filenames are provided, just run those tests. Otherwise, run everything in the tests/ directory.
This commit is contained in:
100
run_tests.sh
100
run_tests.sh
@@ -1,54 +1,86 @@
|
|||||||
#!/bin/zsh
|
#!/bin/bash
|
||||||
|
|
||||||
surprises=0
|
surprises=0
|
||||||
verbose=false
|
verbose=false
|
||||||
number=$(ls -1 tests/*.ispc|wc -l)
|
number=$(ls -1 tests/*.ispc|wc -l)
|
||||||
counter=1
|
counter=1
|
||||||
|
target=sse4
|
||||||
|
|
||||||
while getopts ":v" opt;do
|
while getopts ":vth" opt;do
|
||||||
case $opt in
|
case $opt in
|
||||||
v) verbose=true
|
v) verbose=true
|
||||||
;;
|
;;
|
||||||
|
t) target=$OPTARG
|
||||||
|
;;
|
||||||
|
h) cat <<EOF
|
||||||
|
usage: run_tests.sh [-v] [-t target] [filenames]
|
||||||
|
-v # verbose output
|
||||||
|
-t # specify compilation target (SSE4 is the default).
|
||||||
|
[filenames] # (optional) files to run through testing infrastructure
|
||||||
|
# if none are provided, all in tests/ will be run.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo Running correctness tests
|
shift $(( $OPTIND - 1 ))
|
||||||
|
if [[ "$1" > 0 ]]; then
|
||||||
|
while [[ "$1" > 0 ]]; do
|
||||||
|
i=$1
|
||||||
|
shift
|
||||||
|
echo Running test $i
|
||||||
|
|
||||||
for i in tests/*.ispc; do
|
bc=${i%%ispc}bc
|
||||||
if $verbose; then
|
ispc -O2 $i -woff -o $bc --emit-llvm --target=$target
|
||||||
echo -en "Running test $counter of $number.\r"
|
|
||||||
fi
|
|
||||||
(( counter++ ))
|
|
||||||
bc=${i%%ispc}bc
|
|
||||||
ispc -O2 $i -woff -o $bc --emit-llvm --target=sse4
|
|
||||||
if [[ $? != 0 ]]; then
|
|
||||||
surprises=1
|
|
||||||
echo Test $i FAILED ispc compile
|
|
||||||
echo
|
|
||||||
else
|
|
||||||
ispc_test $bc
|
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
surprises=1
|
surprises=1
|
||||||
echo Test $i FAILED ispc_test
|
echo Test $i FAILED ispc compile
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
ispc_test $bc
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
surprises=1
|
||||||
|
echo Test $i FAILED ispc_test
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
/bin/rm $bc
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo Running all correctness tests
|
||||||
|
|
||||||
|
for i in tests/*.ispc; do
|
||||||
|
if $verbose; then
|
||||||
|
echo -en "Running test $counter of $number.\r"
|
||||||
|
fi
|
||||||
|
(( counter++ ))
|
||||||
|
bc=${i%%ispc}bc
|
||||||
|
ispc -O2 $i -woff -o $bc --emit-llvm --target=$target
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
surprises=1
|
||||||
|
echo Test $i FAILED ispc compile
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
ispc_test $bc
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
surprises=1
|
||||||
|
echo Test $i FAILED ispc_test
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
/bin/rm $bc
|
||||||
|
done
|
||||||
|
|
||||||
|
echo Running failing tests
|
||||||
|
for i in failing_tests/*.ispc; do
|
||||||
|
(ispc -O2 $i -woff -o - --emit-llvm | ispc_test -) 2>/dev/null 1>/dev/null
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
surprises=1
|
||||||
|
echo Test $i UNEXPECTEDLY PASSED
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
# cmp $bc tests_bitcode${bc##tests}
|
done
|
||||||
# if [[ $? == 0 ]]; then
|
fi
|
||||||
# /bin/rm $bc
|
|
||||||
# fi
|
|
||||||
fi
|
|
||||||
/bin/rm $bc
|
|
||||||
done
|
|
||||||
|
|
||||||
echo Running failing tests
|
|
||||||
for i in failing_tests/*.ispc; do
|
|
||||||
(ispc -O2 $i -woff -o - --emit-llvm | ispc_test -) 2>/dev/null 1>/dev/null
|
|
||||||
if [[ $? == 0 ]]; then
|
|
||||||
surprises=1
|
|
||||||
echo Test $i UNEXPECTEDLY PASSED
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $surprises == 0 ]]; then
|
if [[ $surprises == 0 ]]; then
|
||||||
echo No surprises.
|
echo No surprises.
|
||||||
|
|||||||
Reference in New Issue
Block a user