tests: fixup tunit tests for cmake

Follow-up to 461ebbd336 #16983

Closes #17051
This commit is contained in:
Viktor Szakats 2025-04-14 14:11:49 +02:00
parent e86542038d
commit 1d0e19a64d
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 19 additions and 17 deletions

View file

@ -34,6 +34,7 @@ add_subdirectory(http)
add_subdirectory(http/clients)
add_subdirectory(server)
add_subdirectory(libtest)
add_subdirectory(tunit)
add_subdirectory(unit)
add_subdirectory(certs)

View file

@ -924,18 +924,18 @@ sub singletest_run {
}
$CMDLINE=$LIBDIR . $tool;
}
elsif($tool =~ /^tool/) {
if($bundle) {
$tool = "tunits" . exe_ext('TOOL')
}
$CMDLINE=$TUNITDIR . $tool;
}
elsif($tool =~ /^unit/) {
if($bundle) {
$tool = "units" . exe_ext('TOOL')
}
$CMDLINE=$UNITDIR . $tool;
}
elsif($tool =~ /^tool/) {
if($bundle) {
$tool = "units" . exe_ext('TOOL')
}
$CMDLINE=$TUNITDIR . $tool;
}
if(! -f $CMDLINE) {
logmsg " $testnum: IGNORED: The tool set in the test case for this: '$tool' does not exist\n";

View file

@ -2518,7 +2518,7 @@ EOHELP
}
# Detect a test bundle build.
# Do not look for 'units' because not all configurations build it.
# Do not look for 'tunits' and 'units' because not all configurations build them.
if(-e $LIBDIR . "libtests" . exe_ext('TOOL') &&
-e $SRVDIR . "servers" . exe_ext('SRV')) {
# use test bundles

View file

@ -4,4 +4,4 @@
/tool[0-9][0-9][0-9][0-9]
tool_bundle.c
units
tunits

View file

@ -22,24 +22,24 @@
#
###########################################################################
# Get 'TOOLPROGS', '*_SOURCES', 'FIRSTFILES' variables
# Get 'TOOLPROGS', '*_SOURCES', 'TOOLFILES' variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
if(CURL_TEST_BUNDLES)
add_custom_command(
OUTPUT "tool_bundle.c"
COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" "${CMAKE_CURRENT_SOURCE_DIR}" > "unit_bundle.c"
COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" "${CMAKE_CURRENT_SOURCE_DIR}" > "tool_bundle.c"
DEPENDS
"${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${FIRSTFILES}
"${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${TOOLFILES}
"${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
VERBATIM)
set(TOOLPROGS "units")
set(units_SOURCES "tool_bundle.c")
set(TOOLPROGS "tunits")
set(tunits_SOURCES "tool_bundle.c")
endif()
foreach(_target IN LISTS UNITPROGS)
foreach(_target IN LISTS TOOLPROGS)
set(_target_name "${_target}")
add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
add_dependencies(testdeps ${_target_name})
@ -49,6 +49,7 @@ foreach(_target IN LISTS UNITPROGS)
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/tests/libtest"
"${PROJECT_SOURCE_DIR}/tests/unit" # for curlcheck.h
)
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
if(CURL_TEST_BUNDLES)
@ -56,5 +57,5 @@ foreach(_target IN LISTS UNITPROGS)
endif()
set_target_properties(${_target_name} PROPERTIES
OUTPUT_NAME "${_target}"
PROJECT_LABEL "Test unit ${_target}")
PROJECT_LABEL "Test tunit ${_target}")
endforeach()

View file

@ -64,8 +64,8 @@ if USE_TEST_BUNDLES
tool_bundle.c: $(top_srcdir)/tests/mk-bundle.pl Makefile.inc
@PERL@ $(top_srcdir)/tests/mk-bundle.pl $(srcdir) > tool_bundle.c
noinst_PROGRAMS = units
nodist_units_SOURCES = tool_bundle.c
noinst_PROGRAMS = tunits
nodist_tunits_SOURCES = tool_bundle.c
CLEANFILES = tool_bundle.c
else
# Makefile.inc provides neat definitions