aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2014-02-26 13:45:02 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-03-03 09:58:23 +0100
commit70c723c5d39555f97cf37feb60255118ca68e14e (patch)
treed955af2093b7198fc0160e5e97f469daaddd3e49 /tests/CMakeLists.txt
parente6e99619e760076198281daa5042edb4f9840509 (diff)
downloadcmocka-70c723c5d39555f97cf37feb60255118ca68e14e.tar.gz
cmocka-70c723c5d39555f97cf37feb60255118ca68e14e.tar.xz
cmocka-70c723c5d39555f97cf37feb60255118ca68e14e.zip
Test should not be run if setup function fails
Assertions are commonly used in setup function. If setup function fail test should not be executed, because it may result into unexpected behaviour (crash) Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 82cc046..8287b61 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -11,7 +11,8 @@ set(CMOCKA_TESTS
test_assert_macros
test_assert_macros_fail
test_exception_handler
- test_basics)
+ test_basics
+ test_setup_fail)
foreach(_CMOCKA_TEST ${CMOCKA_TESTS})
add_cmocka_test(${_CMOCKA_TEST} ${_CMOCKA_TEST}.c ${CMOCKA_SHARED_LIBRARY})
@@ -34,3 +35,42 @@ set_tests_properties(
PASS_REGULAR_EXPRESSION
"Test failed with exception: (Segmentation fault|Segmentation Fault|11)"
)
+
+set_tests_properties(
+ test_setup_fail
+ PROPERTIES
+ WILL_FAIL
+ 1
+)
+
+add_test (test_setup_fail_1_failed test_setup_fail)
+set_tests_properties(
+ test_setup_fail_1_failed
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "\\[ FAILED \\] 1 test\\(s\\), listed below:"
+)
+
+add_test (test_setup_fail_1_passed test_setup_fail)
+set_tests_properties(
+ test_setup_fail_1_passed
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "\\[ PASSED \\] 1 test\\(s\\)."
+)
+
+add_test (test_setup_fail_match_failed test_setup_fail)
+set_tests_properties(
+ test_setup_fail_match_failed
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "\\[ FAILED \\] int_test_ignored_setup_fail"
+)
+
+add_test (test_setup_fail_match_passed test_setup_fail)
+set_tests_properties(
+ test_setup_fail_match_passed
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "\\[ OK \\] int_test_success"
+)