Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/tests/CMakeLists.txt
2066 views
1
#***************************************************************************
2
# _ _ ____ _
3
# Project ___| | | | _ \| |
4
# / __| | | | |_) | |
5
# | (__| |_| | _ <| |___
6
# \___|\___/|_| \_\_____|
7
#
8
# Copyright (C) Daniel Stenberg, <[email protected]>, 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
###########################################################################
24
find_program(TEST_NGHTTPX "nghttpx")
25
if(NOT TEST_NGHTTPX)
26
set(TEST_NGHTTPX "")
27
endif()
28
mark_as_advanced(TEST_NGHTTPX)
29
# Consumed variables: TEST_NGHTTPX
30
configure_file("config.in" "${CMAKE_CURRENT_BINARY_DIR}/config" @ONLY)
31
32
add_custom_target(testdeps)
33
if(BUILD_CURL_EXE)
34
add_dependencies(testdeps curlinfo)
35
endif()
36
37
add_subdirectory(http)
38
add_subdirectory(http/clients)
39
add_subdirectory(server)
40
add_subdirectory(libtest)
41
add_subdirectory(tunit)
42
add_subdirectory(unit)
43
add_subdirectory(certs)
44
45
function(curl_add_runtests _targetname _test_flags)
46
if(NOT BUILD_LIBCURL_DOCS)
47
string(APPEND _test_flags " !documentation")
48
endif()
49
set(_depends "")
50
# Skip walking through dependent targets before running tests in CI.
51
# This avoids: GNU Make doing a slow re-evaluation of all targets and
52
# skipping them, MSBuild doing a re-evaluation, and actually rebuilding them.
53
if(NOT _targetname STREQUAL "test-ci")
54
set(_depends "testdeps")
55
endif()
56
# Use a special '$TFLAGS' placeholder as last argument which will be
57
# replaced by the contents of the environment variable in runtests.pl.
58
# This is a workaround for CMake's limitation where commands executed by
59
# 'make' or 'ninja' cannot portably reference environment variables.
60
string(REPLACE " " ";" _test_flags_list "${_test_flags}")
61
add_custom_target(${_targetname}
62
COMMAND
63
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
64
${_test_flags_list}
65
"\$TFLAGS"
66
DEPENDS "${_depends}"
67
VERBATIM USES_TERMINAL
68
)
69
endfunction()
70
71
function(curl_add_pytests _targetname _test_flags)
72
set(_depends "")
73
if(NOT _targetname STREQUAL "pytest-ci")
74
set(_depends "test-http-clients")
75
endif()
76
string(REPLACE " " ";" _test_flags_list "${_test_flags}")
77
add_custom_target(${_targetname}
78
COMMAND pytest ${_test_flags_list} "${CMAKE_CURRENT_SOURCE_DIR}/http"
79
DEPENDS "${_depends}"
80
VERBATIM USES_TERMINAL
81
)
82
endfunction()
83
84
# Create configurehelp.pm, used by tests needing to run the C preprocessor.
85
if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
86
set(CURL_CPP "\"${CMAKE_C_COMPILER}\" -E")
87
if(APPLE AND CMAKE_OSX_SYSROOT)
88
string(APPEND CURL_CPP " -isysroot ${CMAKE_OSX_SYSROOT}")
89
endif()
90
# Add header directories, like autotools builds do.
91
get_property(_include_dirs TARGET ${LIB_SELECTED} PROPERTY INCLUDE_DIRECTORIES)
92
foreach(_include_dir IN LISTS _include_dirs)
93
string(APPEND CURL_CPP " -I${_include_dir}")
94
endforeach()
95
else()
96
set(CURL_CPP "cpp")
97
endif()
98
# Generate version script for the linker, for versioned symbols.
99
# Consumed variable:
100
# CURL_CPP
101
configure_file(
102
"${CMAKE_CURRENT_SOURCE_DIR}/configurehelp.pm.in"
103
"${CMAKE_CURRENT_BINARY_DIR}/configurehelp.pm" @ONLY)
104
105
curl_add_runtests(test-quiet "-a -s")
106
curl_add_runtests(test-am "-a -am")
107
curl_add_runtests(test-full "-a -p -r")
108
# ~flaky means that it ignores results of tests using the flaky keyword
109
curl_add_runtests(test-nonflaky "-a -p ~flaky ~timing-dependent")
110
curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r --retry=5 -j20")
111
curl_add_runtests(test-torture "-a -t -j20")
112
curl_add_runtests(test-event "-a -e")
113
114
curl_add_pytests(curl-pytest "-n auto")
115
curl_add_pytests(curl-pytest-ci "-n auto -v")
116
117