From: Viktor Szakats Date: Mon, 14 Apr 2025 12:11:49 +0000 (+0200) Subject: tests: fixup tunit tests for cmake X-Git-Tag: curl-8_14_0~306 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d0e19a64d8766a7c86388cf1a9235bbe1f728a4;p=thirdparty%2Fcurl.git tests: fixup tunit tests for cmake Follow-up to 461ebbd336280ff843ec7971775e15f35134647d #16983 Closes #17051 --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c598132b6d..12ed61275f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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) diff --git a/tests/runner.pm b/tests/runner.pm index 8b7ab19baf..bea6de709a 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -924,17 +924,17 @@ sub singletest_run { } $CMDLINE=$LIBDIR . $tool; } - elsif($tool =~ /^unit/) { + elsif($tool =~ /^tool/) { if($bundle) { - $tool = "units" . exe_ext('TOOL') + $tool = "tunits" . exe_ext('TOOL') } - $CMDLINE=$UNITDIR . $tool; + $CMDLINE=$TUNITDIR . $tool; } - elsif($tool =~ /^tool/) { + elsif($tool =~ /^unit/) { if($bundle) { $tool = "units" . exe_ext('TOOL') } - $CMDLINE=$TUNITDIR . $tool; + $CMDLINE=$UNITDIR . $tool; } if(! -f $CMDLINE) { diff --git a/tests/runtests.pl b/tests/runtests.pl index 7d9d6440e7..7ba2eb4284 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -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 diff --git a/tests/tunit/.gitignore b/tests/tunit/.gitignore index 7f5578093a..f1cc07bf68 100644 --- a/tests/tunit/.gitignore +++ b/tests/tunit/.gitignore @@ -4,4 +4,4 @@ /tool[0-9][0-9][0-9][0-9] tool_bundle.c -units +tunits diff --git a/tests/tunit/CMakeLists.txt b/tests/tunit/CMakeLists.txt index 0164b2531e..2959615a9a 100644 --- a/tests/tunit/CMakeLists.txt +++ b/tests/tunit/CMakeLists.txt @@ -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() diff --git a/tests/tunit/Makefile.am b/tests/tunit/Makefile.am index 21d7744fe6..d910daa8d8 100644 --- a/tests/tunit/Makefile.am +++ b/tests/tunit/Makefile.am @@ -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