Fixed comparison tests depending on absolute paths
This commit is contained in:
parent
b4fc22e7e4
commit
880c75746f
8 changed files with 26 additions and 17 deletions
|
@ -35,9 +35,10 @@ foreach(sample ${SAMPLES})
|
|||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
|
||||
add_test(${sample}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh ./${sample} "${CMAKE_CURRENT_LIST_DIR}")
|
||||
add_test(${sample}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh "${CMAKE_CURRENT_LIST_DIR}" . . ${sample})
|
||||
set_property(TEST ${sample}_compare PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
ENVIRONMENT "CRITERION_SHORT_FILENAME=1"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
|
@ -47,8 +48,9 @@ foreach(script ${SCRIPTS})
|
|||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
|
||||
add_test(${script}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh ${CMAKE_CURRENT_LIST_DIR}/tests/${script}.sh "${CMAKE_CURRENT_LIST_DIR}")
|
||||
add_test(${script}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh "${CMAKE_CURRENT_LIST_DIR}" . "${CMAKE_CURRENT_LIST_DIR}" tests/${sample})
|
||||
set_property(TEST ${script}_compare PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
ENVIRONMENT "CRITERION_SHORT_FILENAME=1"
|
||||
)
|
||||
endforeach()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/asserts.c[0m:[0;31m11[0m: Assertion failed: assert is fatal, expect isn't
|
||||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/asserts.c[0m:[0;31m12[0m: Assertion failed: This assert runs
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m11[0m: Assertion failed: assert is fatal, expect isn't
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m12[0m: Assertion failed: This assert runs
|
||||
[[0;31mFAIL[0m] asserts::base: (0,00s)
|
||||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/asserts.c[0m:[0;31m20[0m: Assertion failed: The conditions for this test were not met.
|
||||
[[0;34m----[0m] [0;1masserts.c[0m:[0;31m20[0m: Assertion failed: The conditions for this test were not met.
|
||||
[[0;31mFAIL[0m] asserts::old_school: (0,00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m6[0;1m | Passing: [0;32m4[0;1m | Failing: [0;31m2[0;1m | Crashing: [0;31m0[0;1m [0m
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/description.c[0m:[0;31m4[0m: Assertion failed: 0
|
||||
[[0;34m----[0m] [0;1mdescription.c[0m:[0;31m4[0m: Assertion failed: 0
|
||||
[[0;31mFAIL[0m] misc::failing: (0,00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m0[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/long-messages.c[0m:[0;31m4[0m: Assertion failed: This is
|
||||
[[0;34m----[0m] [0;1mlong-messages.c[0m:[0;31m4[0m: Assertion failed: This is
|
||||
[[0;34m----[0m] A long message
|
||||
[[0;34m----[0m] Spawning multiple lines.
|
||||
[[0;34m----[0m] Formatting is respected.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/report.c[0m:[0;31m5[0m: Assertion failed: 0
|
||||
[[0;34m----[0m] [0;1mreport.c[0m:[0;31m5[0m: Assertion failed: 0
|
||||
[[0;31mFAIL[0m] sample::test: (0,00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m0[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/signal.c[0m:[0;31m16[0m: Unexpected signal caught below this line!
|
||||
[[0;34m----[0m] [0;1msignal.c[0m:[0;31m16[0m: Unexpected signal caught below this line!
|
||||
[[0;31mFAIL[0m] simple::uncaught: CRASH!
|
||||
[[0;31mFAIL[0m] simple::wrong_signal: (0,00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m3[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m2[0;1m | Crashing: [0;31m1[0;1m [0m
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/simple.c[0m:[0;31m4[0m: Assertion failed: 0
|
||||
[[0;34m----[0m] [0;1msimple.c[0m:[0;31m4[0m: Assertion failed: 0
|
||||
[[0;31mFAIL[0m] misc::failing: (0,00s)
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m0[0;1m [0m
|
||||
|
|
21
samples/tests/run_test.sh
Normal file → Executable file
21
samples/tests/run_test.sh
Normal file → Executable file
|
@ -1,17 +1,24 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
if [ -f $1.in ]; then
|
||||
sh -c "$1" > $1.out 2> $1.err < $1.in
|
||||
cmp_dir=$1; shift
|
||||
out_dir=$1; shift
|
||||
bin_dir=$1; shift
|
||||
|
||||
mkdir -p $out_dir
|
||||
|
||||
if [ -f $cmp_dir/$1.in ]; then
|
||||
sh -c "$bin_dir/$*" > $out_dir/$1.out 2> $out_dir/$1.err < $cmp_dir/$1.in
|
||||
else
|
||||
sh -c "$1" > $1.out 2> $1.err
|
||||
mkdir -p $(dirname $out_dir/$1)
|
||||
sh -c "$bin_dir/$*" > $out_dir/$1.out 2> $out_dir/$1.err
|
||||
fi
|
||||
|
||||
if [ -f $2/$1.out.expected ] && [ "$(md5sum $1.out | cut -d' ' -f1)" != "$(md5sum $2/$1.out.expected | cut -d' ' -f1)" ]; then
|
||||
diff $1.out $2/$1.out.expected
|
||||
if [ -f $cmp_dir/$1.out.expected ] && [ "$(md5sum $out_dir/$1.out | cut -d' ' -f1)" != "$(md5sum $cmp_dir/$1.out.expected | cut -d' ' -f1)" ]; then
|
||||
diff $out_dir/$1.out $cmp_dir/$1.out.expected
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ -f $2/$1.err.expected ] && [ "$(md5sum $1.err | cut -d' ' -f1)" != "$(md5sum $2/$1.err.expected | cut -d' ' -f1)" ]; then
|
||||
diff $1.err $2/$1.err.expected
|
||||
if [ -f $cmp_dir/$1.err.expected ] && [ "$(md5sum $out_dir/$1.err | cut -d' ' -f1)" != "$(md5sum $cmp_dir/$1.err.expected | cut -d' ' -f1)" ]; then
|
||||
diff $out_dir/$1.err $cmp_dir/$1.err.expected
|
||||
exit 255
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue