xref: /curl/tests/CMakeLists.txt (revision 7c8efbfd)
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23###########################################################################
24set(CMAKE_UNITY_BUILD OFF)
25
26add_custom_target(testdeps)
27add_subdirectory(data)
28add_subdirectory(libtest)
29add_subdirectory(server)
30add_subdirectory(unit)
31
32function(add_runtests targetname test_flags)
33  # Use a special '$TFLAGS' placeholder as last argument which will be
34  # replaced by the contents of the environment variable in runtests.pl.
35  # This is a workaround for CMake's limitation where commands executed by
36  # 'make' or 'ninja' cannot portably reference environment variables.
37  string(REPLACE " " ";" test_flags_list "${test_flags}")
38  add_custom_target(${targetname}
39    COMMAND
40      "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
41      ${test_flags_list}
42      "\$TFLAGS"
43    DEPENDS testdeps
44    VERBATIM USES_TERMINAL
45  )
46endfunction()
47
48add_runtests(test-quiet     "-a -s")
49add_runtests(test-am        "-a -am")
50add_runtests(test-full      "-a -p -r")
51# ~flaky means that it'll ignore results of tests using the flaky keyword
52add_runtests(test-nonflaky  "-a -p ~flaky ~timing-dependent")
53add_runtests(test-ci        "-a -p ~flaky ~timing-dependent -r -rm")
54add_runtests(test-torture   "-a -t")
55add_runtests(test-event     "-a -e")
56