From 5ad5cb5a1b5642f40e3df158ff1979de8487dc10 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Fri, 19 Aug 2022 16:09:33 +0400 Subject: Signals for test environment --- source/test/programs/CMakeLists.txt | 10 ++++++++++ source/test/programs/signals.c | 18 ++++++++++++++++++ source/test/programs/too_many_tests.c | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 source/test/programs/signals.c (limited to 'source/test/programs') 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 + +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; -- cgit v1.2.3