Added output comparison tests to prevent regressions
This commit is contained in:
parent
60e84a48fe
commit
9db9b5776a
24 changed files with 67 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
|||
!*.rst
|
||||
!samples/tests/*.sh
|
||||
!*.po
|
||||
!samples/*.expected
|
||||
|
||||
!LICENSE
|
||||
!HEADER
|
||||
|
|
|
@ -19,7 +19,7 @@ script:
|
|||
after_success:
|
||||
- make coveralls
|
||||
after_failure:
|
||||
- cat Testing/Temporary/LastTest.log
|
||||
- cat Testing/Temporary/LastTest.log samples/*.{out,err} ../samples/tests/*.{out,err}
|
||||
env:
|
||||
global:
|
||||
secure: bzZcWjdqoTgceC40kEBucx7NuWYJPk+rxgF3UJJDXi+ijQAFYPv70p5eVsGR6rfc+XgqXCxcUFQtuL4ZVt7QEfVk1ZOJITNeHbKIeKaEYS4nX8mFf+CBeEm9bJGZ04KiQJdJu5mzzAHvXbW7roGXDGWe1Bjnk5wwA+dNUCa7H04=
|
||||
|
|
|
@ -34,6 +34,11 @@ foreach(sample ${SAMPLES})
|
|||
set_property(TEST ${sample} PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
|
||||
add_test(${sample}_compare sh ${CMAKE_CURRENT_LIST_DIR}/tests/run_test.sh ./${sample} "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set_property(TEST ${sample}_compare PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
foreach(script ${SCRIPTS})
|
||||
|
@ -41,4 +46,9 @@ foreach(script ${SCRIPTS})
|
|||
set_property(TEST ${script} PROPERTY
|
||||
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}")
|
||||
set_property(TEST ${script}_compare PROPERTY
|
||||
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
|
||||
)
|
||||
endforeach()
|
||||
|
|
6
samples/asserts.err.expected
Normal file
6
samples/asserts.err.expected
Normal file
|
@ -0,0 +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;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;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
|
0
samples/asserts.out.expected
Normal file
0
samples/asserts.out.expected
Normal file
3
samples/description.err.expected
Normal file
3
samples/description.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/description.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
|
0
samples/description.out.expected
Normal file
0
samples/description.out.expected
Normal file
1
samples/fixtures.err.expected
Normal file
1
samples/fixtures.err.expected
Normal file
|
@ -0,0 +1 @@
|
|||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m1[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m0[0;1m | Crashing: [0;31m0[0;1m [0m
|
2
samples/fixtures.out.expected
Normal file
2
samples/fixtures.out.expected
Normal file
|
@ -0,0 +1,2 @@
|
|||
Runs before the test
|
||||
Runs after the test
|
6
samples/long-messages.err.expected
Normal file
6
samples/long-messages.err.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
[[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] A long message
|
||||
[[0;34m----[0m] Spawning multiple lines.
|
||||
[[0;34m----[0m] Formatting is respected.
|
||||
[[0;31mFAIL[0m] sample::long_msg: (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
|
0
samples/long-messages.out.expected
Normal file
0
samples/long-messages.out.expected
Normal file
1
samples/more-suites.err.expected
Normal file
1
samples/more-suites.err.expected
Normal file
|
@ -0,0 +1 @@
|
|||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m2[0;1m | Failing: [0;31m0[0;1m | Crashing: [0;31m0[0;1m [0m
|
0
samples/more-suites.out.expected
Normal file
0
samples/more-suites.out.expected
Normal file
3
samples/other-crashes.err.expected
Normal file
3
samples/other-crashes.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1mWarning! The test `misc::setup_crash` crashed during its setup or teardown.[0m
|
||||
[[0;34m----[0m] [0;1mWarning! The test `misc::teardown_crash` crashed during its setup or teardown.[0m
|
||||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m1[0;1m | Failing: [0;31m1[0;1m | Crashing: [0;31m1[0;1m [0m
|
0
samples/other-crashes.out.expected
Normal file
0
samples/other-crashes.out.expected
Normal file
3
samples/report.err.expected
Normal file
3
samples/report.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/report.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
|
5
samples/report.out.expected
Normal file
5
samples/report.out.expected
Normal file
|
@ -0,0 +1,5 @@
|
|||
criterion_init
|
||||
criterion_init
|
||||
testing test in category sample
|
||||
Asserts: [1 passed, 1 failed, 2 total]
|
||||
criterion_fini
|
4
samples/signal.err.expected
Normal file
4
samples/signal.err.expected
Normal file
|
@ -0,0 +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;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
|
0
samples/signal.out.expected
Normal file
0
samples/signal.out.expected
Normal file
3
samples/simple.err.expected
Normal file
3
samples/simple.err.expected
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[0;34m----[0m] [0;1m/home/snaipe/workspace/c/criterion/samples/simple.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
|
0
samples/simple.out.expected
Normal file
0
samples/simple.out.expected
Normal file
1
samples/suites.err.expected
Normal file
1
samples/suites.err.expected
Normal file
|
@ -0,0 +1 @@
|
|||
[[0;34m====[0m] [0;1mSynthesis: Tested: [0;34m2[0;1m | Passing: [0;32m2[0;1m | Failing: [0;31m0[0;1m | Crashing: [0;31m0[0;1m [0m
|
0
samples/suites.out.expected
Normal file
0
samples/suites.out.expected
Normal file
17
samples/tests/run_test.sh
Normal file
17
samples/tests/run_test.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
if [ -f $1.in ]; then
|
||||
sh -c "$1" > $1.out 2> $1.err < $1.in
|
||||
else
|
||||
sh -c "$1" > $1.out 2> $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
|
||||
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
|
||||
exit 255
|
||||
fi
|
Loading…
Add table
Reference in a new issue