5 ${CMAKE_CURRENT_SOURCE_DIR}
6 ${CMAKE_SOURCE_DIR}/include
15 test_assert_macros_fail
16 test_exception_handler
21 foreach(_CMOCKA_TEST ${CMOCKA_TESTS})
22 add_cmocka_test(${_CMOCKA_TEST} ${_CMOCKA_TEST}.c ${CMOCKA_STATIC_LIBRARY})
26 if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
27 set_source_files_properties(test_cmockery.c PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations")
29 add_cmocka_test(test_cmockery test_cmockery.c ${CMOCKA_STATIC_LIBRARY})
33 # test_assert_macros_fail
37 PASS_REGULAR_EXPRESSION
38 "\\[ SKIPPED \\] test_check_skip"
41 # test_assert_macros_fail
43 test_assert_macros_fail
45 PASS_REGULAR_EXPRESSION
46 "\\[ FAILED \\] 1 test"
49 # test_exception_handler
52 test_exception_handler
54 PASS_REGULAR_EXPRESSION
55 "EXCEPTION_ACCESS_VIOLATION occurred at")
58 test_exception_handler
60 PASS_REGULAR_EXPRESSION
61 "Test failed with exception: (Segmentation fault|Segmentation Fault|11)"
79 add_test (test_setup_fail_1_failed test_setup_fail)
81 test_setup_fail_1_failed
83 PASS_REGULAR_EXPRESSION
84 "\\[ ERROR \\] int_test_ignored"
87 add_test (test_setup_fail_1_passed test_setup_fail)
89 test_setup_fail_1_passed
91 PASS_REGULAR_EXPRESSION
92 "\\[ PASSED \\] 1 test\\(s\\)."
95 add_test (test_setup_fail_match_failed test_setup_fail)
97 test_setup_fail_match_failed
99 PASS_REGULAR_EXPRESSION
100 "\\[ ERROR \\] int_test_ignored"
103 add_test (test_setup_fail_match_passed test_setup_fail)
104 set_tests_properties(
105 test_setup_fail_match_passed
107 PASS_REGULAR_EXPRESSION
108 "\\[ OK \\] int_test_success"
113 # test output of success, failure, skip, fixture failure
116 test_assert_macros_fail
125 set(test_basics_tap_out
126 "^\t1\\.\\.2[ \n\r]+\tok 1 - null_test_success[ \n\r]+\tok 2 - int_test_success[ \n\r]+ok - tests")
127 set(test_assert_macros_fail_tap_out
128 "^\t1\\.\\.1[ \n\r]+\tnot ok 1 - test_assert_return_code_fail[ \n\r]+\t#[^\n\r]+[\n\r]\t#[^\n\r]+[\n\r]not ok - tests")
130 set(test_skip_tap_out
132 set(test_setup_fail_tap_out
133 "not ok 1 - int_test_ignored Could not run the test - check test fixtures")
135 set(test_basics_subunit_out
136 "^test: null_test_success[ \n\r]+success: null_test_success")
137 set(test_assert_macros_fail_subunit_out
138 "failure: test_assert_return_code_fail \\[")
139 set(test_skip_subunit_out
140 "^test: test_check_skip[ \n\r]+skip: test_check_skip")
141 set(test_setup_fail_subunit_out
142 "error: int_test_ignored \\[ Could not run the test - check test fixtures \\]")
144 set(test_basics_xml_out
145 "<testsuite name=\"tests\" time=\"[0-9.]+\" tests=\"2\" failures=\"0\" errors=\"0\" skipped=\"0\" >[ \n\r]+<testcase name=\"null_test_success\" time=\"[0-9.]+\" >.*</testcase>")
146 set(test_assert_macros_fail_xml_out
147 "<testcase name=\"test_assert_return_code_fail\" time=\"[0-9.]+\" >[ \n\r]+<failure>")
148 set(test_skip_xml_out
149 "<testcase name=\"test_check_skip\" time=\"[0-9.]+\" >[ \n\r]+<skipped/>")
150 set(test_setup_fail_xml_out
151 "<testcase name=\"int_test_ignored\" time=\"[0-9.]+\" >[ \n\r]+<failure><!\\[CDATA\\[Test setup failed\\]\\]></failure>")
153 foreach(_TEST_OUTPUT_FMT ${TEST_OUTPUT_FMTS})
154 foreach(_OUTPUT_TEST ${OUTPUT_TESTS})
155 set(TEST_NAME ${_OUTPUT_TEST}_${_TEST_OUTPUT_FMT})
156 add_test(${TEST_NAME} ${_OUTPUT_TEST})
162 ENVIRONMENT CMOCKA_MESSAGE_OUTPUT=${_TEST_OUTPUT_FMT}
165 set_tests_properties(
168 PASS_REGULAR_EXPRESSION