aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index caba3c86a..60ce5c262 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -24,3 +24,28 @@ add_subdirectory(data)
add_subdirectory(libtest)
add_subdirectory(server)
add_subdirectory(unit)
+
+function(add_runtests targetname test_flags)
+ # Use a special '${TFLAGS}' placeholder as last argument which will be
+ # replaced by the contents of the environment variable in runtests.pl.
+ # This is a workaround for CMake's limitation where commands executed by
+ # 'make' or 'ninja' cannot portably reference environment variables.
+ string(REPLACE " " ";" test_flags_list "${test_flags}")
+ add_custom_target(${targetname}
+ COMMAND
+ "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
+ ${test_flags_list}
+ "\${TFLAGS}"
+ DEPENDS testdeps
+ VERBATIM USES_TERMINAL
+ )
+endfunction()
+
+add_runtests(test "")
+add_runtests(test-quiet "-a -s")
+add_runtests(test-am "-a -am")
+add_runtests(test-full "-a -p -r")
+# !flaky means that it'll skip all tests using the flaky keyword
+add_runtests(test-nonflaky "-a -p !flaky")
+add_runtests(test-torture "-a -t")
+add_runtests(test-event "-a -e")