diff --git a/tests/do_tests.sh b/tests/do_tests.sh index 2b0f5a1..2868454 100755 --- a/tests/do_tests.sh +++ b/tests/do_tests.sh @@ -4,7 +4,7 @@ unset CDPATH tests_dir=$(dirname $(readlink -f $0)) cd "$tests_dir" -trap 'rm -fr tmp.* a.out' EXIT INT TERM +trap 'rm -fr tmp* a.out' EXIT INT TERM # some values reported in errors are not determinate (e.g. variable addresses) # and will vary between execution and definitely between platforms @@ -35,7 +35,7 @@ mkdir -p $expected_output_dir test_failed=0 # don't change the variable src_file some tests rely on it -for src_file in tests/extracted_compile_time_tests/*.c tests/compile_time/*.c tests/run_time/*.c +for src_file in tests/extracted_compile_time_tests/*.c tests/compile_time/*.c tests/run_time/*.* do rm -f a.out @@ -44,13 +44,21 @@ do for compile_options in $compile_options_list do - dcc_flags= - suffix=`echo $compile_options|sed 's/^dcc_flags=//;s/["$]//g;s/src_file//'` - eval $compile_options - expected_stderr_file="$expected_output_dir/`basename $src_file .c`$suffix.txt" - #echo "$dcc" --c-compiler=$c_compiler $dcc_flags "$src_file" - "$dcc" --c-compiler=$c_compiler $dcc_flags "$src_file" 2>tmp.actual_stderr >/dev/null - test ! -s tmp.actual_stderr && ./a.out >tmp.actual_stderr >/dev/null + case "$src_file" in + *.c) + dcc_flags= + suffix=`echo $compile_options|sed 's/^dcc_flags=//;s/["$]//g;s/src_file//'` + eval $compile_options + expected_stderr_file="$expected_output_dir/`basename $src_file .c`$suffix.txt" + #echo "$dcc" --c-compiler=$c_compiler $dcc_flags "$src_file" + "$dcc" --c-compiler=$c_compiler $dcc_flags "$src_file" 2>tmp.actual_stderr >/dev/null + test ! -s tmp.actual_stderr && ./a.out >tmp.actual_stderr >/dev/null + ;; + + *.sh) + expected_stderr_file="$expected_output_dir/`basename $src_file .sh`.txt" + $src_file tmp.actual_stderr >/dev/null + esac if test ! -s tmp.actual_stderr then diff --git a/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/incremental_compilation.txt b/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/incremental_compilation.txt new file mode 100644 index 0000000..d44a7eb --- /dev/null +++ b/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/incremental_compilation.txt @@ -0,0 +1,2 @@ +incremental compilation works +incremental compilation works diff --git a/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/uninitialized-array-element-if--valgrind.txt b/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/uninitialized-array-element-if--valgrind.txt index 33381ad..69d2b9b 100644 --- a/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/uninitialized-array-element-if--valgrind.txt +++ b/tests/expected_output/clang-7.0-x86_64-pc-linux-gnu/uninitialized-array-element-if--valgrind.txt @@ -11,6 +11,7 @@ Execution stopped here in main() in tests/run_time/uninitialized-array-element-i Values when execution stopped: +a = argc = a[42] = a[43] = diff --git a/tests/run_time/incremental_compilation.sh b/tests/run_time/incremental_compilation.sh new file mode 100755 index 0000000..fc12db2 --- /dev/null +++ b/tests/run_time/incremental_compilation.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +cat >tmp1.c < +void f(void) {fprintf(stderr, "incremental compilation works\n"); } +eof + +cat >tmp2.c <