tests/server/Makefile \
tests/libtest/Makefile \
tests/unit/Makefile \
+ tests/tunit/Makefile \
tests/http/config.ini \
tests/http/Makefile \
tests/http/clients/Makefile \
# added twice as then targets such as 'distclean' misbehave and try to
# do things twice in that subdir at times (and thus fails).
if BUILD_UNITTESTS
-BUILD_UNIT = unit
+BUILD_UNIT = unit tunit
DIST_UNIT =
else
BUILD_UNIT =
-DIST_UNIT = unit
+DIST_UNIT = unit tunit
endif
SUBDIRS = certs data server libtest http $(BUILD_UNIT)
checksrc:
(cd libtest && $(MAKE) checksrc)
(cd unit && $(MAKE) checksrc)
+ (cd tunit && $(MAKE) checksrc)
(cd server && $(MAKE) checksrc)
(cd http && $(MAKE) checksrc)
<name>
unit test for parse_cert_parameter()
</name>
+<tool>
+tool%TESTNUMBER
+</tool>
</client>
<verify>
<name>
Test Windows/MS-DOS filename sanitization
</name>
+<tool>
+tool%TESTNUMBER
+</tool>
</client>
</testcase>
$has_shared
$LIBDIR
$UNITDIR
+ $TUNITDIR
$SRVDIR
$listonly
$LOCKDIR
# each runner in multiprocess mode
our $LIBDIR=dirsepadd("./libtest/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
our $UNITDIR=dirsepadd("./unit/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
+our $TUNITDIR=dirsepadd("./tunit/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
our $SRVDIR=dirsepadd("./server/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
our $TESTDIR="$srcdir/data";
our $CURL=dirsepadd("../src/" . ($ENV{'CURL_DIRSUFFIX'} || '')) . "curl".exe_ext('TOOL'); # what curl binary to run on the tests
}
$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";
--- /dev/null
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# SPDX-License-Identifier: curl
+#
+###########################################################################
+
+# Get 'TOOLPROGS', '*_SOURCES', 'FIRSTFILES' 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"
+ DEPENDS
+ "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${FIRSTFILES}
+ "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
+ VERBATIM)
+
+ set(TOOLPROGS "units")
+ set(units_SOURCES "tool_bundle.c")
+endif()
+
+foreach(_target IN LISTS UNITPROGS)
+ set(_target_name "${_target}")
+ add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
+ add_dependencies(testdeps ${_target_name})
+ target_link_libraries(${_target_name} curltool curlu)
+ target_include_directories(${_target_name} PRIVATE
+ "${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
+ "${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
+ "${PROJECT_SOURCE_DIR}/src"
+ "${PROJECT_SOURCE_DIR}/tests/libtest"
+ )
+ set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
+ if(CURL_TEST_BUNDLES)
+ target_include_directories(${_target_name} PRIVATE "${PROJECT_SOURCE_DIR}/tests/tunit")
+ endif()
+ set_target_properties(${_target_name} PROPERTIES
+ OUTPUT_NAME "${_target}"
+ PROJECT_LABEL "Test unit ${_target}")
+endforeach()
--- /dev/null
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# SPDX-License-Identifier: curl
+#
+###########################################################################
+AUTOMAKE_OPTIONS = foreign nostdinc
+
+# Specify our include paths here, and do it relative to $(top_srcdir) and
+# $(top_builddir), to ensure that these paths which belong to the library
+# being currently built and tested are searched before the library which
+# might possibly already be installed in the system.
+#
+# $(top_srcdir)/include is for libcurl's external include files
+# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
+# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
+
+AM_CPPFLAGS = -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/tests/libtest \
+ -I$(top_srcdir)/tests/unit \
+ -I$(top_srcdir)/tests/tunit
+
+EXTRA_DIST = CMakeLists.txt README.md
+
+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 \
+ @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
+
+AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
+if DEBUGBUILD
+AM_CPPFLAGS += -DDEBUGBUILD
+endif
+if CURLDEBUG
+AM_CPPFLAGS += -DCURLDEBUG
+endif
+
+if BUILD_UNITTESTS
+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
+CLEANFILES = tool_bundle.c
+else
+# Makefile.inc provides neat definitions
+include Makefile.inc
+noinst_PROGRAMS = $(TOOLPROGS)
+endif
+else
+noinst_PROGRAMS =
+endif
+
+CHECKSRC = $(CS_$(V))
+CS_0 = @echo " RUN " $@;
+CS_1 =
+CS_ = $(CS_0)
+
+# ignore generated C files since they play by slightly different rules!
+checksrc:
+ $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
+ -W$(srcdir)/tool_bundle.c \
+ $(srcdir)/*.[ch])
--- /dev/null
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# SPDX-License-Identifier: curl
+#
+###########################################################################
+
+# these files are used in every single unit test program
+
+FIRSTFILES = ../libtest/first.c
+
+TOOLFILES = $(FIRSTFILES)
+
+# These are all tool unit test programs
+TOOLPROGS = tool1394 tool1604
+
+tool1394_SOURCES = tool1394.c $(TOOLFILES)
+
+tool1604_SOURCES = tool1604.c $(TOOLFILES)
--- /dev/null
+<!--
+Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+
+SPDX-License-Identifier: curl
+-->
+
+# Tool unit tests
+
+This directory is for unit testing of tool functions. They are separate from
+libcurl unit tests, because how these live/work outside of the library and the
+libcurl unit tests live/work *inside*.
# These are all unit test programs
UNITPROGS = unit1300 unit1302 unit1303 unit1304 unit1305 unit1307 \
unit1309 unit1323 \
- unit1330 unit1394 unit1395 unit1396 unit1397 unit1398 \
+ unit1330 unit1395 unit1396 unit1397 unit1398 \
unit1399 \
- unit1600 unit1601 unit1602 unit1603 unit1604 unit1605 unit1606 unit1607 \
+ unit1600 unit1601 unit1602 unit1603 unit1605 unit1606 unit1607 \
unit1608 unit1609 unit1610 unit1611 unit1612 unit1614 unit1615 unit1616 \
unit1620 unit1621 \
unit1650 unit1651 unit1652 unit1653 unit1654 unit1655 unit1656 unit1657 \
unit1330_SOURCES = unit1330.c $(UNITFILES)
-unit1394_SOURCES = unit1394.c $(UNITFILES)
-
unit1395_SOURCES = unit1395.c $(UNITFILES)
unit1396_SOURCES = unit1396.c $(UNITFILES)
unit1603_SOURCES = unit1603.c $(UNITFILES)
-unit1604_SOURCES = unit1604.c $(UNITFILES)
-
unit1605_SOURCES = unit1605.c $(UNITFILES)
unit1606_SOURCES = unit1606.c $(UNITFILES)