mirror of
https://github.com/curl/curl.git
synced 2026-04-15 01:11:40 +03:00
cmake: replace internal option with a new testbins target
To allow building test binaries without test certs, replacing `_CURL_SKIP_BUILD_CERTS` internal option with a build target that is similar to `testdeps`, but without building the test certificates. To make building test binaries a little bit faster, with less noisy output, and without having to reconfigure the build. Closes #20708
This commit is contained in:
parent
3137f725cd
commit
aae361242f
7 changed files with 16 additions and 14 deletions
|
|
@ -552,9 +552,10 @@ Note: These variables are internal and subject to change.
|
|||
|
||||
## Useful build targets
|
||||
|
||||
- `testdeps`: Build test dependencies (servers, tools, test certificates).
|
||||
- `testbins`: Build test binaries (servers, tools).
|
||||
Individual targets: `curlinfo`, `libtests`, `servers`, `tunits`, `units`
|
||||
Test certificates: `build-certs`, `clean-certs`
|
||||
- `testdeps`: Build test dependencies (test binaries, test certificates).
|
||||
Test certificates: `build-certs` (clean with `clean-certs`)
|
||||
- `tests`: Run tests (`runtests.pl`). Customize via the `TFLAGS` environment variable, e.g. `TFLAGS=1621`.
|
||||
Other flavors: `test-am`, `test-ci`, `test-event`, `test-full`, `test-nonflaky`, `test-quiet`, `test-torture`
|
||||
- `curl-pytest`: Run tests (pytest).
|
||||
|
|
|
|||
|
|
@ -29,14 +29,17 @@ mark_as_advanced(TEST_NGHTTPX)
|
|||
# Consumed variables: TEST_NGHTTPX
|
||||
configure_file("config.in" "${CMAKE_CURRENT_BINARY_DIR}/config" @ONLY)
|
||||
|
||||
add_custom_target(testdeps)
|
||||
add_custom_target(testbins)
|
||||
if(BUILD_CURL_EXE)
|
||||
add_dependencies(testdeps "curlinfo")
|
||||
add_dependencies(testbins "curlinfo")
|
||||
endif()
|
||||
if(CURL_BUILD_EVERYTHING)
|
||||
set_target_properties(testdeps PROPERTIES EXCLUDE_FROM_ALL FALSE)
|
||||
set_target_properties(testbins PROPERTIES EXCLUDE_FROM_ALL FALSE)
|
||||
endif()
|
||||
|
||||
add_custom_target(testdeps)
|
||||
add_dependencies(testdeps "testbins")
|
||||
|
||||
if(CURL_CLANG_TIDY)
|
||||
add_custom_target(tests-clang-tidy)
|
||||
add_dependencies(testdeps tests-clang-tidy)
|
||||
|
|
@ -63,6 +66,7 @@ function(curl_add_runtests _targetname _test_flags)
|
|||
list(APPEND _depends "${EXE_NAME}")
|
||||
endif()
|
||||
list(APPEND _depends "testdeps")
|
||||
list(APPEND _depends "build-certs")
|
||||
endif()
|
||||
set(_setenvs "")
|
||||
if(CMAKE_CONFIGURATION_TYPES)
|
||||
|
|
@ -100,6 +104,7 @@ function(curl_add_pytests _targetname _test_flags)
|
|||
list(APPEND _depends "${EXE_NAME}" "curlinfo")
|
||||
endif()
|
||||
list(APPEND _depends "libtests")
|
||||
list(APPEND _depends "build-certs")
|
||||
endif()
|
||||
string(REPLACE " " ";" _test_flags_list "${_test_flags}")
|
||||
add_custom_target(${_targetname}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,7 @@ add_custom_command(OUTPUT ${GENERATEDCERTS}
|
|||
VERBATIM
|
||||
)
|
||||
add_custom_target(build-certs DEPENDS ${GENERATEDCERTS})
|
||||
|
||||
option(_CURL_SKIP_BUILD_CERTS "Skip building certs with testdeps" OFF) # Internal option to increase perf for build tests
|
||||
if(NOT _CURL_SKIP_BUILD_CERTS)
|
||||
add_dependencies(testdeps build-certs)
|
||||
endif()
|
||||
add_dependencies(testdeps build-certs)
|
||||
|
||||
add_custom_target(clean-certs
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${GENERATEDCERTS}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ add_custom_command(OUTPUT "${BUNDLE}.c"
|
|||
VERBATIM)
|
||||
|
||||
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
|
||||
add_dependencies(testdeps ${BUNDLE})
|
||||
add_dependencies(testbins ${BUNDLE})
|
||||
target_link_libraries(${BUNDLE} ${LIB_SELECTED} ${CURL_LIBS})
|
||||
target_include_directories(${BUNDLE} PRIVATE
|
||||
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ add_custom_command(OUTPUT "${BUNDLE}.c"
|
|||
VERBATIM)
|
||||
|
||||
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
|
||||
add_dependencies(testdeps ${BUNDLE})
|
||||
add_dependencies(testbins ${BUNDLE})
|
||||
target_link_libraries(${BUNDLE} ${CURL_NETWORK_AND_TIME_LIBS})
|
||||
target_include_directories(${BUNDLE} PRIVATE
|
||||
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ add_custom_command(OUTPUT "${BUNDLE}.c"
|
|||
VERBATIM)
|
||||
|
||||
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
|
||||
add_dependencies(testdeps ${BUNDLE})
|
||||
add_dependencies(testbins ${BUNDLE})
|
||||
target_link_libraries(${BUNDLE} curltool ${LIB_SELECTED})
|
||||
target_include_directories(${BUNDLE} PRIVATE
|
||||
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ add_custom_command(OUTPUT "${BUNDLE}.c"
|
|||
|
||||
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE}.c")
|
||||
add_dependencies(${BUNDLE} curlu-unitprotos)
|
||||
add_dependencies(testdeps ${BUNDLE})
|
||||
add_dependencies(testbins ${BUNDLE})
|
||||
target_link_libraries(${BUNDLE} curlu)
|
||||
target_include_directories(${BUNDLE} PRIVATE
|
||||
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h", "unitprotos.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue