run_tests.sh (libgd-2.3.1) | : | run_tests.sh (libgd-2.3.2) | ||
---|---|---|---|---|
#!/bin/bash | #!/bin/bash | |||
set -e | set -e | |||
# Parameters | # Parameters | |||
DLLPATH_EXTRA=$1 # Path to supporting DLLs | DLLPATH_EXTRA=$1 # Path to supporting DLLs | |||
CFLAGS_EXTRA=$2 # Extra C flags | CFLAGS_EXTRA=$2 # Extra C flags | |||
LOG=run_tests.log | LOG=run_tests.log | |||
CFLAGS="-g -Igdtest/ -I. -I../src/ -D_WIN32 -DHAVE_SYS_STAT_H $CFLAGS_EXTRA" | CFLAGS=( -g -Igdtest/ -I. -I../src/ -D_WIN32 -DHAVE_SYS_STAT_H ) | |||
LDFLAGS='-L../src -llibgd' | if [[ -n "${CFLAGS_EXTRA}" ]]; then | |||
# shellcheck disable=SC2206 | ||||
CFLAGS+=( ${CFLAGS_EXTRA} ) | ||||
fi | ||||
LDFLAGS=( -L../src -llibgd ) | ||||
DLLPATH=../src:$DLLPATH_EXTRA | DLLPATH=../src:$DLLPATH_EXTRA | |||
function run_gcc { | run_gcc() { | |||
if msg=`gcc $* 2>&1`; then | local msg | |||
true | if msg=$(gcc "$@" 2>&1); then | |||
else | true | |||
echo "COMMAND: gcc $*" >> $LOG | else | |||
echo $msg >> $LOG | echo "COMMAND: gcc $*" >> "${LOG}" | |||
false | echo "${msg}" >> "${LOG}" | |||
fi | false | |||
fi | ||||
} | } | |||
# Switch to the working directory | # Switch to the working directory | |||
export PATH=$PATH:$DLLPATH | export PATH=$PATH:$DLLPATH | |||
cd ../../tests | cd ../../tests | |||
# Initial setup | # Initial setup | |||
echo "Setting up..." | echo "Setting up..." | |||
[ -f $LOG ] && rm -f $LOG | rm -f "${LOG}" | |||
[ -f test_config.h ] || echo '#define GDTEST_TOP_DIR "."' > test_config.h | [ -f test_config.h ] || echo '#define GDTEST_TOP_DIR "."' > test_config.h | |||
run_gcc -c $CFLAGS gdtest/gdtest.c | run_gcc -c "${CFLAGS[@]}" gdtest/gdtest.c | |||
echo "Running tests:" | echo "Running tests:" | |||
count=0 | count=0 | |||
failures=0 | failures=0 | |||
compile_failures=0 | compile_failures=0 | |||
for test in `find . -name \*.c | grep -vE '^./(fontconfig|gdtest|gdhelpers|xpm)' | for test in $(find . -name '*.c' | grep -vE '^./(fontconfig|gdtest|gdhelpers|xpm | |||
`; do | )'); do | |||
count=`expr $count + 1` | : $(( count += 1 )) | |||
exe=${test%.c}.exe | exe=${test%.c}.exe | |||
if run_gcc -o $exe $CFLAGS $LDFLAGS $test gdtest.o; then | if run_gcc -o "${exe}" "${CFLAGS[@]}" "${LDFLAGS[@]}" "${test}" gdtest.o; | |||
true; | then | |||
else | true | |||
echo "COMPILE_FAIL: $test" | else | |||
compile_failures=`expr $compile_failures + 1` | echo "COMPILE_FAIL: $test" | |||
continue | : $(( compile_failures += 1 )) | |||
fi | continue | |||
fi | ||||
echo "Running $exe:" >> $LOG | ||||
if $exe 2>&1 >> $LOG; then | echo "Running $exe:" >> "${LOG}" | |||
echo "PASS: $test" | if $exe >> "${LOG}" 2>&1; then | |||
else | echo "PASS: $test" | |||
failures=`expr $failures + 1` | else | |||
echo "FAIL: $test" | : $(( failures += 1 )) | |||
fi | echo "FAIL: $test" | |||
echo >> $LOG | fi | |||
echo >> "${LOG}" | ||||
done | done | |||
echo "$failures failures and $compile_failures compile failures out of $count te sts." | echo "$failures failures and $compile_failures compile failures out of $count te sts." | |||
echo "Error messages in $LOG" | echo "Error messages in ${LOG}" | |||
End of changes. 7 change blocks. | ||||
32 lines changed or deleted | 38 lines changed or added |