summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-20 20:54:43 +0000
committerpeter <peter@pmikkelsen.com>2026-08-20 20:54:43 +0000
commit86feda786f115cb4468957f00b8968b986ed7c54 (patch)
tree31228cf73674178764cd6376d483e76212181707 /CMakeLists.txt
parentf5d445afa10ed7ba03b0ea9a5274f11904220700 (diff)
Get full coverage of aplwc-repl.
This required wrapping malloc so that it can fail under our control. FossilOrigin-Name: a27ccb5f02994393a518419bae15fd26ff0016c734d96350ae2137a1d3c0937c
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0e8af0..18aaeb1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,8 @@ target_link_libraries(aplwc PRIVATE common)
add_executable(aplwc-repl
src/bin/main.c
+ src/bin/util.c
+ src/bin/wrappers.c
)
target_link_libraries(aplwc-repl PRIVATE common aplwc)
@@ -67,4 +69,34 @@ foreach(source ${TEST_SOURCES})
add_test(NAME "${name}" COMMAND "${test_bin}")
endforeach()
+add_test(NAME "aplwc-repl-tiny" COMMAND "aplwc-repl")
+set_tests_properties("aplwc-repl-tiny" PROPERTIES
+ ENVIRONMENT "APLWC_MEM=16"
+ WILL_FAIL TRUE
+)
+
+add_test(NAME "aplwc-repl-emptyvar" COMMAND "aplwc-repl")
+set_tests_properties("aplwc-repl-emptyvar" PROPERTIES
+ ENVIRONMENT "APLWC_MEM="
+)
+
+add_test(NAME "aplwc-repl-badvar" COMMAND "aplwc-repl")
+set_tests_properties("aplwc-repl-badvar" PROPERTIES
+ ENVIRONMENT "APLWC_MEM=1M"
+)
+
add_test(NAME "aplwc-repl" COMMAND "aplwc-repl")
+
+set(REQUIRED_MALLOCS 1)
+foreach(i RANGE 0 ${REQUIRED_MALLOCS})
+ set(name "aplwc-repl-${i}-${REQUIRED_MALLOCS}")
+ add_test(NAME "${name}" COMMAND "aplwc-repl")
+ set_tests_properties("${name}" PROPERTIES
+ ENVIRONMENT "APLWC_MALLOC_FAIL_AFTER=${i}"
+ )
+ if(NOT i EQUAL ${REQUIRED_MALLOCS} AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+ set_tests_properties("${name}" PROPERTIES
+ WILL_FAIL TRUE
+ )
+ endif()
+endforeach()