From: Daniel Stenberg Date: Tue, 6 May 2025 13:03:46 +0000 (+0200) Subject: tests: separate tunit tests from unit tests more X-Git-Tag: curl-8_14_0~152 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=220eda34cdfdcc4316845d2e2bbe5bd8b10305e0;p=thirdparty%2Fcurl.git tests: separate tunit tests from unit tests more - unit tests need no tool code as they are libcurl unit tests - unit test 1621 is now tunit test 1621 instead, as it tests tool code - build unit tests with BUILDING_LIBCURL as they pretent to be libcurl Closes #17259 --- diff --git a/tests/data/test1621 b/tests/data/test1621 index 953440f29e..cfd6ccbd9d 100644 --- a/tests/data/test1621 +++ b/tests/data/test1621 @@ -19,5 +19,8 @@ https unit tests for stripcredentials from URL + +tool%TESTNUMBER + diff --git a/tests/tunit/Makefile.inc b/tests/tunit/Makefile.inc index c28a16c42e..55dd1644a8 100644 --- a/tests/tunit/Makefile.inc +++ b/tests/tunit/Makefile.inc @@ -29,8 +29,10 @@ FIRSTFILES = ../libtest/first.c TOOLFILES = $(FIRSTFILES) # These are all tool unit test programs -TOOLPROGS = tool1394 tool1604 +TOOLPROGS = tool1394 tool1604 tool1621 tool1394_SOURCES = tool1394.c $(TOOLFILES) tool1604_SOURCES = tool1604.c $(TOOLFILES) + +tool1621_SOURCES = tool1621.c $(TOOLFILES) diff --git a/tests/unit/unit1621.c b/tests/tunit/tool1621.c similarity index 100% rename from tests/unit/unit1621.c rename to tests/tunit/tool1621.c diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 10eafec591..3e4c0de68b 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -39,6 +39,9 @@ if(CURL_TEST_BUNDLES) set(units_SOURCES "unit_bundle.c") endif() +# unit tests are small pretend-libcurl-programs +list(APPEND CURL_DEBUG_MACROS "BUILDING_LIBCURL") + foreach(_target IN LISTS UNITPROGS) set(_target_name "${_target}") add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES}) diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 3b4495c49e..006722d770 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -46,11 +46,10 @@ CFLAGS += @CURL_CFLAG_EXTRAS@ # Prevent LIBS from being used for all link targets LIBS = $(BLANK_AT_MAKETIME) -LDADD = $(top_builddir)/src/libcurltool.la \ - $(top_builddir)/lib/libcurlu.la \ +LDADD = $(top_builddir)/lib/libcurlu.la \ @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@ -AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS +AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS -DBUILDING_LIBCURL if DEBUGBUILD AM_CPPFLAGS += -DDEBUGBUILD endif diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc index 7d9f91df2c..b44b1c5589 100644 --- a/tests/unit/Makefile.inc +++ b/tests/unit/Makefile.inc @@ -37,7 +37,7 @@ UNITPROGS = unit1300 unit1302 unit1303 unit1304 unit1305 unit1307 \ unit1399 \ unit1600 unit1601 unit1602 unit1603 unit1605 unit1606 unit1607 \ unit1608 unit1609 unit1610 unit1611 unit1612 unit1614 unit1615 unit1616 \ - unit1620 unit1621 \ + unit1620 \ unit1650 unit1651 unit1652 unit1653 unit1654 unit1655 unit1656 unit1657 \ unit1658 \ unit1660 unit1661 unit1663 unit1664 \ @@ -106,8 +106,6 @@ unit1616_SOURCES = unit1616.c $(UNITFILES) unit1620_SOURCES = unit1620.c $(UNITFILES) -unit1621_SOURCES = unit1621.c $(UNITFILES) - unit1650_SOURCES = unit1650.c $(UNITFILES) unit1651_SOURCES = unit1651.c $(UNITFILES) diff --git a/tests/unit/unit3200.c b/tests/unit/unit3200.c index 30d6281c4f..674e1fa3dd 100644 --- a/tests/unit/unit3200.c +++ b/tests/unit/unit3200.c @@ -22,8 +22,6 @@ * ***************************************************************************/ #include "curlcheck.h" -/* disable the curlx_get_line redefinitions for this unit test */ -#define BUILDING_LIBCURL #include "curl_get_line.h" #include "memdebug.h"