diff options
author | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-19 16:09:33 +0400 |
---|---|---|
committer | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-19 16:09:33 +0400 |
commit | 5ad5cb5a1b5642f40e3df158ff1979de8487dc10 (patch) | |
tree | 0be28d04e4af7a7cec160a79bfc80d3b2a23712e /source/test/programs | |
parent | 45459652d69f053ec5690a8a7734054c652934d3 (diff) | |
download | kit-5ad5cb5a1b5642f40e3df158ff1979de8487dc10.zip |
Signals for test environment
Diffstat (limited to 'source/test/programs')
-rw-r--r-- | source/test/programs/CMakeLists.txt | 10 | ||||
-rw-r--r-- | source/test/programs/signals.c | 18 | ||||
-rw-r--r-- | source/test/programs/too_many_tests.c | 2 |
3 files changed, 29 insertions, 1 deletions
diff --git a/source/test/programs/CMakeLists.txt b/source/test/programs/CMakeLists.txt index 24932bd..9c58599 100644 --- a/source/test/programs/CMakeLists.txt +++ b/source/test/programs/CMakeLists.txt @@ -28,4 +28,14 @@ if(KIT_ENABLE_TESTING) cpp_example_test PROPERTIES TIMEOUT "30") + + add_executable(signals signals.c) + target_link_libraries(signals ${KIT_TEST_LIBRARY}) + add_test( + NAME signals_test + COMMAND signals) + set_tests_properties( + signals_test + PROPERTIES + TIMEOUT "30") endif() diff --git a/source/test/programs/signals.c b/source/test/programs/signals.c new file mode 100644 index 0000000..935623a --- /dev/null +++ b/source/test/programs/signals.c @@ -0,0 +1,18 @@ +#include "../../kit_test/test.h" + +#include <stdlib.h> + +TEST("abort") { + abort(); +} + +TEST("invalid access") { + *(volatile int *) NULL = 42; +} + +int main(int argc, char **argv) { + if (run_tests(argc, argv) != 1) + return 1; + + return 0; +} diff --git a/source/test/programs/too_many_tests.c b/source/test/programs/too_many_tests.c index 9893e84..bc7b543 100644 --- a/source/test/programs/too_many_tests.c +++ b/source/test/programs/too_many_tests.c @@ -4,7 +4,7 @@ void bar(int index, kit_test_report_fn report) { } int main(int argc, char **argv) { for (int i = 0; i <= KIT_TESTS_SIZE_LIMIT; i++) - test_register("foo", bar); + test_register("foo", __FILE__, bar); if (run_tests(argc, argv) != 1) return 1; |