if [ "${MATRIX_BUILD}" = 'cmake' ]; then
cmake -B bld -G Ninja \
-DCMAKE_C_COMPILER_TARGET="$(uname -m)-pc-linux-gnu" -DBUILD_STATIC_LIBS=ON \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
${MATRIX_GENERATE}
else
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--disable-dependency-tracking \
${MATRIX_CONFIGURE}
fi
run: |
mkdir bld-1
cd bld-1
- cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \
+ cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \
-DENABLE_ARES=OFF -DCURL_ZSTD=OFF -DCURL_USE_GSSAPI=OFF -DCURL_USE_LIBSSH2=ON -DCURL_USE_LIBSSH=OFF -DUSE_LIBRTMP=ON
make install
src/curl --disable --version
run: |
mkdir bld-cares
cd bld-cares
- cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \
+ cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \
-DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=OFF -DUSE_LIBRTMP=ON \
-DCURL_LIBCURL_VERSIONED_SYMBOLS=ON
run: |
mkdir bld-am
cd bld-am
- ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ ../configure --disable-dependency-tracking --enable-unity --enable-warnings --enable-werror \
--with-openssl --enable-ares --with-libssh2 --with-zstd --with-gssapi --with-librtmp \
--prefix="$PWD"/../curl-install-am
cmake -B bld -G Ninja \
-DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
-DCMAKE_C_COMPILER_TARGET="$(uname -m)-pc-linux-gnu" -DBUILD_STATIC_LIBS=ON \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
${MATRIX_GENERATE}
else
mkdir bld && cd bld && \
${MATRIX_CONFIGURE_PREFIX} \
- ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ ../configure --enable-unity --enable-warnings --enable-werror \
--disable-dependency-tracking \
${MATRIX_CONFIGURE}
fi
[ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF'
cmake -B "bld${_chkprefill}" -G Ninja -D_CURL_PREFILL=ON \
-DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
${MATRIX_GENERATE} ${options}
fi
[ -n "${MATRIX_MACOS_VERSION_MIN}" ] && CFLAGS+=" -mmacosx-version-min=${MATRIX_MACOS_VERSION_MIN}"
[[ "${MATRIX_INSTALL_STEPS}" = *'pytest'* ]] && options+=' --with-test-vsftpd=no' # Skip ~20 tests that stretch run time by 7x on macOS
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--disable-dependency-tracking \
--with-libpsl=/opt/homebrew/opt/libpsl \
${MATRIX_CONFIGURE} ${options}
[ -n "${MATRIX_MACOS_VERSION_MIN}" ] && options+=" -DCMAKE_OSX_DEPLOYMENT_TARGET=${MATRIX_MACOS_VERSION_MIN}"
# would pick up nghttp2, libidn2, and libssh2
cmake -B bld -G Ninja -D_CURL_PREFILL=ON \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-DCMAKE_C_COMPILER_TARGET="$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
-DCMAKE_IGNORE_PREFIX_PATH="$(brew --prefix)" \
fi
[ -n "${MATRIX_MACOS_VERSION_MIN}" ] && CFLAGS+=" -mmacosx-version-min=${MATRIX_MACOS_VERSION_MIN}"
# would pick up nghttp2, libidn2, but libssh2 is disabled by default
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--disable-dependency-tracking \
--disable-docs --disable-manual \
--with-openssl="$(brew --prefix openssl)" \
time sudo pkgin -y install cmake ninja-build pkg-config perl brotli heimdal openldap-client libssh2 libidn2 libpsl nghttp2 py311-impacket
time cmake -B bld -G Ninja \
-DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
-DCURL_USE_OPENSSL=ON \
time sudo pkg_add cmake ninja brotli openldap-client-- libssh2 libidn2 libpsl nghttp2 py3-six py3-impacket
time cmake -B bld -G Ninja \
-DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
-DCURL_USE_OPENSSL=ON \
matrix:
include:
- { build: 'autotools', arch: 'x86_64', compiler: 'clang' }
- - { build: 'cmake' , arch: 'x86_64', compiler: 'clang', options: '-DCMAKE_UNITY_BUILD=OFF -DCURL_TEST_BUNDLES=OFF', desc: ' !unity !bundle !runtests !examples' }
+ - { build: 'cmake' , arch: 'x86_64', compiler: 'clang', options: '-DCMAKE_UNITY_BUILD=OFF', desc: ' !unity !runtests !examples' }
- { build: 'autotools', arch: 'arm64', compiler: 'clang' }
- { build: 'cmake' , arch: 'arm64', compiler: 'clang' }
fail-fast: false
time cmake -B bld -G Ninja \
-DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
-DCMAKE_C_COMPILER="${CC}" \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
-DCURL_USE_OPENSSL=ON \
options='--disable-manual --disable-docs' # Slow with autotools, skip on emulated CPU
fi
mkdir bld && cd bld
- time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
+ time ../configure --enable-unity --enable-debug --enable-warnings --enable-werror \
--prefix="$HOME"/curl-install \
--with-openssl \
--with-brotli --enable-ldap --enable-ldaps --with-libidn2 --with-libssh2 --with-nghttp2 --with-gssapi \
export CURL_CI=github
time autoreconf -fi
mkdir bld && cd bld
- time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
+ time ../configure --enable-unity --enable-debug --enable-warnings --enable-werror \
--prefix="$HOME"/curl-install \
--with-openssl \
--disable-dependency-tracking \
# https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-visionos-or-watchos
[ -n "${MATRIX_GENERATOR}" ] && options="-G ${MATRIX_GENERATOR}"
cmake -B bld -G Ninja -D_CURL_PREFILL=ON \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
-DCMAKE_SYSTEM_NAME=iOS \
-DUSE_APPLE_IDN=ON \
${MATRIX_GENERATE} ${options}
else
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--disable-dependency-tracking \
CFLAGS="-isysroot $(xcrun --sdk iphoneos --show-sdk-path 2>/dev/null)" \
--host=aarch64-apple-darwin \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM="android-${MATRIX_PLATFORM}" \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" -DCMAKE_WARN_DEPRECATED=OFF \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
${MATRIX_OPTIONS}
else
TOOLCHAIN="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
- mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-warnings --enable-werror \
CC="$TOOLCHAIN/bin/aarch64-linux-android${MATRIX_PLATFORM}-clang" \
AR="$TOOLCHAIN/bin/llvm-ar" \
RANLIB="$TOOLCHAIN/bin/llvm-ranlib" \
-DCMAKE_SYSTEM_PROCESSOR=x86 \
-DCMAKE_C_COMPILER_TARGET=i586-pc-msdosdjgpp \
-DCMAKE_C_COMPILER="$HOME/djgpp/bin/i586-pc-msdosdjgpp-gcc" \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DCURL_USE_LIBPSL=OFF \
-DOPENSSL_INCLUDE_DIR="$HOME/djgpp/include" \
-DWATT_ROOT="$HOME/djgpp/net/watt"
else
autoreconf -fi
- mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-warnings --enable-werror \
CC="$HOME/djgpp/bin/i586-pc-msdosdjgpp-gcc" \
AR="$HOME/djgpp/bin/i586-pc-msdosdjgpp-ar" \
RANLIB="$HOME/djgpp/bin/i586-pc-msdosdjgpp-ranlib" \
if [ "${MATRIX_BUILD}" = 'cmake' ]; then
cmake -B bld -G Ninja -D_CURL_PREFILL=ON ${options} \
-DCMAKE_INSTALL_PREFIX="$HOME"/curl-install \
- -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30 -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30 \
-DCURL_WERROR=ON \
${MATRIX_CONFIG}
else
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--prefix="$HOME"/curl-install \
--with-libssh2 \
--disable-dependency-tracking \
-DCMAKE_INSTALL_PREFIX="${HOME}"/curl-install \
-DCMAKE_C_FLAGS="${CFLAGS_CMAKE} ${CPPFLAGS}" \
-DCMAKE_BUILD_TYPE="${MATRIX_TYPE}" \
- -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30 -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30 \
-DCURL_WERROR=ON \
${MATRIX_CONFIG}
done
fi
else
export CFLAGS CPPFLAGS
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--prefix="$HOME"/curl-install \
--with-libssh2 \
--disable-dependency-tracking \
cmake -B "bld${_chkprefill}" -G Ninja ${options} \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_BUILD_TYPE="${MATRIX_TYPE}" \
- -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30 -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30 \
-DCURL_WERROR=ON \
-DUSE_LIBIDN2=OFF \
${MATRIX_CONFIG}
cmake -B bld -G Ninja \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER_TARGET="${TRIPLET}" \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DCURL_USE_SCHANNEL=ON -DUSE_WIN32_IDN=ON \
-DCURL_USE_LIBPSL=OFF \
${options}
else
- mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--host="${TRIPLET}" \
--with-schannel --with-winidn \
--without-libpsl \
-DCMAKE_RC_COMPILER=arm-mingw32ce-windres \
-DMINGW32CE_LIBRARY_DIR="$HOME/opt/mingw32ce/arm-mingw32ce/lib" \
-DCMAKE_IGNORE_PREFIX_PATH=/opt/homebrew \
- -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=50 -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=50 \
-DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_STATIC_CURL=OFF \
-DCURL_WERROR=ON \
-DCURL_USE_SCHANNEL=ON \
-DCURL_USE_LIBPSL=OFF
else
autoreconf -fi
- mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
+ mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-warnings --enable-werror \
--host=arm-mingw32ce \
--with-schannel \
--without-libpsl \
-DCMAKE_EXE_LINKER_FLAGS="-INCREMENTAL:NO ${ldflags}" \
-DCMAKE_SHARED_LINKER_FLAGS="-INCREMENTAL:NO ${ldflags}" \
-DCMAKE_VS_GLOBALS="TrackFileAccess=false${vsglobals}" \
- -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
+ -DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DLIBPSL_INCLUDE_DIR="${MINGW_PREFIX}/include" \
-DLIBPSL_LIBRARY="${MINGW_PREFIX}/lib/libpsl.dll.a" \
list(APPEND CURL_DEBUG_MACROS "CURLDEBUG")
endif()
-option(CURL_TEST_BUNDLES "Build tests into single-binary bundles" OFF)
-
option(CURL_CLANG_TIDY "Run the build through clang-tidy" OFF)
if(CURL_CLANG_TIDY)
# clang-tidy is not looking into #included sources, thus not compatible with
# unity builds and test bundles.
set(CMAKE_UNITY_BUILD OFF)
- set(CURL_TEST_BUNDLES OFF)
+ set(CURL_MK_UNITY_OPTION "--embed")
set(_tidy_checks "")
list(APPEND _tidy_checks "-clang-analyzer-security.insecureAPI.strcpy")
list(APPEND _tidy_checks "-clang-analyzer-optin.performance.Padding")
fi
# shellcheck disable=SC2086
time cmake -G "${PRJ_GEN}" ${TARGET} \
- -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DBUILD_SHARED_LIBS="${SHARED}" \
-DCURL_STATIC_CRT=ON \
AM_CONDITIONAL([USE_UNITY], [test "$want_unity" = 'yes'])
-dnl -----------------------
-dnl whether to bundle tests
-dnl -----------------------
-
-want_test_bundles='no'
-AC_MSG_CHECKING([whether to build tests into single-binary bundles])
-AC_ARG_ENABLE(test-bundles,
-AS_HELP_STRING([--enable-test-bundles],[Enable test bundles])
-AS_HELP_STRING([--disable-test-bundles],[Disable test bundles (default)]),
-[ case "$enableval" in
- yes)
- want_test_bundles='yes'
- AC_MSG_RESULT([yes])
- ;;
- *)
- AC_MSG_RESULT([no])
- ;;
- esac ],
- AC_MSG_RESULT([no])
-)
-
-AM_CONDITIONAL([USE_TEST_BUNDLES], [test "$want_test_bundles" = 'yes'])
-
dnl ************************************************************
dnl switch off particular protocols
dnl
- `CURL_LTO`: Enable compiler Link Time Optimizations. Default: `OFF`
- `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires UCRT, static libcurl or no curl executable). Default: `OFF`
- `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string.
-- `CURL_TEST_BUNDLES`: Build tests into single-binary bundles. Default: `OFF`
- `CURL_WERROR`: Turn compiler warnings into errors. Default: `OFF`
- `ENABLE_CURLDEBUG`: Enable TrackMemory debug feature. Default: =`ENABLE_DEBUG`
- `ENABLE_CURL_MANUAL`: Build the man page for curl and enable its `-M`/`--manual` option. Default: `ON`
# SPDX-License-Identifier: curl
#
###########################################################################
-# Get 'DPAGES' variable
+# Get SUPPORT, DPAGES variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
MANPAGE = curl.1
ASCIIPAGE = curl.txt
+# Get SUPPORT, DPAGES variables
include Makefile.inc
EXTRA_DIST = $(DPAGES) MANPAGE.md $(SUPPORT) CMakeLists.txt mainpage.idx
# SPDX-License-Identifier: curl
#
###########################################################################
-# Shared between Makefile.am and CMakeLists.txt
+# Shared between CMakeLists.txt and Makefile.am
SUPPORT = \
_AUTHORS.md \
add_custom_target(curl-examples)
-# Get 'check_PROGRAMS' variable
+# Get check_PROGRAMS variable
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
if(LIB_SELECTED STREQUAL LIB_STATIC AND WIN32)
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
- set_target_properties(${_target_name} PROPERTIES
- OUTPUT_NAME "${_target}" UNITY_BUILD OFF
- PROJECT_LABEL "Example ${_target}")
+ set_target_properties(${_target_name} PROPERTIES OUTPUT_NAME "${_target}" PROJECT_LABEL "Example ${_target}"
+ UNITY_BUILD OFF)
endforeach()
# This might hold -Werror
CFLAGS += @CURL_CFLAG_EXTRAS@
-# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
+# Get check_PROGRAMS variable
include Makefile.inc
all: $(check_PROGRAMS)
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
# These are all libcurl example programs to be test compiled
check_PROGRAMS = \
# SPDX-License-Identifier: curl
#
###########################################################################
-# Get 'man_MANS' variable
+# Get man_MANS variable
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
SUBDIRS = opts
if BUILD_DOCS
+# Get man_MANS variable
include Makefile.inc
CURLPAGES = $(man_MANS:.3=.md)
# SPDX-License-Identifier: curl
#
###########################################################################
-
-# Shared between Makefile.am and CMakeLists.txt
+# Shared between CMakeLists.txt and Makefile.am
man_MANS = \
curl_easy_cleanup.3 \
# SPDX-License-Identifier: curl
#
###########################################################################
-# Get 'man_MANS' variable
+# Get man_MANS variable
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
AUTOMAKE_OPTIONS = foreign no-dependencies
if BUILD_DOCS
+# Get man_MANS variable
include Makefile.inc
CURLPAGES = $(man_MANS:.3=.md)
# SPDX-License-Identifier: curl
#
###########################################################################
-# Shared between Makefile.am and CMakeLists.txt
+# Shared between CMakeLists.txt and Makefile.am
man_MANS = \
CURLINFO_ACTIVESOCKET.3 \
### test bundles
- The `--enable-test-bundles` (autotools) and `-DCURL_TEST_BUNDLES=ON` (cmake)
- build options allow to build tests bundled into single executables, one for
- libtests, one for unit tests and one for servers.
- The executables' first argument is the name of libtest, unit test or server
- respectively.
+ Individual tests are bundled into single executables, one for libtests, one
+ for unit tests and one for servers. The executables' first argument is
+ the name of libtest, unit test or server respectively.
In these executables, the build process automatically renames the entry point
to a unique symbol. `test` becomes `test_<tool>`, e.g. `test_lib1598` or
`test_unit1305`. For servers `main` becomes `main_sws` for the `sws` server,
configure_file("curl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/curl_config.h")
-# Get 'CSOURCES', 'HHEADERS' variables
+# Get CSOURCES, HHEADERS variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
option(CURL_LIBCURL_VERSIONED_SYMBOLS "Enable libcurl versioned symbols" OFF)
if(CURL_LIBCURL_SOVERSION OR CURL_LIBCURL_VERSIONED_SYMBOLS)
- # Get 'VERSIONCHANGE', 'VERSIONADD', 'VERSIONDEL', 'VERSIONINFO' variables
+ # Get VERSIONCHANGE, VERSIONADD, VERSIONDEL, VERSIONINFO variables
curl_transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
-include Makefile.soname
-
AM_CPPFLAGS += -DBUILDING_LIBCURL
AM_LDFLAGS =
AM_CFLAGS =
AM_CPPFLAGS += -DCURLDEBUG
endif
-# Makefile.inc provides the CSOURCES and HHEADERS defines
+# Get CSOURCES, HHEADERS variables
include Makefile.inc
if DOING_NATIVE_WINDOWS
curl_EXCLUDE += memdebug.c
endif
libcurl_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CSOURCES)
- @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CSOURCES) --exclude $(curl_EXCLUDE) > libcurl_unity.c
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --srcdir $(srcdir) --include $(CSOURCES) --exclude $(curl_EXCLUDE) > libcurl_unity.c
nodist_libcurl_la_SOURCES = libcurl_unity.c
libcurl_la_SOURCES = $(curl_EXCLUDE)
libcurl_la_CFLAGS_EXTRA =
if CURL_LT_SHLIB_USE_VERSION_INFO
+# Get VERSIONCHANGE, VERSIONADD, VERSIONDEL, VERSIONINFO variables
+include Makefile.soname
libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO)
endif
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
LIB_CURLX_CFILES = \
curlx/base64.c \
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
# Keep in sync with CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME in configure.ac
VERSIONCHANGE=12
#
###########################################################################
-# Helper script for "unity"-like support in autotools, to generate the umbrella
-# C source that includes the individual source files. Reads Makefile.inc and
-# accepts the variable name containing all the source files to include. Also
-# allow a list of exceptions that are to be excluded from the generated file.
+# Helper script for "unity"-like support in autotools and to bundle up tests
+# for both autotools and cmake. It generates the umbrella C source that
+# includes the individual source files and tests.
use strict;
use warnings;
if(!@ARGV) {
- die "Usage: $0 [<c-sources>] [--exclude <exclude-c-sources>]\n";
+ die "Usage: $0 [--test <tests>] [--include <include-c-sources>] [--exclude <exclude-c-sources>] [--srcdir <srcdir>] [--embed]\n";
}
-my $srcdir = shift @ARGV;
-
# Specific sources to exclude or add as an extra source file
my @src;
my %exclude;
+my %include;
my $in_exclude = 0;
+my $in_include = 0;
+my $srcdir = "";
+my $in_srcdir = 0;
+my $any_test = 0;
+my $embed = 0;
foreach my $src (@ARGV) {
- if($in_exclude) {
- $exclude{$src} = 1;
+ if($src eq "--test") {
+ $in_exclude = 0;
+ $in_include = 0;
}
elsif($src eq "--exclude") {
$in_exclude = 1;
+ $in_include = 0;
+ }
+ elsif($src eq "--include") {
+ $in_exclude = 0;
+ $in_include = 1;
+ }
+ elsif($src eq "--embed") {
+ $embed = 1;
+ }
+ elsif($src eq "--srcdir") {
+ $in_srcdir = 1;
+ }
+ elsif($in_srcdir) {
+ $srcdir = $src;
+ $in_srcdir = 0;
+ }
+ elsif($in_exclude) {
+ $exclude{$src} = 1;
+ }
+ elsif($in_include) {
+ $include{$src} = 1;
+ push @src, $src;
}
else {
push @src, $src;
+ $any_test = 1;
}
}
-print <<HEADER
-/* !checksrc! disable COPYRIGHT all */
-HEADER
- ;
+print "/* !checksrc! disable COPYRIGHT all */\n\n";
+if($any_test) {
+ print "#include \"first.h\"\n\n";
+}
+
+my $tlist = "";
foreach my $src (@src) {
- if($src =~ /\.c$/g && !exists $exclude{$src}) {
- if(-e "$srcdir/$src") {
- print "#include \"$srcdir/$src\"\n";
+ if($src =~ /([a-z0-9]+)\.c$/ && !exists $exclude{$src}) {
+ my $name = $1;
+ my $fn = $src;
+ if($srcdir ne "" && (exists $include{$src} || $embed) && -e "$srcdir/$fn") {
+ $fn = $srcdir . "/" . $fn;
+ }
+ if($embed) {
+ my $content = do { local $/; open my $fh, '<', $fn or die $!; <$fh> };
+ print $content;
}
else {
- print "#include \"$src\"\n";
+ print "#include \"$fn\"\n";
+ }
+ if(not exists $include{$src}) { # register test entry function
+ $tlist .= " {\"$name\", test_$name},\n";
}
}
}
+
+if($any_test) {
+ print "\nstatic const struct entry_s s_entries[] = {\n$tlist};\n";
+ print "\n#include \"first.c\"\n";
+}
endif()
endif()
-# Get 'CURL_CFILES', 'CURLX_CFILES', 'CURL_HFILES' variables
+# Get CURL_CFILES, CURLX_CFILES, CURL_HFILES variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
UNICODEFLAG = -municode
endif
+# Get CURL_CFILES, CURLX_CFILES, CURL_HFILES variables
include Makefile.inc
curl_cfiles_gen =
curl_CURLX = $(CURLX_CFILES)
endif
curltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_cfiles_gen) $(curl_CURLX)
- @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CURL_CFILES) $(curl_cfiles_gen) $(curl_CURLX) > curltool_unity.c
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --srcdir $(srcdir) --include $(CURL_CFILES) $(curl_cfiles_gen) $(curl_CURLX) > curltool_unity.c
nodist_curl_SOURCES = curltool_unity.c
curl_SOURCES =
libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
if USE_UNITY
libcurltool_unity.c: $(top_srcdir)/scripts/mk-unity.pl $(CURL_CFILES) $(curl_CURLX)
- @PERL@ $(top_srcdir)/scripts/mk-unity.pl $(srcdir) $(CURL_CFILES) $(curl_CURLX) > libcurltool_unity.c
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --srcdir $(srcdir) --include $(CURL_CFILES) $(curl_CURLX) > libcurltool_unity.c
nodist_libcurltool_la_SOURCES = libcurltool_unity.c
libcurltool_la_SOURCES =
# SPDX-License-Identifier: curl
#
###########################################################################
-# ./src/Makefile.inc
+# Shared between CMakeLists.txt and Makefile.am
+
# Using the backslash as line continuation character might be problematic with
# some make flavours. If we ever want to change this in a portable manner then
# we should consider this idea :
*
***************************************************************************/
+#ifndef CURL_NO_OLDIES
#define CURL_NO_OLDIES
+#endif
/*
* curl_setup.h may define preprocessor macros such as _FILE_OFFSET_BITS and
/* returns a new URL that needs to be freed */
/* @unittest: 1621 */
-#ifdef UNITTESTS
-char *stripcredentials(const char *url);
-#else
-static
-#endif
-char *stripcredentials(const char *url)
+UNITTEST char *stripcredentials(const char *url)
{
CURLU *u;
CURLUcode uc;
#ifdef USE_XATTR
int fwrite_xattr(CURL *curl, const char *url, int fd);
+#ifdef UNITTESTS
+UNITTEST char *stripcredentials(const char *url);
+#endif
+
#else
#define fwrite_xattr(a,b,c) 0
#endif
http2-server.pl \
http3-server.pl \
memanalyze.pl \
- mk-bundle.pl \
negtelnetserver.py \
nghttpx.conf \
pathhelp.pm \
# SPDX-License-Identifier: curl
#
###########################################################################
-# Get 'CERTCONFIG_CA', 'CERTCONFIGS', 'GENERATEDCERTS', 'SRPFILES' variables
+# Get CERTCONFIG_CA, CERTCONFIGS, GENERATEDCERTS, SRPFILES variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
###########################################################################
AUTOMAKE_OPTIONS = foreign
+# Get CERTCONFIG_CA, CERTCONFIGS, GENERATEDCERTS, SRPFILES variables
include Makefile.inc
EXTRA_DIST = $(CERTCONFIG_CA) $(CERTCONFIGS) $(SRPFILES) CMakeLists.txt \
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
+
CERTCONFIG_CA = \
test-ca.cnf \
test-ca.prm
<tool>
unit1305
</tool>
-<command>
-%TESTNUMBER
-</command>
</client>
</testcase>
</server>
<features>
unittest
-https
-pop3s
</features>
<name>
unit tests for stripcredentials from URL
http
</server>
<tool>
-libauthretry
+lib2023
</tool>
<name>
crypto
</features>
<tool>
-libauthretry
+lib2023
</tool>
<name>
http
</server>
<tool>
-libauthretry
+lib2023
</tool>
<name>
crypto
</features>
<tool>
-libauthretry
+lib2023
</tool>
<name>
crypto
</features>
<tool>
-libauthretry
+lib2023
</tool>
<name>
http
</server>
<tool>
-libauthretry
+lib2023
</tool>
<name>
http
</server>
<tool>
-libauthretry
+lib2023
</tool>
<name>
http
</server>
<tool>
-libauthretry
+lib2023
</tool>
<name>
http
</server>
<tool>
-libauthretry
+lib2023
</tool>
<name>
http
</server>
<tool>
-libntlmconnect
+lib2032
</tool>
<name>
Pre-request callback for HTTP
</name>
<tool>
-libprereq
+lib2082
</tool>
<command>
Pre-request callback for FTP
</name>
<tool>
-libprereq
+lib2082
</tool>
<command>
Pre-request callback for HTTP with callback terminating transfer
</name>
<tool>
-libprereq
+lib2082
</tool>
<command>
Pre-request callback for HTTP with location following
</name>
<tool>
-libprereq
+lib2082
</tool>
<command>
Pre-request callback for HTTP IPv6
</name>
<tool>
-libprereq
+lib2082
</tool>
<command>
%feature
%keywords
@protocols
- $bundle
$dev_null
);
}
our %feature; # hash of enabled features
our %keywords; # hash of keywords from the test spec
our $has_shared; # built as a shared library
-our $bundle = 0; # use bundled server, libtest, unit binaries
1;
add_custom_target(test-http-clients)
-# Get 'check_PROGRAMS' variable
+# Get check_PROGRAMS variable
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
if(LIB_SELECTED STREQUAL LIB_STATIC AND WIN32)
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
- set_target_properties(${_target_name} PROPERTIES
- OUTPUT_NAME "${_target}" UNITY_BUILD OFF
- PROJECT_LABEL "Test client ${_target}")
+ set_target_properties(${_target_name} PROPERTIES OUTPUT_NAME "${_target}" ROJECT_LABEL "Test client ${_target}"
+ UNITY_BUILD OFFP)
endforeach()
# This might hold -Werror
CFLAGS += @CURL_CFLAG_EXTRAS@
-# Makefile.inc provides the check_PROGRAMS define
+# Get check_PROGRAMS variable
include Makefile.inc
all: $(check_PROGRAMS)
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
-# These are all libcurl example programs to be test compiled
check_PROGRAMS = \
h2-pausing \
h2-serverpush \
#
# SPDX-License-Identifier: curl
-lib[1-4][0-9][0-9][0-9]
-lib[5-9][0-9][0-9]
-lib1521.c
-libtest_bundle.c
libtests
-libauthretry
-libntlmconnect
-libprereq
+libtests.c
+lib1521.c
#
###########################################################################
-# Get 'LIBTESTPROGS', '*_SOURCES', 'TESTUTIL', 'TSTTRACE', 'WARNLESS', 'MULTIBYTE', 'INET_PTON', 'TIMEDIFF', 'THREADS', 'MEMPTR'
-# 'FIRSTFILES' variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, MEMPTR, CURLX_SRCS, TESTFILES variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
"${PROJECT_SOURCE_DIR}/include/curl/curl.h"
VERBATIM)
-if(CURL_TEST_BUNDLES)
- add_custom_command(
- OUTPUT "libtest_bundle.c"
- COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" "${CMAKE_CURRENT_SOURCE_DIR}" > "libtest_bundle.c"
- DEPENDS
- "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${FIRSTFILES} "lib1521.c"
- "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
- VERBATIM)
+add_custom_command(
+ OUTPUT "${BUNDLE_SRC}"
+ COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES} "lib1521.c"
+ ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+ DEPENDS
+ "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES} "lib1521.c"
+ VERBATIM)
- set(LIBTESTPROGS "libtests")
- set(libtests_SOURCES "libtest_bundle.c")
- list(APPEND libtests_SOURCES ${TESTUTIL} ${TSTTRACE})
- if(LIB_SELECTED STREQUAL LIB_SHARED)
- # These are part of the libcurl static lib. Add them here when linking shared.
- list(APPEND libtests_SOURCES ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS} ${MEMPTR})
- endif()
+set(_sources "")
+if(LIB_SELECTED STREQUAL LIB_SHARED)
+ list(APPEND _sources ${MEMPTR} ${CURLX_SRCS}) # These are part of the libcurl static lib. Add them here when linking shared.
endif()
-foreach(_target IN LISTS LIBTESTPROGS)
- if(DEFINED ${_target}_SOURCES)
- set(_sources ${${_target}_SOURCES})
- else()
- set(_sources ${nodist_${_target}_SOURCES})
- endif()
-
- if(LIB_SELECTED STREQUAL LIB_STATIC)
- # These are part of the libcurl static lib. Do not compile/link them again.
- list(REMOVE_ITEM _sources ${WARNLESS} ${MULTIBYTE} ${INET_PTON} ${TIMEDIFF} ${THREADS})
- endif()
-
- string(TOUPPER ${_target} _upper_target)
- set(_target_name "${_target}")
- add_executable(${_target_name} EXCLUDE_FROM_ALL ${_sources})
- add_dependencies(testdeps ${_target_name})
- target_link_libraries(${_target_name} ${LIB_SELECTED} ${CURL_LIBS})
- 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}/lib/curlx" # for curlx
- "${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h"
- "${PROJECT_SOURCE_DIR}/tests/libtest" # to be able to build generated tests
- "${PROJECT_SOURCE_DIR}/tests/unit" # for curlcheck.h
- )
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
- if(NOT CURL_TEST_BUNDLES)
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS ${_upper_target})
- endif()
- set_target_properties(${_target_name} PROPERTIES
- OUTPUT_NAME "${_target}"
- PROJECT_LABEL "Test libtest ${_target}")
-endforeach()
+add_executable(libtests EXCLUDE_FROM_ALL ${_sources} ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps libtests)
+target_link_libraries(libtests ${LIB_SELECTED} ${CURL_LIBS})
+target_include_directories(libtests PRIVATE
+ "${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
+ "${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
+ "${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx
+ "${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h"
+ "${PROJECT_SOURCE_DIR}/tests/libtest" # to be able to build generated tests
+ "${PROJECT_SOURCE_DIR}/tests/unit" # for curlcheck.h
+)
+set_property(TARGET libtests APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}" "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
+set_target_properties(libtests PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
-I$(top_srcdir)/tests/libtest \
-I$(top_srcdir)/tests/unit
-EXTRA_DIST = test307.pl test610.pl test613.pl test1013.pl test1022.pl \
- CMakeLists.txt mk-lib1521.pl .checksrc
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, MEMPTR, CURLX_SRCS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt .checksrc $(FIRSTFILES) $(UTILS) $(MEMPTR) $(TESTFILES) \
+ test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
CFLAGS += @CURL_CFLAG_EXTRAS@
-CLEANFILES = lib1521.c
-
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
-SUPPORTFILES_LIBS = $(top_builddir)/lib/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@
-TESTUTIL_LIBS = $(top_builddir)/lib/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@
-
# Dependencies (may need to be overridden)
-LDADD = $(SUPPORTFILES_LIBS)
-
-# Makefile.inc provides the source defines (TESTUTIL, SUPPORTFILES,
-# LIBTESTPROGS, lib*_SOURCES, and lib*_CFLAGS)
-include Makefile.inc
+LDADD = $(top_builddir)/lib/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@
noinst_LTLIBRARIES =
AM_CPPFLAGS += -DCURLDEBUG
endif
+AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
+
AM_LDFLAGS =
AM_CFLAGS =
-libstubgss_la_LDFLAGS_EXTRA =
-
-if CURL_LT_SHLIB_USE_NO_UNDEFINED
-libstubgss_la_LDFLAGS_EXTRA += -no-undefined
-endif
-
# Build a stub gssapi implementation for testing
if BUILD_STUB_GSS
noinst_LTLIBRARIES += libstubgss.la
libstubgss_la_CPPFLAGS = $(AM_CPPFLAGS)
-libstubgss_la_LDFLAGS = $(AM_LDFLAGS) $(libstubgss_la_LDFLAGS_EXTRA) -avoid-version -rpath /nowhere
+libstubgss_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version -rpath /nowhere
+if CURL_LT_SHLIB_USE_NO_UNDEFINED
+libstubgss_la_LDFLAGS += -no-undefined
+endif
libstubgss_la_CFLAGS = $(AM_CFLAGS) -g
-
libstubgss_la_SOURCES = stub_gssapi.c stub_gssapi.h
-
libstubgss_la_LIBADD =
libstubgss_la_DEPENDENCIES =
endif
-BUNDLE=libtests
-
-if USE_TEST_BUNDLES
-libtest_bundle.c: $(top_srcdir)/tests/mk-bundle.pl Makefile.inc $(FIRSTFILES) lib1521.c
- @PERL@ $(top_srcdir)/tests/mk-bundle.pl $(srcdir) > libtest_bundle.c
-
-noinst_PROGRAMS = $(BUNDLE)
-nodist_libtests_SOURCES = libtest_bundle.c
-libtests_SOURCES = $(TESTUTIL) $(TSTTRACE)
-libtests_LDADD = $(TESTUTIL_LIBS)
-CLEANFILES += libtest_bundle.c
-
+bundle_EXCLUDE =
if USE_CPPFLAG_CURL_STATICLIB
-else
# These are part of the libcurl static lib. Add them here when linking shared.
-libtests_SOURCES += $(WARNLESS) $(MULTIBYTE) $(INET_PTON) $(TIMEDIFF) $(THREADS) $(MEMPTR)
-endif
-else
-noinst_PROGRAMS = $(LIBTESTPROGS)
+bundle_EXCLUDE += $(MEMPTR) $(CURLX_SRCS)
endif
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(MEMPTR) $(CURLX_SRCS) $(TESTFILES) lib1521.c
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(MEMPTR) $(CURLX_SRCS) --test $(TESTFILES) lib1521.c --exclude $(bundle_EXCLUDE) > $(BUNDLE_SRC)
+
+noinst_PROGRAMS = $(BUNDLE)
+nodist_libtests_SOURCES = $(BUNDLE_SRC)
+libtests_SOURCES = $(bundle_EXCLUDE)
+CLEANFILES = $(BUNDLE_SRC) lib1521.c
lib1521.c: $(top_srcdir)/tests/libtest/mk-lib1521.pl $(top_srcdir)/include/curl/curl.h
@PERL@ $(top_srcdir)/tests/libtest/mk-lib1521.pl < $(top_srcdir)/include/curl/curl.h lib1521.c
# ignore generated C files since they play by slightly different rules!
checksrc: lib1521.c
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
- -W$(srcdir)/libtest_bundle.c \
+ -W$(srcdir)/$(BUNDLE_SRC) \
$(srcdir)/*.[ch])
if NOT_CURL_CI
# SPDX-License-Identifier: curl
#
###########################################################################
-# files used only in some libcurl test programs
-TESTUTIL = testutil.c testutil.h
-TSTTRACE = testtrace.c testtrace.h
-WARNLESS = ../../lib/curlx/warnless.c ../../lib/curlx/warnless.h
-MULTIBYTE = ../../lib/curlx/multibyte.c ../../lib/curlx/multibyte.h
-THREADS = ../../lib/curl_threads.c ../../lib/curl_threads.h
-MEMPTR = memptr.c
+# Shared between CMakeLists.txt and Makefile.am
-# these files are used in every single test program below
-TIMEDIFF = ../../lib/curlx/timediff.c ../../lib/curlx/timediff.h
-FIRSTFILES = first.c first.h
-SUPPORTFILES = $(TIMEDIFF) $(FIRSTFILES) test.h
+BUNDLE = libtests
+BUNDLE_SRC = libtests.c
-# These are all libcurl test programs
-LIBTESTPROGS = libauthretry libntlmconnect libprereq \
- lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509 \
- lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519 \
- lib520 lib521 lib523 lib524 lib525 lib526 lib530 \
- lib533 lib536 lib537 lib539 lib540 lib541 lib542 lib543 \
- lib544 \
- lib547 lib549 lib552 lib553 lib554 lib555 lib556 lib557 lib558 \
- lib559 lib560 lib562 lib564 lib566 lib567 lib568 lib569 lib570 \
- lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 lib582 \
- lib583 lib586 lib589 lib590 lib591 lib597 lib598 \
- lib599 \
- lib643 lib650 lib651 lib652 lib653 lib654 lib655 lib658 \
- lib659 lib661 lib666 lib667 lib668 \
- lib670 lib674 lib676 lib677 lib678 lib694 lib695 \
- lib751 \
- lib1156 \
- lib1301 \
- lib1308 \
- lib1485 \
- lib1500 lib1501 lib1502 lib1506 lib1507 lib1508 \
- lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \
- lib1518 lib1520 lib1521 lib1522 lib1523 \
- lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
- lib1534 lib1535 lib1536 lib1537 lib1538 \
- lib1540 lib1541 lib1542 lib1545 \
- lib1550 lib1551 lib1552 lib1553 lib1554 lib1555 lib1556 lib1557 \
- lib1558 lib1559 lib1560 lib1564 lib1565 lib1567 lib1568 lib1569 lib1571 \
- lib1576 \
- lib1591 lib1592 lib1593 lib1594 lib1597 lib1598 \
- \
- lib1662 \
- \
- lib1900 lib1901 \
- lib1903 lib1905 lib1906 lib1907 lib1908 lib1910 lib1911 lib1912 lib1913 \
- lib1915 lib1916 lib1918 lib1919 \
- lib1933 lib1934 lib1935 lib1936 lib1937 lib1938 lib1939 lib1940 \
- lib1945 lib1947 lib1948 lib1955 lib1956 lib1957 lib1958 lib1959 \
- lib1960 lib1964 \
- lib1970 lib1971 lib1972 lib1973 lib1974 lib1975 lib1977 lib1978 \
- lib2301 lib2302 lib2304 lib2306 lib2308 lib2309 \
- lib2402 lib2404 lib2405 \
- lib2502 \
- lib2700 \
- lib3010 lib3025 lib3026 lib3027 \
- lib3100 lib3101 lib3102 lib3103 lib3104 lib3105 lib3207 lib3208
+# Files referenced from the bundle source
+FIRSTFILES = first.c first.h
-libntlmconnect_SOURCES = libntlmconnect.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+# Common files used by test programs
+UTILS = testutil.c testutil.h testtrace.c testtrace.h test.h ../unit/curlcheck.h
-libauthretry_SOURCES = libauthretry.c $(SUPPORTFILES)
+MEMPTR = memptr.c
-libprereq_SOURCES = libprereq.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+CURLX_SRCS = \
+ ../../lib/curlx/warnless.c \
+ ../../lib/curlx/warnless.h \
+ ../../lib/curlx/multibyte.c \
+ ../../lib/curlx/multibyte.h \
+ ../../lib/curlx/timediff.c \
+ ../../lib/curlx/timediff.h \
+ ../../lib/curl_threads.c \
+ ../../lib/curl_threads.h
-lib500_SOURCES = lib500.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(MULTIBYTE)
-lib501_SOURCES = lib501.c $(SUPPORTFILES)
-lib502_SOURCES = lib502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib503_SOURCES = lib503.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib504_SOURCES = lib504.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib505_SOURCES = lib505.c $(SUPPORTFILES) $(MULTIBYTE)
-lib506_SOURCES = lib506.c $(SUPPORTFILES) $(TESTUTIL)
-lib507_SOURCES = lib507.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib508_SOURCES = lib508.c $(SUPPORTFILES)
-lib509_SOURCES = lib509.c $(SUPPORTFILES)
-lib510_SOURCES = lib510.c $(SUPPORTFILES)
-lib511_SOURCES = lib511.c $(SUPPORTFILES)
-lib512_SOURCES = lib512.c $(SUPPORTFILES)
-lib513_SOURCES = lib513.c $(SUPPORTFILES)
-lib514_SOURCES = lib514.c $(SUPPORTFILES)
-lib515_SOURCES = lib515.c $(SUPPORTFILES)
-lib516_SOURCES = lib516.c $(SUPPORTFILES)
-lib517_SOURCES = lib517.c $(SUPPORTFILES)
-lib518_SOURCES = lib518.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib519_SOURCES = lib519.c $(SUPPORTFILES)
-lib520_SOURCES = lib520.c $(SUPPORTFILES)
-lib521_SOURCES = lib521.c $(SUPPORTFILES)
-lib523_SOURCES = lib523.c $(SUPPORTFILES)
-lib524_SOURCES = lib524.c $(SUPPORTFILES)
-lib525_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib536_SOURCES = lib536.c $(SUPPORTFILES)
-lib537_SOURCES = lib537.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib539_SOURCES = lib539.c $(SUPPORTFILES)
-lib540_SOURCES = lib540.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib541_SOURCES = lib541.c $(SUPPORTFILES) $(MULTIBYTE)
-lib542_SOURCES = lib542.c $(SUPPORTFILES)
-lib543_SOURCES = lib543.c $(SUPPORTFILES)
-lib544_SOURCES = lib544.c $(SUPPORTFILES)
-lib547_SOURCES = lib547.c $(SUPPORTFILES)
-lib549_SOURCES = lib549.c $(SUPPORTFILES)
-lib552_SOURCES = lib552.c $(SUPPORTFILES) $(WARNLESS)
-lib553_SOURCES = lib553.c $(SUPPORTFILES)
-lib554_SOURCES = lib554.c $(SUPPORTFILES)
-lib555_SOURCES = lib555.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib556_SOURCES = lib556.c $(SUPPORTFILES) $(WARNLESS)
-lib557_SOURCES = lib557.c $(SUPPORTFILES)
-lib558_SOURCES = lib558.c $(SUPPORTFILES)
-lib559_SOURCES = lib559.c $(SUPPORTFILES)
-lib560_SOURCES = lib560.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib562_SOURCES = lib562.c $(SUPPORTFILES)
-lib564_SOURCES = lib564.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib566_SOURCES = lib566.c $(SUPPORTFILES) $(MULTIBYTE)
-lib567_SOURCES = lib567.c $(SUPPORTFILES)
-lib568_SOURCES = lib568.c $(SUPPORTFILES) $(TESTUTIL) $(MULTIBYTE)
-lib569_SOURCES = lib569.c $(SUPPORTFILES) $(TESTUTIL) $(MULTIBYTE)
-lib570_SOURCES = lib570.c $(SUPPORTFILES) $(TESTUTIL)
-lib571_SOURCES = lib571.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib572_SOURCES = lib572.c $(SUPPORTFILES) $(TESTUTIL) $(MULTIBYTE)
-lib573_SOURCES = lib573.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(TSTTRACE)
-lib574_SOURCES = lib574.c $(SUPPORTFILES)
-lib575_SOURCES = lib575.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib576_SOURCES = lib576.c $(SUPPORTFILES)
-lib578_SOURCES = lib578.c $(SUPPORTFILES) $(MULTIBYTE)
-lib579_SOURCES = lib579.c $(SUPPORTFILES) $(MULTIBYTE)
-lib582_SOURCES = lib582.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib583_SOURCES = lib583.c $(SUPPORTFILES)
-lib586_SOURCES = lib586.c $(SUPPORTFILES)
-lib589_SOURCES = lib589.c $(SUPPORTFILES)
-lib590_SOURCES = lib590.c $(SUPPORTFILES)
-lib591_SOURCES = lib591.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib597_SOURCES = lib597.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib598_SOURCES = lib598.c $(SUPPORTFILES)
-lib599_SOURCES = lib599.c $(SUPPORTFILES) $(MULTIBYTE)
-lib643_SOURCES = lib643.c $(SUPPORTFILES)
-lib650_SOURCES = lib650.c $(SUPPORTFILES)
-lib651_SOURCES = lib651.c $(SUPPORTFILES)
-lib652_SOURCES = lib652.c $(SUPPORTFILES)
-lib653_SOURCES = lib653.c $(SUPPORTFILES)
-lib654_SOURCES = lib654.c $(SUPPORTFILES)
-lib655_SOURCES = lib655.c $(SUPPORTFILES)
-lib658_SOURCES = lib658.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib659_SOURCES = lib659.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib661_SOURCES = lib661.c $(SUPPORTFILES)
-lib666_SOURCES = lib666.c $(SUPPORTFILES)
-lib667_SOURCES = lib667.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib668_SOURCES = lib668.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib670_SOURCES = lib670.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib674_SOURCES = lib674.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib676_SOURCES = lib676.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib677_SOURCES = lib677.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib678_SOURCES = lib678.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib694_SOURCES = lib694.c $(SUPPORTFILES)
-lib695_SOURCES = lib695.c $(SUPPORTFILES)
-lib751_SOURCES = lib751.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1301_SOURCES = lib1301.c $(SUPPORTFILES) $(TESTUTIL)
-lib1308_SOURCES = lib1308.c $(SUPPORTFILES)
-lib1485_SOURCES = lib1485.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1500_SOURCES = lib1500.c $(SUPPORTFILES) $(TESTUTIL)
-lib1501_SOURCES = lib1501.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1502_SOURCES = lib1502.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1506_SOURCES = lib1506.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1156_SOURCES = lib1156.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1507_SOURCES = lib1507.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1508_SOURCES = lib1508.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1509_SOURCES = lib1509.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1510_SOURCES = lib1510.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1511_SOURCES = lib1511.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1512_SOURCES = lib1512.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1513_SOURCES = lib1513.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1514_SOURCES = lib1514.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1515_SOURCES = lib1515.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
-lib1517_SOURCES = lib1517.c $(SUPPORTFILES)
-lib1518_SOURCES = lib1518.c $(SUPPORTFILES)
-lib1520_SOURCES = lib1520.c $(SUPPORTFILES)
-nodist_lib1521_SOURCES = lib1521.c $(SUPPORTFILES)
-lib1521_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)
-lib1522_SOURCES = lib1522.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE)
-lib1523_SOURCES = lib1523.c $(SUPPORTFILES)
-lib1525_SOURCES = lib1525.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1526_SOURCES = lib1526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1527_SOURCES = lib1527.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1528_SOURCES = lib1528.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1529_SOURCES = lib1529.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1530_SOURCES = lib1530.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1531_SOURCES = lib1531.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1532_SOURCES = lib1532.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1533_SOURCES = lib1533.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1534_SOURCES = lib1534.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1535_SOURCES = lib1535.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1536_SOURCES = lib1536.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1537_SOURCES = lib1537.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1538_SOURCES = lib1538.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1540_SOURCES = lib1540.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
-lib1541_SOURCES = lib1541.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1542_SOURCES = lib1542.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
-lib1545_SOURCES = lib1545.c $(SUPPORTFILES)
-lib1550_SOURCES = lib1550.c $(SUPPORTFILES)
-lib1551_SOURCES = lib1551.c $(SUPPORTFILES)
-lib1552_SOURCES = lib1552.c $(SUPPORTFILES) $(TESTUTIL)
-lib1553_SOURCES = lib1553.c $(SUPPORTFILES) $(TSTTRACE) $(TESTUTIL)
-lib1554_SOURCES = lib1554.c $(SUPPORTFILES)
-lib1555_SOURCES = lib1555.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1556_SOURCES = lib1556.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1557_SOURCES = lib1557.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1558_SOURCES = lib1558.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1559_SOURCES = lib1559.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1560_SOURCES = lib1560.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1564_SOURCES = lib1564.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1565_SOURCES = lib1565.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1567_SOURCES = lib1567.c $(SUPPORTFILES)
-lib1568_SOURCES = lib1568.c $(SUPPORTFILES)
-lib1569_SOURCES = lib1569.c $(SUPPORTFILES)
-lib1571_SOURCES = lib1571.c $(SUPPORTFILES)
-lib1576_SOURCES = lib1576.c $(SUPPORTFILES)
-lib1591_SOURCES = lib1591.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1592_SOURCES = lib1592.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1593_SOURCES = lib1593.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1594_SOURCES = lib1594.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1597_SOURCES = lib1597.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1598_SOURCES = lib1598.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1662_SOURCES = lib1662.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1900_SOURCES = lib1900.c $(SUPPORTFILES)
-lib1901_SOURCES = lib1901.c $(SUPPORTFILES)
-lib1903_SOURCES = lib1903.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1905_SOURCES = lib1905.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1906_SOURCES = lib1906.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1907_SOURCES = lib1907.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1908_SOURCES = lib1908.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1910_SOURCES = lib1910.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1911_SOURCES = lib1911.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1912_SOURCES = lib1912.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1913_SOURCES = lib1913.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1915_SOURCES = lib1915.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
-lib1916_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS)
-lib1918_SOURCES = lib1918.c $(SUPPORTFILES) $(WARNLESS)
-lib1919_SOURCES = lib1919.c $(SUPPORTFILES) $(WARNLESS)
-lib1933_SOURCES = lib1933.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1934_SOURCES = lib1934.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1935_SOURCES = lib1935.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1936_SOURCES = lib1936.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1937_SOURCES = lib1937.c $(SUPPORTFILES)
-lib1938_SOURCES = lib1938.c $(SUPPORTFILES)
-lib1939_SOURCES = lib1939.c $(SUPPORTFILES)
-lib1940_SOURCES = lib1940.c $(SUPPORTFILES)
-lib1945_SOURCES = lib1945.c $(SUPPORTFILES)
-lib1947_SOURCES = lib1947.c $(SUPPORTFILES)
-lib1948_SOURCES = lib1948.c $(SUPPORTFILES)
-lib1955_SOURCES = lib1955.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1956_SOURCES = lib1956.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1957_SOURCES = lib1957.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1958_SOURCES = lib1958.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1959_SOURCES = lib1959.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1960_SOURCES = lib1960.c $(SUPPORTFILES)
-lib1964_SOURCES = lib1964.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1970_SOURCES = lib1970.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1971_SOURCES = lib1971.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1972_SOURCES = lib1972.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1973_SOURCES = lib1973.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1974_SOURCES = lib1974.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1975_SOURCES = lib1975.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1977_SOURCES = lib1977.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1978_SOURCES = lib1978.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib2301_SOURCES = lib2301.c $(SUPPORTFILES)
-lib2302_SOURCES = lib2302.c $(SUPPORTFILES)
-lib2304_SOURCES = lib2304.c $(SUPPORTFILES)
-lib2306_SOURCES = lib2306.c $(SUPPORTFILES)
-lib2308_SOURCES = lib2308.c $(SUPPORTFILES)
-lib2309_SOURCES = lib2309.c $(SUPPORTFILES)
-lib2402_SOURCES = lib2402.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib2404_SOURCES = lib2404.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib2405_SOURCES = lib2405.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib2502_SOURCES = lib2502.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
-lib2700_SOURCES = lib2700.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(MULTIBYTE)
-lib3010_SOURCES = lib3010.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3025_SOURCES = lib3025.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3026_SOURCES = lib3026.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3027_SOURCES = lib3027.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3100_SOURCES = lib3100.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3101_SOURCES = lib3101.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3102_SOURCES = lib3102.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib3103_SOURCES = lib3103.c $(SUPPORTFILES)
-lib3104_SOURCES = lib3104.c $(SUPPORTFILES)
-lib3105_SOURCES = lib3105.c $(SUPPORTFILES)
-lib3207_SOURCES = lib3207.c $(SUPPORTFILES) $(TESTUTIL) $(THREADS) $(WARNLESS) $(MULTIBYTE) $(MEMPTR)
-lib3208_SOURCES = lib3208.c $(SUPPORTFILES) $(TESTUTIL)
+# All libtest programs
+TESTFILES = \
+ lib500.c lib501.c lib502.c lib503.c lib504.c lib505.c lib506.c lib507.c lib508.c lib509.c \
+ lib510.c lib511.c lib512.c lib513.c lib514.c lib515.c lib516.c lib517.c lib518.c lib519.c \
+ lib520.c lib521.c lib523.c lib524.c lib525.c lib526.c lib530.c \
+ lib533.c lib536.c lib537.c lib539.c lib540.c lib541.c lib542.c lib543.c \
+ lib544.c \
+ lib547.c lib549.c lib552.c lib553.c lib554.c lib555.c lib556.c lib557.c lib558.c \
+ lib559.c lib560.c lib562.c lib564.c lib566.c lib567.c lib568.c lib569.c lib570.c \
+ lib571.c lib572.c lib573.c lib574.c lib575.c lib576.c lib578.c lib579.c lib582.c \
+ lib583.c lib586.c lib589.c lib590.c lib591.c lib597.c lib598.c \
+ lib599.c \
+ lib643.c lib650.c lib651.c lib652.c lib653.c lib654.c lib655.c lib658.c \
+ lib659.c lib661.c lib666.c lib667.c lib668.c \
+ lib670.c lib674.c lib676.c lib677.c lib678.c lib694.c lib695.c \
+ lib751.c \
+ lib1156.c \
+ lib1301.c \
+ lib1308.c \
+ lib1485.c \
+ lib1500.c lib1501.c lib1502.c lib1506.c lib1507.c lib1508.c \
+ lib1509.c lib1510.c lib1511.c lib1512.c lib1513.c lib1514.c lib1515.c lib1517.c \
+ lib1518.c lib1520.c lib1522.c lib1523.c \
+ lib1525.c lib1526.c lib1527.c lib1528.c lib1529.c lib1530.c lib1531.c lib1532.c lib1533.c \
+ lib1534.c lib1535.c lib1536.c lib1537.c lib1538.c \
+ lib1540.c lib1541.c lib1542.c lib1545.c \
+ lib1550.c lib1551.c lib1552.c lib1553.c lib1554.c lib1555.c lib1556.c lib1557.c \
+ lib1558.c lib1559.c lib1560.c lib1564.c lib1565.c lib1567.c lib1568.c lib1569.c lib1571.c \
+ lib1576.c \
+ lib1591.c lib1592.c lib1593.c lib1594.c lib1597.c lib1598.c \
+ \
+ lib1662.c \
+ \
+ lib1900.c lib1901.c \
+ lib1903.c lib1905.c lib1906.c lib1907.c lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c \
+ lib1915.c lib1916.c lib1918.c lib1919.c \
+ lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c lib1940.c \
+ lib1945.c lib1947.c lib1948.c lib1955.c lib1956.c lib1957.c lib1958.c lib1959.c \
+ lib1960.c lib1964.c \
+ lib1970.c lib1971.c lib1972.c lib1973.c lib1974.c lib1975.c lib1977.c lib1978.c \
+ lib2023.c lib2032.c lib2082.c \
+ lib2301.c lib2302.c lib2304.c lib2306.c lib2308.c lib2309.c \
+ lib2402.c lib2404.c lib2405.c \
+ lib2502.c \
+ lib2700.c \
+ lib3010.c lib3025.c lib3026.c lib3027.c \
+ lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c lib3207.c lib3208.c
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "test.h"
-#include "first.h"
-
#ifdef HAVE_LOCALE_H
# include <locale.h> /* for setlocale() */
#endif
{
char *URL;
CURLcode result;
- int basearg;
- test_func_t test_func;
+ entry_func_t entry_func;
+ char *entry_name;
char *env;
+ size_t tmp;
CURL_SET_BINMODE(stdout);
setlocale(LC_ALL, "");
#endif
- test_argc = argc;
- test_argv = argv;
-
-#ifdef CURLTESTS_BUNDLED
- {
- char *test_name;
-
- --test_argc;
- ++test_argv;
-
- basearg = 2;
-
- if(argc < (basearg + 1)) {
- curl_mfprintf(stderr, "Pass testname and URL as arguments please\n");
- return 1;
- }
+ test_argc = argc - 1;
+ test_argv = argv + 1;
- test_name = argv[basearg - 1];
- test_func = NULL;
- {
- size_t tmp;
- for(tmp = 0; tmp < CURL_ARRAYSIZE(s_tests); ++tmp) {
- if(strcmp(test_name, s_tests[tmp].name) == 0) {
- test_func = s_tests[tmp].ptr;
- break;
- }
- }
- }
+ if(argc < 3) {
+ curl_mfprintf(stderr, "Pass testname and URL as arguments please\n");
+ return 1;
+ }
- if(!test_func) {
- curl_mfprintf(stderr, "Test '%s' not found.\n", test_name);
- return 1;
+ entry_name = argv[1];
+ entry_func = NULL;
+ for(tmp = 0; tmp < CURL_ARRAYSIZE(s_entries); ++tmp) {
+ if(strcmp(entry_name, s_entries[tmp].name) == 0) {
+ entry_func = s_entries[tmp].ptr;
+ break;
}
}
-#else
- basearg = 1;
- if(argc < (basearg + 1)) {
- curl_mfprintf(stderr, "Pass URL as argument please\n");
+ if(!entry_func) {
+ curl_mfprintf(stderr, "Test '%s' not found.\n", entry_name);
return 1;
}
- test_func = test;
-#endif
-
- if(argc > (basearg + 1))
- libtest_arg2 = argv[basearg + 1];
+ if(argc > 3)
+ libtest_arg2 = argv[3];
- if(argc > (basearg + 2))
- libtest_arg3 = argv[basearg + 2];
+ if(argc > 4)
+ libtest_arg3 = argv[4];
- if(argc > (basearg + 2))
- libtest_arg4 = argv[basearg + 3];
+ if(argc > 5)
+ libtest_arg4 = argv[5];
- URL = argv[basearg]; /* provide this to the rest */
+ URL = argv[2]; /* provide this to the rest */
env = getenv("CURL_TESTNUM");
if(env)
curl_mfprintf(stderr, "URL: %s\n", URL);
- result = test_func(URL);
+ result = entry_func(URL);
curl_mfprintf(stderr, "Test ended with result %d\n", result);
#ifdef _WIN32
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#define CURL_DISABLE_DEPRECATION 1
-#include "curl_setup.h"
-#include <curl/curl.h>
+#include "test.h"
-typedef CURLcode (*test_func_t)(char *);
+typedef CURLcode (*entry_func_t)(char *);
-#ifdef CURLTESTS_BUNDLED
-struct onetest {
+struct entry_s {
const char *name;
- test_func_t ptr;
+ entry_func_t ptr;
};
-#endif
#endif /* HEADER_LIBTEST_FIRST_H */
/* for debugging: */
/* #define SINGLETEST 9 */
-CURLcode test(char *URL)
+static CURLcode test_lib1156(char *URL)
{
CURLcode res;
CURL *curl;
***************************************************************************/
#include "curlcheck.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1301(char *URL)
{
int rc;
(void)URL;
***************************************************************************/
#include "curlcheck.h"
-#include <curl/curl.h>
-
static size_t print_httppost_callback(void *arg, const char *buf, size_t len)
{
fwrite(buf, len, 1, stdout);
return len;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1308(char *URL)
{
CURLFORMcode rc;
int res;
return len;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1485(char *URL)
{
CURL *curls = NULL;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1500(char *URL)
{
CURL *curls = NULL;
CURLM *multi = NULL;
#undef TEST_HANG_TIMEOUT
#define TEST_HANG_TIMEOUT 30 * 1000
-/* 500 milliseconds allowed. An extreme number but lets be really conservative
- to allow old and slow machines to run this test too */
-#define MAX_BLOCKED_TIME_MS 500
-
-CURLcode test(char *URL)
+static CURLcode test_lib1501(char *URL)
{
+ /* 500 milliseconds allowed. An extreme number but lets be really
+ conservative to allow old and slow machines to run this test too */
+ static const int MAX_BLOCKED_TIME_MS = 500;
+
CURL *handle = NULL;
CURLM *mhandle = NULL;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1502(char *URL)
{
CURL *easy = NULL;
CURL *dup;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1506(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl[NUM_HANDLES] = {0};
int running;
CURLM *m = NULL;
- int i;
+ size_t i;
char target_url[256];
char dnsentry[256];
struct curl_slist *slist = NULL, *slist2;
(void)URL;
/* Create fake DNS entries for serverX.example.com for all handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
curl_msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
- i + 1, port, address);
+ (int)i + 1, port, address);
curl_mprintf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
multi_setopt(m, CURLMOPT_MAXCONNECTS, 3L);
- /* get NUM_HANDLES easy handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ /* get each easy handle */
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
curl_msnprintf(target_url, sizeof(target_url),
"http://server%d.example.com:%s/path/1506%04i",
- i + 1, port, i + 1);
+ (int)i + 1, port, (int)i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
curl_mfprintf(stderr, "Start at URL 0\n");
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* add handle to multi */
multi_add_handle(m, curl[i]);
/* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
curl_multi_remove_handle(m, curl[i]);
curl_easy_cleanup(curl[i]);
}
#define RECIPIENT "<1507-recipient@example.com>"
#define MAILFROM "<1507-realuser@example.com>"
-#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
-
static size_t t1507_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
{
(void)ptr;
return CURL_READFUNC_ABORT;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1507(char *URL)
{
+ static const int MULTI_PERFORM_HANG_TIMEOUT = 60 * 1000;
+
CURLcode res = CURLE_OK;
CURL *curl = NULL;
CURLM *mcurl = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1508(char *URL)
{
CURLcode res = CURLE_OK;
CURLM *m = NULL;
static unsigned long realHeaderSize = 0;
-CURLcode test(char *URL)
+static CURLcode test_lib1509(char *URL)
{
long headerSize;
CURLcode code;
#include "warnless.h"
#include "memdebug.h"
-#define NUM_URLS 4
-
-CURLcode test(char *URL)
+static CURLcode test_lib1510(char *URL)
{
+ static const int NUM_URLS = 4;
+
CURLcode res = CURLE_OK;
CURL *curl = NULL;
int i;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1511(char *URL)
{
long unmet;
CURL *curl = NULL;
#include "memdebug.h"
-#undef NUM_HANDLES
-#define NUM_HANDLES 2
-
-CURLcode test(char *URL)
+static CURLcode test_lib1512(char *URL)
{
CURLcode res = CURLE_OK;
- CURL *curl[NUM_HANDLES] = {NULL, NULL};
+ CURL *curl[2] = {NULL, NULL};
char *port = libtest_arg3;
char *address = libtest_arg2;
char dnsentry[256];
struct curl_slist *slist = NULL;
- int i;
+ size_t i;
char target_url[256];
(void)URL; /* URL is setup in the code */
curl_mprintf("%s\n", dnsentry);
slist = curl_slist_append(slist, dnsentry);
- /* get NUM_HANDLES easy handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ /* get each easy handle */
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
curl_msnprintf(target_url, sizeof(target_url),
"http://server.example.curl:%s/path/1512%04i",
- port, i + 1);
+ port, (int)i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
/* make the first one populate the GLOBAL cache */
easy_setopt(curl[0], CURLOPT_RESOLVE, slist);
- /* run NUM_HANDLES transfers */
- for(i = 0; (i < NUM_HANDLES) && !res; i++) {
+ /* run each transfer */
+ for(i = 0; (i < CURL_ARRAYSIZE(curl)) && !res; i++) {
res = curl_easy_perform(curl[i]);
if(res)
goto test_cleanup;
return 1;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1513(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib1514(char *URL)
{
CURL *curl;
CURLcode result = CURLE_OK;
return res;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1515(char *URL)
{
CURLM *multi = NULL;
CURLcode res = CURLE_OK;
return tocopy;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1517(char *URL)
{
static const char testdata[] =
"this is what we post to the silly web server\n";
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1518(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1520(char *URL)
{
CURLcode res;
CURL *curl;
return CURL_SOCKOPT_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1522(char *URL)
{
static char g_Data[40 * 1024]; /* POST 40KB */
return curl_easy_perform(hnd);
}
-CURLcode test(char *URL)
+static CURLcode test_lib1523(char *URL)
{
CURLcode ret;
CURL *hnd;
return strlen(t1525_testdata);
}
-CURLcode test(char *URL)
+static CURLcode test_lib1525(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
return strlen(t1526_testdata);
}
-CURLcode test(char *URL)
+static CURLcode test_lib1526(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
return strlen(t1527_testdata);
}
-CURLcode test(char *URL)
+static CURLcode test_lib1527(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1528(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1529(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
return CURL_SOCKET_BAD;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1530(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1531(char *URL)
{
static char const testData[] = ".abc\0xyz";
static curl_off_t const testDataSize = sizeof(testData) - 1;
/* Test CURLINFO_RESPONSE_CODE */
-CURLcode test(char *URL)
+static CURLcode test_lib1532(char *URL)
{
CURL *curl;
long httpcode;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1533(char *URL)
{
struct cb_data data;
CURL *curl = NULL;
/* Test CURLINFO_FILETIME */
-CURLcode test(char *URL)
+static CURLcode test_lib1534(char *URL)
{
CURL *curl, *dupe = NULL;
long filetime;
goto test_cleanup;
}
-
/* Test that a filetime is properly initialized on curl_easy_reset.
*/
/* Test CURLINFO_PROTOCOL */
-CURLcode test(char *URL)
+static CURLcode test_lib1535(char *URL)
{
CURL *curl, *dupe = NULL;
long protocol;
goto test_cleanup;
}
-
/* Test that a protocol is properly initialized on curl_easy_reset.
*/
/* Test CURLINFO_SCHEME */
-CURLcode test(char *URL)
+static CURLcode test_lib1536(char *URL)
{
CURL *curl, *dupe = NULL;
char *scheme;
goto test_cleanup;
}
-
/* Test that a scheme is properly initialized on curl_easy_reset.
*/
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1537(char *URL)
{
const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1538(char *URL)
{
CURLcode res = CURLE_OK;
CURLcode easyret;
return CURL_WRITEFUNC_PAUSE;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1540(char *URL)
{
CURL *curls = NULL;
CURLcode res = CURLE_OK;
return size * nmemb;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1541(char *URL)
{
CURL *curls = NULL;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1542(char *URL)
{
CURL *easy = NULL;
CURLcode res = CURLE_OK;
***************************************************************************/
#include "test.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1545(char *URL)
{
CURL *eh = NULL;
CURLcode res = CURLE_OK;
#include <curl/multi.h>
-CURLcode test(char *URL)
+static CURLcode test_lib1550(char *URL)
{
CURLM *handle;
CURLcode res = CURLE_OK;
#include <curl/multi.h>
-CURLcode test(char *URL)
+static CURLcode test_lib1551(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1552(char *URL)
{
CURL *curls = NULL;
CURLM *multi = NULL;
return 1; /* fail as fast as we can */
}
-CURLcode test(char *URL)
+static CURLcode test_lib1553(char *URL)
{
CURL *curls = NULL;
CURLM *multi = NULL;
}
/* test function */
-CURLcode test(char *URL)
+static CURLcode test_lib1554(char *URL)
{
CURLcode res = CURLE_OK;
CURLSH *share = NULL;
return 1;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1555(char *URL)
{
CURLcode res = CURLE_OK;
return nmemb * size;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1556(char *URL)
{
CURLcode code;
CURL *curl = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1557(char *URL)
{
CURLM *curlm = NULL;
CURL *curl1 = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1558(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
#include "warnless.h"
#include "memdebug.h"
-#define EXCESSIVE 10*1000*1000
-CURLcode test(char *URL)
+static CURLcode test_lib1559(char *URL)
{
+ static const int EXCESSIVE = 10*1000*1000;
+
CURLcode res = CURLE_OK;
CURL *curl = NULL;
char *longurl = NULL;
#include "warnless.h"
#include "memdebug.h" /* LAST include file */
-struct part {
- CURLUPart part;
- const char *name;
-};
-
-
static int checkparts(CURLU *u, const char *in, const char *wanted,
unsigned int getflags)
{
char buf[256];
char *bufp = &buf[0];
size_t len = sizeof(buf);
+
+ struct part {
+ CURLUPart part;
+ const char *name;
+ };
+
struct part parts[] = {
{CURLUPART_SCHEME, "scheme"},
{CURLUPART_USER, "user"},
rc = curl_url_get(u, CURLUPART_ZONEID, &p, 0);
if(rc != CURLUE_NO_ZONEID)
curl_mfprintf(stderr, "unexpected return code %u on line %u\n", (int)rc,
- __LINE__);
+ __LINE__);
curl_url_cleanup(u);
}
return 1;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1560(char *URL)
{
(void)URL; /* not used */
#define WAKEUP_NUM 10
-CURLcode test(char *URL)
+static CURLcode test_lib1564(char *URL)
{
CURLM *multi = NULL;
int numfds;
static CURLcode t1565_test_failure = CURLE_OK;
static CURLM *testmulti = NULL;
-static const char *url;
+static const char *t1565_url;
static void *t1565_run_thread(void *ptr)
{
easy_init(easy);
- easy_setopt(easy, CURLOPT_URL, url);
+ easy_setopt(easy, CURLOPT_URL, t1565_url);
easy_setopt(easy, CURLOPT_VERBOSE, 0L);
pthread_mutex_lock(&lock);
return NULL;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1565(char *URL)
{
int still_running;
int num;
multi_init(testmulti);
- url = URL;
+ t1565_url = URL;
result = pthread_create(&tid, NULL, t1565_run_thread, NULL);
if(!result)
}
#else /* without pthread, this test doesn't work */
-CURLcode test(char *URL)
+static CURLcode test_lib1565(char *URL)
{
(void)URL;
return CURLE_OK;
#include <curl/multi.h>
-CURLcode test(char *URL)
+static CURLcode test_lib1567(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_OK;
#include "testtrace.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1568(char *URL)
{
CURLcode ret;
CURL *hnd;
#include "testtrace.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1569(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1571(char *URL)
{
CURLcode res;
CURL *curl;
return CURL_SEEKFUNC_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1576(char *URL)
{
CURLcode res;
CURL *curl;
}
}
-CURLcode test(char *URL)
+static CURLcode test_lib1591(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
return TEST_ERR_MAJOR_BAD;
}
-
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
#include <sys/stat.h>
-CURLcode test(char *URL)
+static CURLcode test_lib1592(char *URL)
{
int stillRunning;
CURLM *multiHandle = NULL;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1593(char *URL)
{
struct curl_slist *header = NULL;
long unmet;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1594(char *URL)
{
struct curl_slist *header = NULL;
curl_off_t retry;
CURLcode *exp;
};
-CURLcode test(char *URL)
+static CURLcode test_lib1597(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_OK;
}
}
-CURLcode test(char *URL)
+static CURLcode test_lib1598(char *URL)
{
static const char *post_data = "xxx=yyy&aaa=bbbbb";
return TEST_ERR_MAJOR_BAD;
}
-
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib1662(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1900(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd = NULL;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1901(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1903(char *URL)
{
CURLcode res = CURLE_OK;
CURL *ch = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1905(char *URL)
{
CURLSH *sh = NULL;
CURL *ch = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1906(char *URL)
{
CURLcode res = CURLE_OK;
char *url_after = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1907(char *URL)
{
char *url_after;
CURL *curl;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1908(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1910(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
define not publicly exposed so we set our own */
#define MAX_INPUT_LENGTH 8000000
-CURLcode test(char *URL)
+static CURLcode test_lib1911(char *URL)
{
static char testbuf[MAX_INPUT_LENGTH + 2];
curl_mfprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", \
name, exp);
-CURLcode test(char *URL)
+static CURLcode test_lib1912(char *URL)
{
/* Only test if GCC typechecking is available */
int error = 0;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1913(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
* Read/write HSTS cache entries via callback.
*/
-CURLcode test(char *URL)
+static CURLcode test_lib1915(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1916(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1918(char *URL)
{
const struct curl_easyoption *o;
(void)URL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1919(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1933(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1934(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1935(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1936(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1937(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1938(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1939(char *URL)
{
CURLM *multi;
CURL *easy;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
}
}
-CURLcode test(char *URL)
+static CURLcode test_lib1940(char *URL)
{
CURL *easy = NULL;
CURLcode res = CURLE_OK;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
(void)userp;
return n*l;
}
-CURLcode test(char *URL)
+
+static CURLcode test_lib1945(char *URL)
{
CURL *easy;
CURLcode res = CURLE_OK;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "memdebug.h"
(void)userp;
return n*l;
}
-CURLcode test(char *URL)
+
+static CURLcode test_lib1947(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
typedef struct
return tocopy;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1948(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1955(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1956(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1957(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1958(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1959(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
/* Expected args: URL IP PORT */
-CURLcode test(char *URL)
+static CURLcode test_lib1960(char *URL)
{
CURL *curl = NULL;
CURLcode res = TEST_ERR_MAJOR_BAD;
return res;
}
#else
-CURLcode test(char *URL)
+static CURLcode test_lib1960(char *URL)
{
(void)URL;
curl_mprintf("lacks inet_pton\n");
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1964(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1970(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1971(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1972(char *URL)
{
CURL *curl;
curl_mime *mime = NULL;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1973(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1974(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib1975(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1977(char *URL)
{
CURLcode res = CURLE_OK;
CURLU *curlu = curl_url();
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib1978(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
curl_msnprintf(full_url, len, "%s%04d", url, seq);
curl_mfprintf(stderr, "Sending new request %d to %s with credential %s "
- "(auth %ld)\n", seq, full_url, userpwd, auth_scheme);
+ "(auth %ld)\n", seq, full_url, userpwd, auth_scheme);
test_setopt(curl, CURLOPT_URL, full_url);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_HEADER, 1L);
return CURLAUTH_NONE;
}
-CURLcode test(char *url)
+static CURLcode test_lib2023(char *URL) /* libauthretry */
{
CURLcode res;
CURL *curl = NULL;
return TEST_ERR_MAJOR_BAD;
}
- res = send_wrong_password(curl, url, 100, main_auth_scheme);
+ res = send_wrong_password(curl, URL, 100, main_auth_scheme);
if(res != CURLE_OK)
goto test_cleanup;
- res = send_right_password(curl, url, 200, fallback_auth_scheme);
+ res = send_right_password(curl, URL, 200, fallback_auth_scheme);
if(res != CURLE_OK)
goto test_cleanup;
return TEST_ERR_MAJOR_BAD;
}
- res = send_wrong_password(curl, url, 300, main_auth_scheme);
+ res = send_wrong_password(curl, URL, 300, main_auth_scheme);
if(res != CURLE_OK)
goto test_cleanup;
- res = send_wrong_password(curl, url, 400, fallback_auth_scheme);
+ res = send_wrong_password(curl, URL, 400, fallback_auth_scheme);
if(res != CURLE_OK)
goto test_cleanup;
- res = send_right_password(curl, url, 500, fallback_auth_scheme);
+ res = send_right_password(curl, URL, 500, fallback_auth_scheme);
if(res != CURLE_OK)
goto test_cleanup;
if(CURLE_OK != code) {
curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
- "with code %d (%s)\n",
- __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+ "with code %d (%s)\n",
+ __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
ntlmcb_res = TEST_ERR_MAJOR_BAD;
return failure;
}
/* An easy handle with a socket different to previously
tracked one, log and fail right away. Known bug #37. */
curl_mfprintf(stderr, "Handle %d started on socket %d and moved to %d\n",
- curlx_sztosi(idx), (int)ntlm_sockets[idx], (int)sock);
+ curlx_sztosi(idx), (int)ntlm_sockets[idx], (int)sock);
ntlmcb_res = TEST_ERR_MAJOR_BAD;
return failure;
}
return size * nmemb;
}
-enum HandleState {
- ReadyForNewHandle,
- NeedSocketForNewHandle,
- NoMoreHandles
-};
-
-CURLcode test(char *url)
+static CURLcode test_lib2032(char *URL) /* libntlmconnect */
{
+ enum HandleState {
+ ReadyForNewHandle,
+ NeedSocketForNewHandle,
+ NoMoreHandles
+ };
+
CURLcode res = CURLE_OK;
CURLM *multi = NULL;
int running;
int i;
int num_handles = 0;
enum HandleState state = ReadyForNewHandle;
- size_t urllen = strlen(url) + 4 + 1;
+ size_t urllen = strlen(URL) + 4 + 1;
char *full_url = malloc(urllen);
start_test_timing();
easy_init(ntlm_easy[num_handles]);
if(num_handles % 3 == 2) {
- curl_msnprintf(full_url, urllen, "%s0200", url);
+ curl_msnprintf(full_url, urllen, "%s0200", URL);
easy_setopt(ntlm_easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
}
else {
- curl_msnprintf(full_url, urllen, "%s0100", url);
+ curl_msnprintf(full_url, urllen, "%s0100", URL);
easy_setopt(ntlm_easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
}
easy_setopt(ntlm_easy[num_handles], CURLOPT_FRESH_CONNECT, 1L);
multi_perform(multi, &running);
curl_mfprintf(stderr, "%s:%d running %d state %d\n",
- __FILE__, __LINE__, running, state);
+ __FILE__, __LINE__, running, state);
abort_on_test_timeout();
return prereq_cb->prereq_retcode;
}
-CURLcode test(char *URL)
+static CURLcode test_lib2082(char *URL) /* libprereq */
{
PRCS prereq_cb;
CURLcode ret = CURLE_OK;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#ifndef CURL_DISABLE_WEBSOCKETS
curl_mfprintf(stderr, "returns error from callback\n");
return nitems;
}
+#endif
-CURLcode test(char *URL)
+static CURLcode test_lib2301(char *URL)
{
+#ifndef CURL_DISABLE_WEBSOCKETS
CURL *curl;
CURLcode res = CURLE_OK;
}
curl_global_cleanup();
return res;
-}
-
-#else /* no WebSockets */
-NO_SUPPORT_BUILT_IN
+#else
+ NO_SUPPORT_BUILT_IN
#endif
+}
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#ifndef CURL_DISABLE_WEBSOCKETS
return blen;
}
-
static size_t t2302_write_cb(char *buffer, size_t size, size_t nitems, void *p)
{
struct ws_data *ws_data = p;
curl_mfprintf(stderr, "returns error from callback\n");
return nitems;
}
+#endif
-CURLcode test(char *URL)
+static CURLcode test_lib2302(char *URL)
{
+#ifndef CURL_DISABLE_WEBSOCKETS
CURL *curl;
CURLcode res = CURLE_OK;
struct ws_data ws_data;
}
curl_global_cleanup();
return res;
-}
-
#else
-NO_SUPPORT_BUILT_IN
+ NO_SUPPORT_BUILT_IN
#endif
+}
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#ifndef CURL_DISABLE_WEBSOCKETS
} while(i++ < 10);
t2304_websocket_close(curl);
}
+#endif
-CURLcode test(char *URL)
+static CURLcode test_lib2304(char *URL)
{
+#ifndef CURL_DISABLE_WEBSOCKETS
CURL *curl;
CURLcode res = CURLE_OK;
}
curl_global_cleanup();
return res;
-}
-
#else
-NO_SUPPORT_BUILT_IN
+ NO_SUPPORT_BUILT_IN
#endif
+}
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "testtrace.h"
-#include <curl/curl.h>
-
-#define URL2 libtest_arg2
-
-CURLcode test(char *URL)
+static CURLcode test_lib2306(char *URL)
{
/* first a fine GET response, then a bad one */
CURL *cl;
goto test_cleanup;
/* reuse handle, do a second transfer */
- easy_setopt(cl, CURLOPT_URL, URL2);
+ easy_setopt(cl, CURLOPT_URL, libtest_arg2);
res = curl_easy_perform(cl);
test_cleanup:
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "testtrace.h"
-#include <curl/curl.h>
-
static size_t cb_curl(char *buffer, size_t size, size_t nmemb, void *userp)
{
(void)buffer;
return CURL_WRITEFUNC_ERROR;
}
-CURLcode test(char *URL)
+static CURLcode test_lib2308(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "testtrace.h"
-#include <curl/curl.h>
-
static size_t cb_ignore(char *buffer, size_t size, size_t nmemb, void *userp)
{
(void)buffer;
return CURL_WRITEFUNC_ERROR;
}
-CURLcode test(char *URL)
+static CURLcode test_lib2309(char *URL)
{
CURL *curl;
CURL *curldupe;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib2402(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl[NUM_HANDLES] = {0};
int running;
CURLM *m = NULL;
- int i;
+ size_t i;
char target_url[256];
char dnsentry[256];
struct curl_slist *slist = NULL;
multi_setopt(m, CURLMOPT_MAXCONNECTS, 1L);
- /* get NUM_HANDLES easy handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ /* get each easy handle */
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
curl_msnprintf(target_url, sizeof(target_url),
"https://localhost:%s/path/2402%04i",
- port, i + 1);
+ port, (int)i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go http2 */
curl_mfprintf(stderr, "Start at URL 0\n");
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* add handle to multi */
multi_add_handle(m, curl[i]);
/* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
curl_multi_remove_handle(m, curl[i]);
curl_easy_cleanup(curl[i]);
}
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib2404(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl[NUM_HANDLES] = {0};
int running;
CURLM *m = NULL;
- int i;
+ size_t i;
char target_url[256];
char dnsentry[256];
struct curl_slist *slist = NULL;
multi_setopt(m, CURLMOPT_MAXCONNECTS, 1L);
- /* get NUM_HANDLES easy handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ /* get each easy handle */
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
curl_msnprintf(target_url, sizeof(target_url),
"https://localhost:%s/path/2404%04i",
- port, i + 1);
+ port, (int)i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go http2 */
easy_setopt(curl[i], CURLOPT_RESOLVE, slist);
- easy_setopt(curl[i], CURLOPT_STREAM_WEIGHT, (long)128 + i);
+ easy_setopt(curl[i], CURLOPT_STREAM_WEIGHT, (long)i + 128);
}
curl_mfprintf(stderr, "Start at URL 0\n");
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* add handle to multi */
multi_add_handle(m, curl[i]);
/* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
curl_multi_remove_handle(m, curl[i]);
curl_easy_cleanup(curl[i]);
}
#include "warnless.h"
#include "memdebug.h"
-
- /* ---------------------------------------------------------------- */
+/* ---------------------------------------------------------------- */
#define test_check(expected_fds) \
if(res != CURLE_OK) { \
test_check(expected_fds); \
} while(0)
- /* ---------------------------------------------------------------- */
+/* ---------------------------------------------------------------- */
enum {
TEST_USE_HTTP1 = 0,
return res;
}
-CURLcode test(char *URL)
+static CURLcode test_lib2405(char *URL)
{
CURLcode res = CURLE_OK;
unsigned int fd_count = 0;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib2502(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl[NUM_HANDLES] = {0};
int running;
CURLM *m = NULL;
- int i;
+ size_t i;
char target_url[256];
char dnsentry[256];
struct curl_slist *slist = NULL;
multi_setopt(m, CURLMOPT_MAXCONNECTS, 1L);
- /* get NUM_HANDLES easy handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ /* get each easy handle */
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
curl_msnprintf(target_url, sizeof(target_url),
"https://localhost:%s/path/2502%04i",
- port, i + 1);
+ port, (int)i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go http2 */
curl_mfprintf(stderr, "Start at URL 0\n");
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
/* add handle to multi */
multi_add_handle(m, curl[i]);
/* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
curl_multi_remove_handle(m, curl[i]);
curl_easy_cleanup(curl[i]);
}
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "testtrace.h"
#include "memdebug.h"
return res;
}
+#endif
-CURLcode test(char *URL)
+static CURLcode test_lib2700(char *URL)
{
+#ifndef CURL_DISABLE_WEBSOCKETS
CURLcode res = CURLE_OK;
bool stop = false;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
return res;
-}
-
#else
-NO_SUPPORT_BUILT_IN
+ NO_SUPPORT_BUILT_IN
#endif
+}
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3010(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *curl = NULL;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3025(char *URL)
{
CURLcode res;
CURL *curl;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib3026(char *URL)
{
#if defined(CURL_WINDOWS_UWP) || defined(UNDER_CE)
typedef HANDLE curl_win_thread_handle_t;
return NULL;
}
-CURLcode test(char *URL)
+static CURLcode test_lib3026(char *URL)
{
CURLcode results[NUM_THREADS];
pthread_t tids[NUM_THREADS];
}
#else /* without pthread or Windows, this test doesn't work */
-CURLcode test(char *URL)
+static CURLcode test_lib3026(char *URL)
{
curl_version_info_data *ver;
(void)URL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3027(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3100(char *URL)
{
CURLcode res;
CURL *curl;
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3101(char *URL)
{
CURLcode res;
CURL *curl;
return size * nmemb;
}
-CURLcode test(char *URL)
+static CURLcode test_lib3102(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3103(char *URL)
{
CURLcode res = CURLE_OK;
CURLSH *share;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3104(char *URL)
{
CURLcode res = CURLE_OK;
CURLSH *share;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3105(char *URL)
{
CURL *curls = NULL;
CURLM *multi = NULL;
const char *URL;
CURLSH *share;
CURLcode result;
- int thread_id;
+ size_t thread_id;
struct curl_slist *contents;
};
static void execute(CURLSH *share, struct Ctx *ctx)
{
- int i;
+ size_t i;
curl_mutex_t mutexes[CURL_LOCK_DATA_LAST - 1];
curl_thread_t thread[THREAD_SIZE];
- for(i = 0; i < CURL_LOCK_DATA_LAST - 1; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(mutexes); i++) {
Curl_mutex_init(&mutexes[i]);
}
curl_share_setopt(share, CURLSHOPT_LOCKFUNC, t3207_test_lock);
curl_share_setopt(share, CURLSHOPT_USERDATA, (void *)mutexes);
curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
- for(i = 0; i < THREAD_SIZE; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(thread); i++) {
thread[i] = Curl_thread_create(test_thread, (void *)&ctx[i]);
}
- for(i = 0; i < THREAD_SIZE; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(thread); i++) {
if(thread[i]) {
Curl_thread_join(&thread[i]);
Curl_thread_destroy(&thread[i]);
}
curl_share_setopt(share, CURLSHOPT_LOCKFUNC, NULL);
curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, NULL);
- for(i = 0; i < CURL_LOCK_DATA_LAST - 1; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(mutexes); i++) {
Curl_mutex_destroy(&mutexes[i]);
}
}
static void execute(CURLSH *share, struct Ctx *ctx)
{
- int i;
+ size_t i;
(void) share;
for(i = 0; i < THREAD_SIZE; i++) {
test_thread((void *)&ctx[i]);
#endif
-CURLcode test(char *URL)
+static CURLcode test_lib3207(char *URL)
{
CURLcode res = CURLE_OK;
- int i;
+ size_t i;
CURLSH* share;
struct Ctx ctx[THREAD_SIZE];
goto test_cleanup;
}
- for(i = 0; i < THREAD_SIZE; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(ctx); i++) {
ctx[i].share = share;
ctx[i].URL = URL;
ctx[i].thread_id = i;
execute(share, ctx);
- for(i = 0; i < THREAD_SIZE; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(ctx); i++) {
if(ctx[i].result) {
res = ctx[i].result;
}
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib3208(char *URL)
{
CURL *curl = NULL;
CURLM *multi = NULL;
testcounter = 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib500(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib501(char *URL)
{
CURLcode res;
CURL *curl;
* Get a single URL without select().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib502(char *URL)
{
CURL *c = NULL;
CURLM *m = NULL;
* auth info.
*/
-CURLcode test(char *URL)
+static CURLcode test_lib503(char *URL)
{
CURL *c = NULL;
CURLM *m = NULL;
* Use multi interface to get document over proxy with bad port number.
* This caused the interface to "hang" in libcurl 7.10.2.
*/
-CURLcode test(char *URL)
+static CURLcode test_lib504(char *URL)
{
CURL *c = NULL;
CURLcode res = CURLE_OK;
* Example based on source code provided by Erick Nuwendam. Thanks!
*/
-CURLcode test(char *URL)
+static CURLcode test_lib505(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
if(code) {
int i = 0;
curl_mfprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
- tdata->url, i, (int)code);
+ tdata->url, i, (int)code);
}
curl_mprintf("CLEANUP\n");
}
/* test function */
-CURLcode test(char *URL)
+static CURLcode test_lib506(char *URL)
{
CURLcode res;
CURLSHcode scode = CURLSHE_OK;
scode = curl_share_cleanup(share);
if(scode != CURLSHE_OK)
curl_mfprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
- (int)scode);
+ (int)scode);
curl_mprintf("GLOBAL_CLEANUP\n");
curl_global_cleanup();
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib507(char *URL)
{
CURL *curls = NULL;
CURLM *multi = NULL;
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib508(char *URL)
{
static const char testdata[] =
"this is what we post to the silly web server\n";
}
-CURLcode test(char *URL)
+static CURLcode test_lib509(char *URL)
{
unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib510(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib511(char *URL)
{
CURLcode res;
CURL *curl;
/* Test case code based on source in a bug report filed by James Bursa on
28 Apr 2004 */
-CURLcode test(char *URL)
+static CURLcode test_lib512(char *URL)
{
CURLcode code;
int rc = 99;
return CURL_READFUNC_ABORT;
}
-CURLcode test(char *URL)
+static CURLcode test_lib513(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib514(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib515(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib516(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib517(char *URL)
{
struct dcheck {
const char *input;
time_t out = curl_getdate(dates[i].input, NULL);
if(out != dates[i].output) {
curl_mprintf("WRONGLY %s => %ld (instead of %ld)\n",
- dates[i].input, (long)out, (long)dates[i].output);
+ dates[i].input, (long)out, (long)dates[i].output);
error++;
}
}
if(!t518_fopen_works()) {
tutil_rlim2str(strbuff1, sizeof(strbuff1), t518_num_open.rlim_max);
curl_msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
- strbuff1);
+ strbuff1);
curl_mfprintf(stderr, "%s\n", t518_msgbuff);
curl_msnprintf(strbuff, sizeof(strbuff),
"fopen fails with lots of fds open");
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib518(char *URL)
{
CURLcode res;
CURL *curl;
#else /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */
-CURLcode test(char *URL)
+static CURLcode test_lib518(char *URL)
{
(void)URL;
curl_mprintf("system lacks necessary system function(s)");
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib519(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib520(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib521(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib523(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib524(char *URL)
{
CURLcode res;
CURL *curl;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib525(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
hd_src = fopen(libtest_arg2, "rb");
if(!hd_src) {
curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
return TEST_ERR_FOPEN;
}
if(hd == -1) {
/* can't open file, bail out */
curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
fclose(hd_src);
return TEST_ERR_FSTAT;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib526(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl[NUM_HANDLES];
int running;
CURLM *m = NULL;
- int current = 0;
- int i;
+ size_t current = 0;
+ size_t i;
- for(i = 0; i < NUM_HANDLES; i++)
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++)
curl[i] = NULL;
start_test_timing();
global_init(CURL_GLOBAL_ALL);
- /* get NUM_HANDLES easy handles */
- for(i = 0; i < NUM_HANDLES; i++) {
+ /* get each easy handle */
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
easy_init(curl[i]);
/* specify target */
easy_setopt(curl[i], CURLOPT_URL, URL);
curl_easy_cleanup(curl[current]);
curl[current] = NULL;
}
- if(++current < NUM_HANDLES) {
- curl_mfprintf(stderr, "Advancing to URL %d\n", current);
+ if(++current < CURL_ARRAYSIZE(curl)) {
+ curl_mfprintf(stderr, "Advancing to URL %d\n", (int)current);
if(testnum == 532) {
/* first remove the only handle we use */
curl_multi_remove_handle(m, curl[0]);
if((testnum == 526) || (testnum == 528)) {
/* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++) {
curl_multi_remove_handle(m, curl[i]);
curl_easy_cleanup(curl[i]);
}
will be leaked, let's use undocumented cleanup sequence - type UB */
if(res != CURLE_OK)
- for(i = 0; i < NUM_HANDLES; i++)
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++)
curl_easy_cleanup(curl[i]);
curl_multi_cleanup(m);
else if(testnum == 532) {
/* undocumented cleanup sequence - type UB */
- for(i = 0; i < NUM_HANDLES; i++)
+ for(i = 0; i < CURL_ARRAYSIZE(curl); i++)
curl_easy_cleanup(curl[i]);
curl_multi_cleanup(m);
curl_global_cleanup();
}
else {
curl_mfprintf(stderr, "Got an unexpected message from curl: %i\n",
- message->msg);
+ message->msg);
result = 1;
*success = 0;
}
CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
if(result != CURLM_OK) {
curl_mfprintf(stderr, "Curl error on %s (%i) %s\n",
- info, result, curl_multi_strerror(result));
+ info, result, curl_multi_strerror(result));
}
return (int)result;
}
return res;
}
-CURLcode test(char *URL)
+static CURLcode test_lib530(char *URL)
{
CURLcode rc;
/* rerun the same transfer multiple times and make it fail in different
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib533(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
long wasproxy;
if(!curl_easy_getinfo(curl, CURLINFO_USED_PROXY, &wasproxy)) {
curl_mprintf("This %sthe proxy\n", wasproxy ? "used ":
- "DID NOT use ");
+ "DID NOT use ");
}
}
-CURLcode test(char *URL)
+static CURLcode test_lib536(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib537(char *URL)
{
CURLcode res;
CURL *curl;
#else /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */
-CURLcode test(char *URL)
+static CURLcode test_lib537(char *URL)
{
(void)URL;
curl_mprintf("system lacks necessary system function(s)");
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib539(char *URL)
{
CURLcode res;
CURL *curl;
#define PROXYUSERPWD libtest_arg3
#define HOST test_argv[4]
-#undef NUM_HANDLES
-#define NUM_HANDLES 2
-
-static CURL *testeh[NUM_HANDLES];
+static CURL *testeh[2];
static CURLcode init(int num, CURLM *cm, const char *url, const char *userpwd,
struct curl_slist *headers)
if(!msg)
break;
if(msg->msg == CURLMSG_DONE) {
- int i;
+ size_t i;
CURL *e = msg->easy_handle;
curl_mfprintf(stderr, "R: %d - %s\n", (int)msg->data.result,
- curl_easy_strerror(msg->data.result));
+ curl_easy_strerror(msg->data.result));
curl_multi_remove_handle(cm, e);
curl_easy_cleanup(e);
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(testeh); i++) {
if(testeh[i] == e) {
testeh[i] = NULL;
break;
return CURLE_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib540(char *URL)
{
CURLM *cm = NULL;
struct curl_slist *headers = NULL;
char buffer[246]; /* naively fixed-size */
CURLcode res = CURLE_OK;
- int i;
+ size_t i;
- for(i = 0; i < NUM_HANDLES; i++)
+ for(i = 0; i < CURL_ARRAYSIZE(testeh); i++)
testeh[i] = NULL;
start_test_timing();
/* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(testeh); i++) {
curl_multi_remove_handle(cm, testeh[i]);
curl_easy_cleanup(testeh[i]);
}
* Two FTP uploads, the second with no content sent.
*/
-CURLcode test(char *URL)
+static CURLcode test_lib541(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
hd_src = fopen(libtest_arg2, "rb");
if(!hd_src) {
curl_mfprintf(stderr, "fopen failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
}
if(hd == -1) {
/* can't open file, bail out */
curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
* FTP get with NOBODY but no HEADER
*/
-CURLcode test(char *URL)
+static CURLcode test_lib542(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib543(char *URL)
{
static const unsigned char a[] = {
0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib544(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
return CURLIOE_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib547(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib549(char *URL)
{
CURLcode res;
CURL *curl;
return CURLIOE_UNKNOWNCMD;
}
-CURLcode test(char *URL)
+static CURLcode test_lib552(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#define NUM_HEADERS 8
#define SIZE_HEADERS 5000
-CURLcode test(char *URL)
+static CURLcode test_lib553(char *URL)
{
static char testbuf[SIZE_HEADERS + 100];
return res;
}
-CURLcode test(char *URL)
+static CURLcode test_lib554(char *URL)
{
CURLcode res;
return CURLIOE_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib555(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib556(char *URL)
{
CURLcode res;
CURL *curl;
if((size_t)write(STDOUT_FILENO, buf, nread) != nread) {
#endif
curl_mfprintf(stderr, "write() failed: errno %d (%s)\n",
- errno, strerror(errno));
+ errno, strerror(errno));
res = TEST_ERR_FAILURE;
break;
}
(void)curl_msprintf(us_test[i].result, "%hu", us_test[i].num);
if(memcmp(us_test[i].result,
- us_test[i].expected,
- strlen(us_test[i].expected))) {
+ us_test[i].expected,
+ strlen(us_test[i].expected))) {
curl_mprintf("unsigned short test #%.2d: Failed "
"(Expected: %s Got: %s)\n",
i, us_test[i].expected, us_test[i].result);
ss_test[i].expected,
strlen(ss_test[i].expected))) {
curl_mprintf("signed short test #%.2d: Failed (Expected: %s Got: %s)\n",
- i, ss_test[i].expected, ss_test[i].result);
+ i, ss_test[i].expected, ss_test[i].result);
failed++;
}
(void)curl_msprintf(ui_test[i].result, "%u", ui_test[i].num);
if(memcmp(ui_test[i].result,
- ui_test[i].expected,
- strlen(ui_test[i].expected))) {
+ ui_test[i].expected,
+ strlen(ui_test[i].expected))) {
curl_mprintf("unsigned int test #%.2d: Failed (Expected: %s Got: %s)\n",
- i, ui_test[i].expected, ui_test[i].result);
+ i, ui_test[i].expected, ui_test[i].result);
failed++;
}
si_test[i].expected,
strlen(si_test[i].expected))) {
curl_mprintf("signed int test #%.2d: Failed (Expected: %s Got: %s)\n",
- i, si_test[i].expected, si_test[i].result);
+ i, si_test[i].expected, si_test[i].result);
failed++;
}
(void)curl_msprintf(ul_test[i].result, "%lu", ul_test[i].num);
if(memcmp(ul_test[i].result,
- ul_test[i].expected,
- strlen(ul_test[i].expected))) {
+ ul_test[i].expected,
+ strlen(ul_test[i].expected))) {
curl_mprintf("unsigned long test #%.2d: Failed (Expected: %s Got: %s)\n",
- i, ul_test[i].expected, ul_test[i].result);
+ i, ul_test[i].expected, ul_test[i].result);
failed++;
}
sl_test[i].expected,
strlen(sl_test[i].expected))) {
curl_mprintf("signed long test #%.2d: Failed (Expected: %s Got: %s)\n",
- i, sl_test[i].expected, sl_test[i].result);
+ i, sl_test[i].expected, sl_test[i].result);
failed++;
}
co_test[i].expected,
strlen(co_test[i].expected))) {
curl_mprintf("curl_off_t test #%.2d: Failed (Expected: %s Got: %s)\n",
- i, co_test[i].expected, co_test[i].result);
+ i, co_test[i].expected, co_test[i].result);
failed++;
}
if(strcmp(buf, buf2)) {
/* they shouldn't differ */
curl_mprintf("sprintf line %d failed:\nwe '%s'\nsystem: '%s'\n",
- linenumber, buf, buf2);
+ linenumber, buf, buf2);
return 1;
}
return 0;
if(len != buflen) {
/* they shouldn't differ */
curl_mprintf("sprintf strlen:%d failed:\nwe '%zu'\nsystem: '%zu'\n",
- linenumber, buflen, len);
+ linenumber, buflen, len);
return 1;
}
return 0;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib557(char *URL)
{
int errors = 0;
(void)URL; /* not used */
#endif
errors += test_pos_arguments();
-
errors += test_weird_arguments();
-
errors += test_unsigned_short_formatting();
-
errors += test_signed_short_formatting();
-
errors += test_unsigned_int_formatting();
-
errors += test_signed_int_formatting();
-
errors += test_unsigned_long_formatting();
-
errors += test_signed_long_formatting();
-
errors += test_curl_off_t_formatting();
-
errors += test_string_formatting();
-
errors += test_float_formatting();
-
errors += test_oct_hex_formatting();
-
errors += test_return_codes();
if(errors)
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib558(char *URL)
{
unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
#include "testtrace.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib559(char *URL)
{
CURLcode res;
CURL *curl;
* fast/different compared to the real/distant servers we saw the bug happen
* with.
*/
-CURLcode test(char *URL)
+static CURLcode test_lib560(char *URL)
{
CURL *http_handle = NULL;
CURLM *multi_handle = NULL;
*/
-CURLcode test(char *URL)
+static CURLcode test_lib562(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib564(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib566(char *URL)
{
CURLcode res;
CURL *curl;
/*
* Test a simple OPTIONS request with a custom header
*/
-CURLcode test(char *URL)
+static CURLcode test_lib567(char *URL)
{
CURLcode res;
CURL *curl;
/*
* Test the Client->Server ANNOUNCE functionality (PUT style)
*/
-CURLcode test(char *URL)
+static CURLcode test_lib568(char *URL)
{
CURLcode res;
CURL *curl;
/*
* Test Session ID capture
*/
-CURLcode test(char *URL)
+static CURLcode test_lib569(char *URL)
{
CURLcode res;
CURL *curl;
res = curl_easy_perform(curl);
if(res != (int)CURLE_BAD_FUNCTION_ARGUMENT) {
curl_mfprintf(stderr, "This should have failed. "
- "Cannot setup without a Transport: header");
+ "Cannot setup without a Transport: header");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
#include "testutil.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib570(char *URL)
{
CURLcode res;
CURL *curl;
else {
if(memcmp(RTP_DATA, data + i, message_size - i) != 0) {
curl_mprintf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n",
- message_size - i, data + i);
+ message_size - i, data + i);
/* return failure; */
}
}
return size * nmemb;
}
-CURLcode test(char *URL)
+static CURLcode test_lib571(char *URL)
{
CURLcode res;
CURL *curl;
/*
* Test GET_PARAMETER: PUT, HEARTBEAT, and POST
*/
-CURLcode test(char *URL)
+static CURLcode test_lib572(char *URL)
{
CURLcode res;
CURL *curl;
return TEST_ERR_MAJOR_BAD;
}
-
test_setopt(curl, CURLOPT_HEADERDATA, stdout);
test_setopt(curl, CURLOPT_WRITEDATA, stdout);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
* Get a single URL without select().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib573(char *URL)
{
CURL *c = NULL;
CURLM *m = NULL;
curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time);
if(connect_time < dbl_epsilon) {
curl_mfprintf(stderr, "connect time %e is < epsilon %e\n",
- connect_time, dbl_epsilon);
+ connect_time, dbl_epsilon);
res = TEST_ERR_MAJOR_BAD;
}
{
(void)ptr;
curl_mfprintf(stderr, "lib574: match string '%s' against pattern '%s'\n",
- string, pattern);
+ string, pattern);
return CURL_FNMATCHFUNC_MATCH;
}
-CURLcode test(char *URL)
+static CURLcode test_lib574(char *URL)
{
CURLcode res;
CURL *curl;
* 3. with multi interface
*/
-CURLcode test(char *URL)
+static CURLcode test_lib575(char *URL)
{
CURL *handle = NULL;
CURL *duphandle = NULL;
if(finfo->filetype == CURLFILETYPE_FILE) {
ch_d->print_content = 1;
curl_mprintf("Content:\n"
- "-------------------------------------------------------------\n");
+ "-------------------------------------------"
+ "------------------\n");
}
if(strcmp(finfo->filename, "someothertext.txt") == 0) {
curl_mprintf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n");
return CURL_CHUNK_END_FUNC_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib576(char *URL)
{
CURL *handle = NULL;
CURLcode res = CURLE_OK;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib578(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
{
FILE *moo = fopen(libtest_arg2, "ab");
curl_mfprintf(moo ? moo : stderr, "Progress: end UL %zu/%zu\n",
- last_ul, last_ul_total);
+ last_ul, last_ul_total);
if(moo)
fclose(moo);
else
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib579(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
}
else {
curl_mfprintf(stderr, "Got an unexpected message from curl: %i\n",
- (int)message->msg);
+ (int)message->msg);
result = 1;
*success = 0;
}
CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
if(result != CURLM_OK) {
curl_mfprintf(stderr, "Curl error on %s (%i) %s\n",
- info, result, curl_multi_strerror(result));
+ info, result, curl_multi_strerror(result));
}
}
}
}
-CURLcode test(char *URL)
+static CURLcode test_lib582(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
hd_src = fopen(libtest_arg2, "rb");
if(!hd_src) {
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
return TEST_ERR_FOPEN;
}
if(hd == -1) {
/* can't open file, bail out */
curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
fclose(hd_src);
return TEST_ERR_FSTAT;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib583(char *URL)
{
int stillRunning;
CURLM *multiHandle = NULL;
mres = curl_multi_remove_handle(multiHandle, curl);
if(mres) {
curl_mfprintf(stderr, "curl_multi_remove_handle() failed, "
- "with code %d\n", (int)mres);
+ "with code %d\n", (int)mres);
res = TEST_ERR_MULTI;
}
else
if(code != CURLE_OK) {
int i = 0;
curl_mfprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
- tdata->url, i, (int)code);
+ tdata->url, i, (int)code);
}
curl_mprintf("CLEANUP\n");
}
/* test function */
-CURLcode test(char *URL)
+static CURLcode test_lib586(char *URL)
{
CURLcode res = CURLE_OK;
CURLSHcode scode = CURLSHE_OK;
scode = curl_share_cleanup(share);
if(scode != CURLSHE_OK)
curl_mfprintf(stderr, "curl_share_cleanup failed, code errno %d\n",
- (int)scode);
+ (int)scode);
curl_mprintf("GLOBAL_CLEANUP\n");
curl_global_cleanup();
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib589(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib590(char *URL)
{
CURLcode res;
CURL *curl;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib591(char *URL)
{
CURL *easy = NULL;
CURLM *multi = NULL;
upload = fopen(libtest_arg3, "rb");
if(!upload) {
curl_mfprintf(stderr, "fopen() failed with error (%d) %s\n",
- errno, strerror(errno));
+ errno, strerror(errno));
curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg3);
return TEST_ERR_FOPEN;
}
* with function curl_multi_info_read().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib597(char *URL)
{
CURL *easy = NULL;
CURLM *multi = NULL;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib598(char *URL)
{
CURLcode res;
CURL *curl;
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib599(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
return CURLE_OK;
}
-CURLcode test(char *URL)
+static CURLcode test_lib643(char *URL)
{
CURLcode res;
return len;
}
-
-CURLcode test(char *URL)
+static CURLcode test_lib650(char *URL)
{
CURL *curl = NULL;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib651(char *URL)
{
static char testbuf[17000]; /* more than 16K */
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib652(char *URL)
{
static char testbuf[17000]; /* more than 16K */
#include "warnless.h"
#include "memdebug.h"
-
-CURLcode test(char *URL)
+static CURLcode test_lib653(char *URL)
{
CURL *curls = NULL;
CURLcode res = CURLE_OK;
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib654(char *URL)
{
static const char testdata[] = "dummy\n";
if(pooh.freecount != 2) {
curl_mfprintf(stderr, "free_callback() called %d times instead of 2\n",
- pooh.freecount);
+ pooh.freecount);
res = TEST_ERR_FAILURE;
goto test_cleanup;
}
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib655(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
* Get a single URL without select().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib658(char *URL)
{
CURL *handle = NULL;
CURLcode res = CURLE_OK;
uc = curl_url_set(urlp, CURLUPART_URL, URL, 0);
if(uc) {
curl_mfprintf(stderr, "problem setting CURLUPART_URL: %s.",
- curl_url_strerror(uc));
+ curl_url_strerror(uc));
goto test_cleanup;
}
* Get a single URL without select().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib659(char *URL)
{
CURL *handle = NULL;
CURLcode res = CURLE_OK;
#include "test.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib661(char *URL)
{
CURLcode res;
CURL *curl = NULL;
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
-
test_cleanup:
if(res)
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib666(char *URL)
{
static char testbuf[17000]; /* more than 16K */
return 0; /* no more data left to deliver */
}
-CURLcode test(char *URL)
+static CURLcode test_lib667(char *URL)
{
static const char testdata[] = "dummy";
return len;
}
-CURLcode test(char *URL)
+static CURLcode test_lib668(char *URL)
{
static const char testdata[] = "dummy";
return 0;
}
-CURLcode test(char *URL)
+static CURLcode test_lib670(char *URL)
{
static const char testname[] = "field";
* Get a single URL without select().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib674(char *URL)
{
CURL *handle = NULL;
CURL *handle2;
uc = curl_url_set(urlp, CURLUPART_URL, URL, 0);
if(uc) {
curl_mfprintf(stderr, "problem setting CURLUPART_URL: %s.",
- curl_url_strerror(uc));
+ curl_url_strerror(uc));
goto test_cleanup;
}
/* demonstrate override behavior */
-
easy_setopt(handle, CURLOPT_CURLU, urlp);
easy_setopt(handle, CURLOPT_VERBOSE, 1L);
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib676(char *URL)
{
CURLcode res;
CURL *curl;
#include "warnless.h"
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib677(char *URL)
{
static const char testcmd[] = "A1 IDLE\r\n";
static char testbuf[1024];
}
else if(ec) {
curl_mfprintf(stderr, "curl_easy_send() failed, with code %d (%s)\n",
- (int)ec, curl_easy_strerror(ec));
+ (int)ec, curl_easy_strerror(ec));
res = ec;
goto test_cleanup;
}
}
else if(ec) {
curl_mfprintf(stderr, "curl_easy_recv() failed, with code %d (%s)\n",
- (int)ec, curl_easy_strerror(ec));
+ (int)ec, curl_easy_strerror(ec));
res = ec;
goto test_cleanup;
}
return code;
}
-CURLcode test(char *URL)
+static CURLcode test_lib678(char *URL)
{
CURLcode res = CURLE_OK;
curl_global_init(CURL_GLOBAL_DEFAULT);
#include "memdebug.h"
-CURLcode test(char *URL)
+static CURLcode test_lib694(char *URL)
{
CURLcode res;
CURL *curl;
#include "memdebug.h"
-
/* write callback that does nothing */
static size_t write_it(char *ptr, size_t size, size_t nmemb, void *userdata)
{
return size * nmemb;
}
-CURLcode test(char *URL)
+static CURLcode test_lib695(char *URL)
{
CURL *curl = NULL;
curl_mime *mime1 = NULL;
/* Check for errors */
if(res != CURLE_OK)
curl_mfprintf(stderr, "curl_easy_perform() 1 failed: %s\n",
- curl_easy_strerror(res));
+ curl_easy_strerror(res));
else {
/* phase two, create a mime struct using the mime1 handle */
mime2 = curl_mime_init(curl);
if(res != CURLE_OK)
curl_mfprintf(stderr, "curl_mime_subparts() failed: %sn",
- curl_easy_strerror(res));
+ curl_easy_strerror(res));
else {
mime1 = NULL;
/* Check for errors */
if(res != CURLE_OK)
curl_mfprintf(stderr, "curl_easy_perform() 2 failed: %s\n",
- curl_easy_strerror(res));
+ curl_easy_strerror(res));
}
}
#include "warnless.h"
#include "memdebug.h"
-#define TEST_HANG_TIMEOUT 60 * 1000
-
/*
* Get a single URL without select().
*/
-CURLcode test(char *URL)
+static CURLcode test_lib751(char *URL)
{
CURL *easies[1000];
CURLM *m;
non-existing function return code back */
#define present(x) ((x != CURLE_NOT_BUILT_IN) && (x != CURLE_UNKNOWN_OPTION))
-CURLcode test(char *URL)
+static CURLcode test_lib1521(char *URL)
{
CURL *curl = NULL;
CURL *dep = NULL;
need both of them in the include path), so that we get good in-depth
knowledge about the system we're building this on */
-#define CURL_NO_OLDIES
-#define CURL_DISABLE_DEPRECATION 1
-
#include "curl_setup.h"
#include <curl/curl.h>
extern void wait_ms(int ms); /* wait this many milliseconds */
-#ifndef CURLTESTS_BUNDLED_TEST_H
-extern CURLcode test(char *URL); /* the actual test function provided by each
- individual libXXX.c file */
-#endif
-
extern char *hexdump(const unsigned char *buffer, size_t len);
extern int unitfail;
/* ---------------------------------------------------------------- */
-#define exe_easy_init(A,Y,Z) do { \
- if(((A) = curl_easy_init()) == NULL) { \
+#define exe_easy_init(A,Y,Z) do { \
+ if(((A) = curl_easy_init()) == NULL) { \
curl_mfprintf(stderr, "%s:%d curl_easy_init() failed\n", (Y), (Z)); \
- res = TEST_ERR_EASY_INIT; \
- } \
+ res = TEST_ERR_EASY_INIT; \
+ } \
} while(0)
#define res_easy_init(A) \
/* ---------------------------------------------------------------- */
-#define exe_multi_init(A,Y,Z) do { \
- if(((A) = curl_multi_init()) == NULL) { \
+#define exe_multi_init(A,Y,Z) do { \
+ if(((A) = curl_multi_init()) == NULL) { \
curl_mfprintf(stderr, "%s:%d curl_multi_init() failed\n", (Y), (Z)); \
- res = TEST_ERR_MULTI; \
- } \
+ res = TEST_ERR_MULTI; \
+ } \
} while(0)
#define res_multi_init(A) \
/* ---------------------------------------------------------------- */
-#define exe_easy_setopt(A,B,C,Y,Z) do { \
- CURLcode ec; \
- if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \
- curl_mfprintf(stderr, "%s:%d curl_easy_setopt() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_easy_strerror(ec)); \
- res = ec; \
- } \
+#define exe_easy_setopt(A,B,C,Y,Z) do { \
+ CURLcode ec; \
+ if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \
+ curl_mfprintf(stderr, "%s:%d curl_easy_setopt() failed, " \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_easy_strerror(ec)); \
+ res = ec; \
+ } \
} while(0)
#define res_easy_setopt(A, B, C) \
/* ---------------------------------------------------------------- */
-#define exe_multi_setopt(A, B, C, Y, Z) do { \
- CURLMcode ec; \
- if((ec = curl_multi_setopt((A), (B), (C))) != CURLM_OK) { \
- curl_mfprintf(stderr, "%s:%d curl_multi_setopt() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
- res = TEST_ERR_MULTI; \
- } \
+#define exe_multi_setopt(A, B, C, Y, Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_setopt((A), (B), (C))) != CURLM_OK) { \
+ curl_mfprintf(stderr, "%s:%d curl_multi_setopt() failed, " \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = TEST_ERR_MULTI; \
+ } \
} while(0)
#define res_multi_setopt(A,B,C) \
/* ---------------------------------------------------------------- */
-#define exe_multi_add_handle(A,B,Y,Z) do { \
- CURLMcode ec; \
- if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) { \
+#define exe_multi_add_handle(A,B,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) { \
curl_mfprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
- res = TEST_ERR_MULTI; \
- } \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = TEST_ERR_MULTI; \
+ } \
} while(0)
#define res_multi_add_handle(A, B) \
/* ---------------------------------------------------------------- */
-#define exe_multi_remove_handle(A,B,Y,Z) do { \
- CURLMcode ec; \
- if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) { \
+#define exe_multi_remove_handle(A,B,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) { \
curl_mfprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
- res = TEST_ERR_MULTI; \
- } \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = TEST_ERR_MULTI; \
+ } \
} while(0)
#define res_multi_remove_handle(A, B) \
/* ---------------------------------------------------------------- */
-#define exe_multi_perform(A,B,Y,Z) do { \
- CURLMcode ec; \
- if((ec = curl_multi_perform((A), (B))) != CURLM_OK) { \
+#define exe_multi_perform(A,B,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_perform((A), (B))) != CURLM_OK) { \
curl_mfprintf(stderr, "%s:%d curl_multi_perform() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
- res = TEST_ERR_MULTI; \
- } \
- else if(*((B)) < 0) { \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = TEST_ERR_MULTI; \
+ } \
+ else if(*((B)) < 0) { \
curl_mfprintf(stderr, "%s:%d curl_multi_perform() succeeded, " \
- "but returned invalid running_handles value (%d)\n", \
- (Y), (Z), (int)*((B))); \
- res = TEST_ERR_NUM_HANDLES; \
- } \
+ "but returned invalid running_handles value (%d)\n", \
+ (Y), (Z), (int)*((B))); \
+ res = TEST_ERR_NUM_HANDLES; \
+ } \
} while(0)
#define res_multi_perform(A, B) \
#define exe_multi_fdset(A, B, C, D, E, Y, Z) do { \
CURLMcode ec; \
if((ec = curl_multi_fdset((A), (B), (C), (D), (E))) != CURLM_OK) { \
- curl_mfprintf(stderr, "%s:%d curl_multi_fdset() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ curl_mfprintf(stderr, "%s:%d curl_multi_fdset() failed, " \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
res = TEST_ERR_MULTI; \
} \
else if(*((E)) < -1) { \
- curl_mfprintf(stderr, "%s:%d curl_multi_fdset() succeeded, " \
- "but returned invalid max_fd value (%d)\n", \
- (Y), (Z), (int)*((E))); \
+ curl_mfprintf(stderr, "%s:%d curl_multi_fdset() succeeded, " \
+ "but returned invalid max_fd value (%d)\n", \
+ (Y), (Z), (int)*((E))); \
res = TEST_ERR_NUM_HANDLES; \
} \
} while(0)
/* ---------------------------------------------------------------- */
-#define exe_multi_timeout(A,B,Y,Z) do { \
- CURLMcode ec; \
- if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) { \
+#define exe_multi_timeout(A,B,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) { \
curl_mfprintf(stderr, "%s:%d curl_multi_timeout() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
- res = TEST_ERR_BAD_TIMEOUT; \
- } \
- else if(*((B)) < -1L) { \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = TEST_ERR_BAD_TIMEOUT; \
+ } \
+ else if(*((B)) < -1L) { \
curl_mfprintf(stderr, "%s:%d curl_multi_timeout() succeeded, " \
- "but returned invalid timeout value (%ld)\n", \
- (Y), (Z), (long)*((B))); \
- res = TEST_ERR_BAD_TIMEOUT; \
- } \
+ "but returned invalid timeout value (%ld)\n", \
+ (Y), (Z), (long)*((B))); \
+ res = TEST_ERR_BAD_TIMEOUT; \
+ } \
} while(0)
#define res_multi_timeout(A, B) \
#define exe_multi_poll(A,B,C,D,E,Y,Z) do { \
CURLMcode ec; \
if((ec = curl_multi_poll((A), (B), (C), (D), (E))) != CURLM_OK) { \
- curl_mfprintf(stderr, "%s:%d curl_multi_poll() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ curl_mfprintf(stderr, "%s:%d curl_multi_poll() failed, " \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
res = TEST_ERR_MULTI; \
} \
else if(*((E)) < 0) { \
- curl_mfprintf(stderr, "%s:%d curl_multi_poll() succeeded, " \
- "but returned invalid numfds value (%d)\n", \
- (Y), (Z), (int)*((E))); \
+ curl_mfprintf(stderr, "%s:%d curl_multi_poll() succeeded, " \
+ "but returned invalid numfds value (%d)\n", \
+ (Y), (Z), (int)*((E))); \
res = TEST_ERR_NUM_HANDLES; \
} \
} while(0)
/* ---------------------------------------------------------------- */
-#define exe_multi_wakeup(A,Y,Z) do { \
- CURLMcode ec; \
- if((ec = curl_multi_wakeup((A))) != CURLM_OK) { \
+#define exe_multi_wakeup(A,Y,Z) do { \
+ CURLMcode ec; \
+ if((ec = curl_multi_wakeup((A))) != CURLM_OK) { \
curl_mfprintf(stderr, "%s:%d curl_multi_wakeup() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
- res = TEST_ERR_MULTI; \
- } \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \
+ res = TEST_ERR_MULTI; \
+ } \
} while(0)
#define res_multi_wakeup(A) \
/* ---------------------------------------------------------------- */
-#define exe_select_test(A, B, C, D, E, Y, Z) do { \
- int ec; \
- if(select_wrapper((A), (B), (C), (D), (E)) == -1) { \
- ec = SOCKERRNO; \
- curl_mfprintf(stderr, "%s:%d select() failed, with " \
- "errno %d (%s)\n", \
- (Y), (Z), ec, strerror(ec)); \
- res = TEST_ERR_SELECT; \
- } \
+#define exe_select_test(A, B, C, D, E, Y, Z) do { \
+ int ec; \
+ if(select_wrapper((A), (B), (C), (D), (E)) == -1) { \
+ ec = SOCKERRNO; \
+ curl_mfprintf(stderr, "%s:%d select() failed, with " \
+ "errno %d (%s)\n", \
+ (Y), (Z), ec, strerror(ec)); \
+ res = TEST_ERR_SELECT; \
+ } \
} while(0)
#define res_select_test(A, B, C, D, E) \
tv_test_start = tutil_tvnow(); \
} while(0)
-#define exe_test_timedout(Y,Z) do { \
- long timediff = tutil_tvdiff(tutil_tvnow(), tv_test_start); \
- if(timediff > (TEST_HANG_TIMEOUT)) { \
- curl_mfprintf(stderr, "%s:%d ABORTING TEST, since it seems " \
- "that it would have run forever (%ld ms > %ld ms)\n", \
- (Y), (Z), timediff, (long) (TEST_HANG_TIMEOUT)); \
- res = TEST_ERR_RUNS_FOREVER; \
- } \
+#define exe_test_timedout(Y,Z) do { \
+ long timediff = tutil_tvdiff(tutil_tvnow(), tv_test_start); \
+ if(timediff > (TEST_HANG_TIMEOUT)) { \
+ curl_mfprintf(stderr, "%s:%d ABORTING TEST, since it seems " \
+ "that it would have run forever (%ld ms > %ld ms)\n", \
+ (Y), (Z), timediff, (long) (TEST_HANG_TIMEOUT)); \
+ res = TEST_ERR_RUNS_FOREVER; \
+ } \
} while(0)
#define res_test_timedout() \
/* ---------------------------------------------------------------- */
-#define exe_global_init(A,Y,Z) do { \
- CURLcode ec; \
- if((ec = curl_global_init((A))) != CURLE_OK) { \
+#define exe_global_init(A,Y,Z) do { \
+ CURLcode ec; \
+ if((ec = curl_global_init((A))) != CURLE_OK) { \
curl_mfprintf(stderr, "%s:%d curl_global_init() failed, " \
- "with code %d (%s)\n", \
- (Y), (Z), (int)ec, curl_easy_strerror(ec)); \
- res = ec; \
- } \
+ "with code %d (%s)\n", \
+ (Y), (Z), (int)ec, curl_easy_strerror(ec)); \
+ res = ec; \
+ } \
} while(0)
#define res_global_init(A) \
#define global_init(A) \
chk_global_init((A), (__FILE__), (__LINE__))
-#ifndef CURLTESTS_BUNDLED_TEST_H
#define NO_SUPPORT_BUILT_IN \
- CURLcode test(char *URL) \
{ \
(void)URL; \
- curl_mfprintf(stderr, "Missing support\n"); \
+ curl_mfprintf(stderr, "Missing support\n"); \
return CURLE_UNSUPPORTED_PROTOCOL; \
}
-#endif
+
+/* global default */
+#define NUM_HANDLES 4
/* ---------------------------------------------------------------- */
#endif /* HEADER_CURL_TEST_H */
-#ifdef CURLTESTS_BUNDLED_TEST_H
-extern CURLcode test(char *URL); /* the actual test function provided by each
- individual libXXX.c file */
-
-#undef NO_SUPPORT_BUILT_IN
-#define NO_SUPPORT_BUILT_IN \
- CURLcode test(char *URL) \
- { \
- (void)URL; \
- curl_mfprintf(stderr, "Missing support\n"); \
- return CURLE_UNSUPPORTED_PROTOCOL; \
- }
-#endif
-
/* Set default that each test may override */
#undef TEST_HANG_TIMEOUT
#define TEST_HANG_TIMEOUT 60 * 1000
-
-#undef NUM_HANDLES
-#define NUM_HANDLES 4
* SPDX-License-Identifier: curl
*
***************************************************************************/
-
#include "test.h"
#include "testutil.h"
#include "testtrace.h"
+++ /dev/null
-#!/usr/bin/env perl
-#***************************************************************************
-# _ _ ____ _
-# Project ___| | | | _ \| |
-# / __| | | | |_) | |
-# | (__| |_| | _ <| |___
-# \___|\___/|_| \_\_____|
-#
-# Copyright (C) Viktor Szakats
-#
-# 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
-#
-###########################################################################
-
-# Bundle up individual tests into a single binary. The resulting binary can run
-# individual tests by passing their name (without '.c') as the first argument.
-#
-# Usage: mk-bundle.pl [<directory>]
-
-use strict;
-use warnings;
-
-my $src_dir = @ARGV ? $ARGV[0] : ".";
-
-# Read list of tests
-open my $fh, "<", "$src_dir/Makefile.inc" or die "Cannot open '$src_dir/Makefile.inc': $!";
-
-print <<HEADER
-/* !checksrc! disable COPYRIGHT all */
-/* !checksrc! disable INCLUDEDUP all */
-/* !checksrc! disable UNUSEDIGNORE all */
-
-#define CURLTESTS_BUNDLED
-#define CURLTESTS_BUNDLED_TEST_H
-#include "first.h"
-HEADER
- ;
-
-my $tlist = "";
-
-while(my $line = <$fh>) {
- chomp $line;
- if($line =~ /([a-z0-9]+)_SOURCES\ =\ ([a-z0-9]+)\.c/) {
- my $name = $1;
- my $src = "$2.c";
-
- # Make common symbols unique across test sources
- foreach my $symb ("test", "unit_setup", "unit_stop") {
- print "#undef $symb\n";
- print "#define $symb ${symb}_$name\n";
- }
-
- print "#include \"$src\"\n";
- print "\n";
- $tlist .= " {\"$name\", test_$name},\n";
- }
-}
-
-close $fh;
-
-print <<FOOTER
-static const struct onetest s_tests[] = {
-$tlist};
-
-#undef CURLTESTS_BUNDLED_TEST_H
-
-#include "first.c"
-FOOTER
- ;
}
if($tool =~ /^lib/) {
- if($bundle) {
- $tool = "libtests" . exe_ext('TOOL');
- }
+ $tool = "libtests" . exe_ext('TOOL');
$CMDLINE=$LIBDIR . $tool;
}
elsif($tool =~ /^tool/) {
- if($bundle) {
- $tool = "tunits" . exe_ext('TOOL')
- }
+ $tool = "tunits" . exe_ext('TOOL');
$CMDLINE=$TUNITDIR . $tool;
}
elsif($tool =~ /^unit/) {
- if($bundle) {
- $tool = "units" . exe_ext('TOOL')
- }
+ $tool = "units" . exe_ext('TOOL');
$CMDLINE=$UNITDIR . $tool;
}
$CMDLINE=exerunner() . $CMDLINE;
- if($bundle) {
- if($gdbthis) {
- $cmdargs =" $tool_name$cmdargs";
- }
- else {
- $CMDLINE.=" $tool_name";
- }
+ if($gdbthis) {
+ $cmdargs =" $tool_name$cmdargs";
+ }
+ else {
+ $CMDLINE.=" $tool_name";
}
$DBGCURL=$CMDLINE;
logmsg sprintf("* Env: %s%s%s%s%s", $valgrind?"Valgrind ":"",
$run_duphandle?"test-duphandle ":"",
$run_event_based?"event-based ":"",
- $bundle?"bundle ":"",
$nghttpx_h3);
logmsg sprintf("%s\n", $libtool?"Libtool ":"");
logmsg ("* Seed: $randseed\n");
shift @ARGV;
}
-# Detect a test bundle build.
-# 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
- $bundle=1;
- $ENV{'CURL_TEST_BUNDLES'} = 1;
-}
-
delete $ENV{'DEBUGINFOD_URLS'} if($ENV{'DEBUGINFOD_URLS'} && $no_debuginfod);
if(!$randseed) {
#
# SPDX-License-Identifier: curl
-server_bundle.c
servers
-buildinfo
-dnsd
-mqttd
-resolve
-rtspd
-sockfilt
-socksd
-sws
-tftpd
+servers.c
#
###########################################################################
-# Get 'SERVERPROGS', '<target>_SOURCES' variables, 'MEMDEBUG', 'CURLX_SRCS', 'USEFUL', 'INET_PTON', 'UTIL', 'FIRSTFILES'
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, MEMDEBUG, CURLX_SRCS, TESTFILES variables
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
+add_custom_command(
+ OUTPUT "${BUNDLE_SRC}"
+ COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES}
+ ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+ DEPENDS
+ "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES}
+ VERBATIM)
+
if(ENABLE_SERVER_DEBUG AND ENABLE_CURLDEBUG)
set_source_files_properties("../../lib/memdebug.c" PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
endif()
-if(CURL_TEST_BUNDLES)
- add_custom_command(
- OUTPUT "server_bundle.c"
- COMMAND ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/mk-bundle.pl" ${SERVERPROGS} > "server_bundle.c"
- DEPENDS
- "${CMAKE_CURRENT_SOURCE_DIR}/mk-bundle.pl" ${FIRSTFILES}
- "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
- VERBATIM)
-
- set(SERVERPROGS "servers")
- set(servers_SOURCES ${MEMDEBUG} ${CURLX_SRCS} ${USEFUL} ${INET_PTON} ${UTIL} "server_bundle.c")
+add_executable(servers EXCLUDE_FROM_ALL ${MEMDEBUG} ${CURLX_SRCS} ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps servers)
+target_include_directories(servers PRIVATE
+ "${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
+ "${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
+ "${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx
+ "${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h", "tool_xattr.h"
+ "${PROJECT_SOURCE_DIR}/tests/server" # for "first.h"
+)
+target_link_libraries(servers ${CURL_LIBS})
+if(ENABLE_SERVER_DEBUG)
+ set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
endif()
-
-foreach(_target IN LISTS SERVERPROGS)
- set(_target_name "${_target}")
- add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
- add_dependencies(testdeps ${_target_name})
- 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}/lib/curlx" # for curlx
- "${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h", "tool_xattr.h"
- "${PROJECT_SOURCE_DIR}/tests/server" # for "first.h"
- )
- target_link_libraries(${_target_name} ${CURL_LIBS})
- if(ENABLE_SERVER_DEBUG)
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
- endif()
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL")
- # Test servers simply are standalone programs that do not use libcurl
- # library. For convenience and to ease portability of these servers,
- # some source code files from the libcurl subdirectory are also used
- # to build the servers. In order to achieve proper linkage of these
- # files on Windows targets it is necessary to build the test servers
- # with CURL_STATICLIB defined, independently of how libcurl is built.
- if(WIN32)
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
- endif()
- set_target_properties(${_target_name} PROPERTIES
- OUTPUT_NAME "${_target}"
- PROJECT_LABEL "Test server ${_target}")
-endforeach()
+set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL" "CURL_NO_OLDIES")
+# Test servers simply are standalone programs that do not use libcurl
+# library. For convenience and to ease portability of these servers,
+# some source code files from the libcurl subdirectory are also used
+# to build the servers. In order to achieve proper linkage of these
+# files on Windows targets it is necessary to build the test servers
+# with CURL_STATICLIB defined, independently of how libcurl is built.
+if(WIN32)
+ set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
+endif()
+set_target_properties(servers PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
-I$(top_srcdir)/src \
-I$(top_srcdir)/tests/server
-# Prevent LIBS from being used for all link targets
-LIBS = $(BLANK_AT_MAKETIME)
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, MEMDEBUG, CURLX_SRCS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt .checksrc $(FIRSTFILES) $(UTILS) $(TESTFILES)
CFLAGS += @CURL_CFLAG_EXTRAS@
+# Prevent LIBS from being used for all link targets
+LIBS = $(BLANK_AT_MAKETIME)
+
if DOING_NATIVE_WINDOWS
AM_CPPFLAGS += -DCURL_STATICLIB
endif
endif
endif
-AM_CPPFLAGS += -DWITHOUT_LIBCURL
-
-# Makefile.inc provides neat definitions
-include Makefile.inc
-
-EXTRA_DIST = CMakeLists.txt .checksrc mk-bundle.pl $(FIRSTFILES)
+AM_CPPFLAGS += -DWITHOUT_LIBCURL -DCURL_NO_OLDIES
-if USE_TEST_BUNDLES
-server_EXCLUDE =
+bundle_EXCLUDE =
if ENABLE_SERVER_DEBUG
if CURLDEBUG
-server_EXCLUDE += $(MEMDEBUG)
+bundle_EXCLUDE += $(MEMDEBUG)
endif
endif
-server_bundle.c: $(top_srcdir)/tests/server/mk-bundle.pl $(MEMDEBUG) $(CURLX_SRCS) $(USEFUL) $(INET_PTON) $(UTIL) $(FIRSTFILES)
- @PERL@ $(top_srcdir)/tests/server/mk-bundle.pl $(MEMDEBUG) $(CURLX_SRCS) $(USEFUL) $(INET_PTON) $(UTIL) $(SERVERPROGS) --exclude $(server_EXCLUDE) > server_bundle.c
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(MEMDEBUG) $(CURLX_SRCS) $(TESTFILES)
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(MEMDEBUG) $(CURLX_SRCS) --test $(TESTFILES) --exclude $(bundle_EXCLUDE) > $(BUNDLE_SRC)
-noinst_PROGRAMS = servers
-nodist_servers_SOURCES = server_bundle.c
-servers_SOURCES = $(server_EXCLUDE)
+noinst_PROGRAMS = $(BUNDLE)
+nodist_servers_SOURCES = $(BUNDLE_SRC)
+servers_SOURCES = $(bundle_EXCLUDE)
servers_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
servers_CFLAGS = $(AM_CFLAGS)
-CLEANFILES = server_bundle.c
-else
-noinst_PROGRAMS = $(SERVERPROGS)
-endif
+CLEANFILES = $(BUNDLE_SRC)
CHECKSRC = $(CS_$(V))
CS_0 = @echo " RUN " $@;
# ignore generated C files since they play by slightly different rules!
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
- -W$(srcdir)/server_bundle.c \
+ -W$(srcdir)/$(BUNDLE_SRC) \
$(srcdir)/*.[ch])
if NOT_CURL_CI
all-local: checksrc
endif
+
+clean-local:
+ rm -f $(BUNDLE)
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
-SERVERPROGS = resolve rtspd sockfilt sws tftpd socksd mqttd dnsd
+BUNDLE = servers
+BUNDLE_SRC = servers.c
+
+# Files referenced from the bundle source
+FIRSTFILES = first.c first.h
+
+# Common files used by test programs
+UTILS = getpart.c getpart.h util.c util.h
MEMDEBUG = \
../../lib/memdebug.c \
CURLX_SRCS = \
../../lib/curlx/base64.c \
+ ../../lib/curlx/inet_pton.c \
../../lib/curlx/multibyte.c \
../../lib/curlx/nonblock.c \
../../lib/curlx/strparse.c \
../../lib/curlx/warnless.c \
../../lib/curlx/winapi.c
-CURLX_HDRS = \
- ../../lib/curlx/base64.h \
- ../../lib/curlx/curlx.h \
- ../../lib/curlx/multibyte.h \
- ../../lib/curlx/nonblock.h \
- ../../lib/curlx/timediff.h \
- ../../lib/curlx/timeval.h \
- ../../lib/curlx/version_win32.h \
- ../../lib/curlx/warnless.h \
- ../../lib/curlx/winapi.h
-
-UTIL = \
- getpart.c \
- getpart.h \
- util.c \
- util.h \
- server_setup.h
-
-FIRSTFILES = \
- first.c \
- first.h
-
-INET_PTON = \
- ../../lib/curlx/inet_pton.c
-
-resolve_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
- resolve.c
-resolve_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-resolve_CFLAGS = $(AM_CFLAGS)
-
-rtspd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
- server_sockaddr.h \
- rtspd.c
-rtspd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-rtspd_CFLAGS = $(AM_CFLAGS)
-
-sockfilt_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) $(INET_PTON) \
- server_sockaddr.h \
- sockfilt.c
-sockfilt_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-sockfilt_CFLAGS = $(AM_CFLAGS)
-
-socksd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) $(INET_PTON) \
- server_sockaddr.h \
- socksd.c
-socksd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-socksd_CFLAGS = $(AM_CFLAGS)
-
-mqttd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
- server_sockaddr.h \
- mqttd.c
-mqttd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-mqttd_CFLAGS = $(AM_CFLAGS)
-
-sws_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) $(INET_PTON) \
- server_sockaddr.h \
- sws.c
-sws_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-sws_CFLAGS = $(AM_CFLAGS)
-
-tftpd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
- server_sockaddr.h \
- tftpd.c \
- tftp.h
-tftpd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-tftpd_CFLAGS = $(AM_CFLAGS)
-
-dnsd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
- dnsd.c
-dnsd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-dnsd_CFLAGS = $(AM_CFLAGS)
+# All test servers
+TESTFILES = \
+ dnsd.c \
+ mqttd.c \
+ resolve.c \
+ rtspd.c \
+ sockfilt.c \
+ socksd.c \
+ sws.c \
+ tftpd.c
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#include <curlx.h> /* from the private lib dir */
#include "getpart.h"
#include "util.h"
-#include "server_sockaddr.h"
/* include memdebug.h last */
#include <memdebug.h>
return 0;
}
-int main(int argc, char **argv)
+static int test_dnsd(int argc, char **argv)
{
srvr_sockaddr_union_t me;
ssize_t n = 0;
***************************************************************************/
#include <stdio.h>
#include <string.h>
-#include "first.h"
int main(int argc, char **argv)
{
- main_func_t main_func;
- char *main_name;
+ entry_func_t entry_func;
+ char *entry_name;
if(argc < 2) {
fprintf(stderr, "Pass servername as first argument\n");
return 1;
}
- main_name = argv[1];
- main_func = NULL;
+ entry_name = argv[1];
+ entry_func = NULL;
{
size_t tmp;
- for(tmp = 0; tmp < CURL_ARRAYSIZE(s_mains); ++tmp) {
- if(strcmp(main_name, s_mains[tmp].name) == 0) {
- main_func = s_mains[tmp].ptr;
+ for(tmp = 0; tmp < CURL_ARRAYSIZE(s_entries); ++tmp) {
+ if(strcmp(entry_name, s_entries[tmp].name) == 0) {
+ entry_func = s_entries[tmp].ptr;
break;
}
}
}
- if(!main_func) {
- fprintf(stderr, "Test '%s' not found.\n", main_name);
+ if(!entry_func) {
+ fprintf(stderr, "Test '%s' not found.\n", entry_name);
return 99;
}
--argc;
++argv;
- return main_func(argc, argv);
+ return entry_func(argc, argv);
}
* SPDX-License-Identifier: curl
*
***************************************************************************/
-typedef int (*main_func_t)(int, char **);
+typedef int (*entry_func_t)(int, char **);
-struct onemain {
+struct entry_s {
const char *name;
- main_func_t ptr;
+ entry_func_t ptr;
};
#endif /* HEADER_SERVER_FIRST_H */
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
#include "getpart.h"
#include <curlx.h> /* from the private lib dir */
# pragma warning(pop)
#endif
-
/*
* line_length()
*
* GPE_END_OF_FILE
* GPE_OK
*/
-
static int readline(char **buffer, size_t *bufsize, size_t *length,
FILE *stream)
{
* GPE_OUT_OF_MEMORY
* GPE_OK
*/
-
static int appenddata(char **dst_buf, /* dest buffer */
size_t *dst_len, /* dest buffer data length */
size_t *dst_alloc, /* dest buffer allocated size */
* GPE_OUT_OF_MEMORY
* GPE_OK
*/
-
int getpart(char **outbuf, size_t *outlen,
const char *main, const char *sub, FILE *stream)
{
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
#include "strdup.h"
+++ /dev/null
-#!/usr/bin/env perl
-#***************************************************************************
-# _ _ ____ _
-# Project ___| | | | _ \| |
-# / __| | | | |_) | |
-# | (__| |_| | _ <| |___
-# \___|\___/|_| \_\_____|
-#
-# Copyright (C) Viktor Szakats
-#
-# 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
-#
-###########################################################################
-
-# Bundle up individual tests into a single binary. The resulting binary can run
-# individual tests by passing their name (without '.c') as the first argument.
-
-use strict;
-use warnings;
-
-if(!@ARGV) {
- die "Usage: $0 [<inputs>] [--exclude <exclude-c-sources>]\n";
-}
-
-# Specific sources to exclude or add as an extra source file
-my @src;
-my %exclude;
-my $in_exclude = 0;
-foreach my $src (@ARGV) {
- if($in_exclude) {
- $exclude{$src} = 1;
- }
- elsif($src eq "--exclude") {
- $in_exclude = 1;
- }
- else {
- push @src, $src;
- }
-}
-
-print <<HEADER
-/* !checksrc! disable COPYRIGHT all */
-
-#include "first.h"
-
-HEADER
- ;
-
-my $tlist = "";
-
-foreach my $src (@src) {
- if($src =~ /\.c$/) {
- if(!exists $exclude{$src}) {
- # Misc .c source to include
- print "#include \"$src\"\n\n";
- }
- }
- elsif($src !~ /\.h$/) {
- # Make 'main' unique across server sources
- print "#undef main\n";
- print "#define main main_$src\n";
- print "int main_$src(int argc, char **argv);\n";
- print "#include \"$src.c\"\n";
- print "#undef main\n";
- print "\n";
- $tlist .= " {\"$src\", main_$src},\n";
- }
-}
-
-print <<FOOTER
-static const struct onemain s_mains[] = {
-$tlist};
-
-#include "first.c"
-FOOTER
- ;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include <curlx.h> /* from the private lib dir */
#include "getpart.h"
-#include "server_sockaddr.h"
#include "tool_binmode.h"
}
-int main(int argc, char *argv[])
+static int test_mqttd(int argc, char *argv[])
{
curl_socket_t sock = CURL_SOCKET_BAD;
curl_socket_t msgsock = CURL_SOCKET_BAD;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
/* Purpose
*
/* include memdebug.h last */
#include <memdebug.h>
-int main(int argc, char *argv[])
+static int test_resolve(int argc, char *argv[])
{
int arg = 1;
const char *host = NULL;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
/*
* curl's test suite Real Time Streaming Protocol (RTSP) server.
#include <curlx.h> /* from the private lib dir */
#include "getpart.h"
#include "util.h"
-#include "server_sockaddr.h"
/* include memdebug.h last */
#include <memdebug.h>
}
-int main(int argc, char *argv[])
+static int test_rtspd(int argc, char *argv[])
{
srvr_sockaddr_union_t me;
curl_socket_t sock = CURL_SOCKET_BAD;
+++ /dev/null
-#ifndef HEADER_CURL_SERVER_SETUP_H
-#define HEADER_CURL_SERVER_SETUP_H
-/***************************************************************************
- * _ _ ____ _
- * 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
- *
- ***************************************************************************/
-
-#define CURL_NO_OLDIES
-
-#include "curl_setup.h" /* portability help from the lib directory */
-
-#endif /* HEADER_CURL_SERVER_SETUP_H */
+++ /dev/null
-#ifndef HEADER_CURL_SERVER_SOCKADDR_H
-#define HEADER_CURL_SERVER_SOCKADDR_H
-/***************************************************************************
- * _ _ ____ _
- * 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
- *
- ***************************************************************************/
-#include "server_setup.h"
-
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h> /* for sockaddr_un */
-#endif
-
-typedef union {
- struct sockaddr sa;
- struct sockaddr_in sa4;
-#ifdef USE_IPV6
- struct sockaddr_in6 sa6;
-#endif
-#ifdef USE_UNIX_SOCKETS
- struct sockaddr_un sau;
-#endif
-} srvr_sockaddr_union_t;
-
-#endif /* HEADER_CURL_SERVER_SOCKADDR_H */
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
/* Purpose
*
#include <curlx.h> /* from the private lib dir */
#include "inet_pton.h"
#include "util.h"
-#include "server_sockaddr.h"
#include "timediff.h"
+#include "warnless.h" /* for read() */
#include "tool_binmode.h"
}
-int main(int argc, char *argv[])
+static int test_sockfilt(int argc, char *argv[])
{
srvr_sockaddr_union_t me;
curl_socket_t sock = CURL_SOCKET_BAD;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
#include <stdlib.h>
/* Function
#include <curlx.h> /* from the private lib dir */
#include "inet_pton.h"
#include "util.h"
-#include "server_sockaddr.h"
#include "tool_binmode.h"
/* include memdebug.h last */
}
-int main(int argc, char *argv[])
+static int test_socksd(int argc, char *argv[])
{
curl_socket_t sock = CURL_SOCKET_BAD;
curl_socket_t msgsock = CURL_SOCKET_BAD;
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
/* sws.c: simple (silly?) web server
#include "getpart.h"
#include "inet_pton.h"
#include "util.h"
-#include "server_sockaddr.h"
/* include memdebug.h last */
#include <memdebug.h>
return -1;
}
-int main(int argc, char *argv[])
+static int test_sws(int argc, char *argv[])
{
srvr_sockaddr_union_t me;
curl_socket_t sock = CURL_SOCKET_BAD;
+++ /dev/null
-#ifndef HEADER_CURL_SERVER_TFTP_H
-#define HEADER_CURL_SERVER_TFTP_H
-/***************************************************************************
- * _ _ ____ _
- * 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
- *
- ***************************************************************************/
-#include "server_setup.h"
-
-/* This file is a rewrite/clone of the arpa/tftp.h file for systems without
- it. */
-
-#define SEGSIZE 512 /* data segment size */
-
-#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
- ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
-# define PACKED_STRUCT __attribute__((__packed__))
-#else
-# define PACKED_STRUCT /* NOTHING */
-#endif
-
-/* Using a packed struct as binary in a program is begging for problems, but
- the tftpd server was written like this so we have this struct here to make
- things build. */
-
-struct tftphdr {
- unsigned short th_opcode; /* packet type */
- unsigned short th_block; /* all sorts of things */
- char th_data[1]; /* data or error string */
-} PACKED_STRUCT;
-
-#define th_stuff th_block
-#define th_code th_block
-#define th_msg th_data
-
-#define TFTP_EUNDEF 0
-#define TFTP_ENOTFOUND 1
-#define TFTP_EACCESS 2
-#define TFTP_ENOSPACE 3
-#define TFTP_EBADOP 4
-#define TFTP_EBADID 5
-#define TFTP_EEXISTS 6
-#define TFTP_ENOUSER 7
-
-#endif /* HEADER_CURL_SERVER_TFTP_H */
* SPDX-License-Identifier: BSD-4-Clause-UC
*/
-#include "server_setup.h"
+#include "curl_setup.h"
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#include <curlx.h> /* from the private lib dir */
#include "getpart.h"
#include "util.h"
-#include "server_sockaddr.h"
-#include "tftp.h"
+
+/*****************************************************************************
+* This is a rewrite/clone of the arpa/tftp.h file for systems without it. *
+*****************************************************************************/
+#define SEGSIZE 512 /* data segment size */
+
+#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
+ ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
+# define PACKED_STRUCT __attribute__((__packed__))
+#else
+# define PACKED_STRUCT /* NOTHING */
+#endif
+
+/* Using a packed struct as binary in a program is begging for problems, but
+ the tftpd server was written like this so we have this struct here to make
+ things build. */
+
+struct tftphdr {
+ unsigned short th_opcode; /* packet type */
+ unsigned short th_block; /* all sorts of things */
+ char th_data[1]; /* data or error string */
+} PACKED_STRUCT;
+
+#define th_stuff th_block
+#define th_code th_block
+#define th_msg th_data
+
+#define TFTP_EUNDEF 0
+#define TFTP_ENOTFOUND 1
+#define TFTP_EACCESS 2
+#define TFTP_ENOSPACE 3
+#define TFTP_EBADOP 4
+#define TFTP_EBADID 5
+#define TFTP_EEXISTS 6
+#define TFTP_ENOUSER 7
+/****************************************************************************/
/* include memdebug.h last */
#include <memdebug.h>
return j;
}
-int main(int argc, char **argv)
+static int test_tftpd(int argc, char **argv)
{
srvr_sockaddr_union_t me;
struct tftphdr *tp;
}
logmsg("end of one transfer");
-
}
tftpd_cleanup:
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
#ifndef UNDER_CE
#include <signal.h>
* SPDX-License-Identifier: curl
*
***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
/* adjust for old MSVC */
-#ifdef _MSC_VER
-# if _MSC_VER < 1900
-# define snprintf _snprintf
-# endif
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+# define snprintf _snprintf
#endif
#ifdef _WIN32
struct sockaddr_un *sau);
#endif /* USE_UNIX_SOCKETS */
+typedef union {
+ struct sockaddr sa;
+ struct sockaddr_in sa4;
+#ifdef USE_IPV6
+ struct sockaddr_in6 sa6;
+#endif
+#ifdef USE_UNIX_SOCKETS
+ struct sockaddr_un sau;
+#endif
+} srvr_sockaddr_union_t;
+
unsigned short util_ultous(unsigned long ulnum);
#endif /* HEADER_CURL_SERVER_UTIL_H */
if(!defined $ext) {
$ext = 'SRV';
}
- my $cmd;
- if($ENV{'CURL_TEST_BUNDLES'}) {
- $cmd = $SRVDIR . "servers" . exe_ext($ext) . " $name";
- }
- else {
- $cmd = $SRVDIR . $name . exe_ext($ext);
- }
- return exerunner() . "$cmd";
+ return exerunner() . $SRVDIR . "servers" . exe_ext($ext) . " $name";
}
if(!defined $ext) {
$ext = 'SRV';
}
- my @cmd;
- if($ENV{'CURL_TEST_BUNDLES'}) {
- @cmd = ($SRVDIR . "servers" . exe_ext($ext), $name);
- }
- else {
- @cmd = ($SRVDIR . $name . exe_ext($ext));
- }
+ my @cmd = ($SRVDIR . "servers" . exe_ext($ext), $name);
if($ENV{'CURL_TEST_EXE_RUNNER'}) {
unshift @cmd, $ENV{'CURL_TEST_EXE_RUNNER'};
}
#
# SPDX-License-Identifier: curl
-/tool[0-9][0-9][0-9][0-9]
-tool_bundle.c
tunits
+tunits.c
#
###########################################################################
-# Get 'TOOLPROGS', '*_SOURCES', 'TOOLFILES' variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES 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}" > "tool_bundle.c"
- DEPENDS
- "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${TOOLFILES}
- "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
- VERBATIM)
+add_custom_command(
+ OUTPUT "${BUNDLE_SRC}"
+ COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES}
+ ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+ DEPENDS
+ "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES}
+ VERBATIM)
- set(TOOLPROGS "tunits")
- set(tunits_SOURCES "tool_bundle.c")
-endif()
-
-foreach(_target IN LISTS TOOLPROGS)
- 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}/lib/curlx" # for curlx
- "${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)
- target_include_directories(${_target_name} PRIVATE "${PROJECT_SOURCE_DIR}/tests/tunit")
- endif()
- set_target_properties(${_target_name} PROPERTIES
- OUTPUT_NAME "${_target}"
- PROJECT_LABEL "Test tunit ${_target}")
-endforeach()
+add_executable(tunits EXCLUDE_FROM_ALL ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps tunits)
+target_link_libraries(tunits curltool curlu)
+target_include_directories(tunits PRIVATE
+ "${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
+ "${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
+ "${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx
+ "${PROJECT_SOURCE_DIR}/src"
+ "${PROJECT_SOURCE_DIR}/tests/libtest"
+ "${PROJECT_SOURCE_DIR}/tests/unit" # for curlcheck.h
+ "${PROJECT_SOURCE_DIR}/tests/tunit"
+)
+set_property(TARGET tunits APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}" "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
+set_target_properties(tunits PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
-I$(top_srcdir)/tests/unit \
-I$(top_srcdir)/tests/tunit
-EXTRA_DIST = CMakeLists.txt README.md
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt README.md $(UTILS) $(TESTFILES)
CFLAGS += @CURL_CFLAG_EXTRAS@
LIBS = $(BLANK_AT_MAKETIME)
LDADD = $(top_builddir)/src/libcurltool.la \
- $(top_builddir)/lib/libcurl.la \
+ $(top_builddir)/lib/libcurl.la \
@LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
AM_CPPFLAGS += -DCURLDEBUG
endif
-BUNDLE=tunits
+AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
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
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(TESTFILES)
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) --test $(TESTFILES) > $(BUNDLE_SRC)
noinst_PROGRAMS = $(BUNDLE)
-nodist_tunits_SOURCES = tool_bundle.c
-CLEANFILES = tool_bundle.c
-else
-# Makefile.inc provides neat definitions
-include Makefile.inc
-noinst_PROGRAMS = $(TOOLPROGS)
-endif
+nodist_tunits_SOURCES = $(BUNDLE_SRC)
+CLEANFILES = $(BUNDLE_SRC)
else
noinst_PROGRAMS =
endif
# 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 \
+ -W$(srcdir)/$(BUNDLE_SRC) \
$(srcdir)/*.[ch])
if NOT_CURL_CI
# SPDX-License-Identifier: curl
#
###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
-# these files are used in every single unit test program
+BUNDLE = tunits
+BUNDLE_SRC = tunits.c
-FIRSTFILES = ../libtest/first.c
+# Files referenced from the bundle source
+FIRSTFILES = ../libtest/first.c ../libtest/first.h
-TOOLFILES = $(FIRSTFILES)
+# Common files used by test programs
+UTILS = ../unit/curlcheck.h
-# These are all tool unit test programs
-TOOLPROGS = tool1394 tool1604 tool1621
-
-tool1394_SOURCES = tool1394.c $(TOOLFILES)
-
-tool1604_SOURCES = tool1604.c $(TOOLFILES)
-
-tool1621_SOURCES = tool1621.c $(TOOLFILES)
+# All tool unit test programs
+TESTFILES = \
+ tool1394.c \
+ tool1604.c \
+ tool1621.c
#include "memdebug.h" /* LAST include file */
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
+static CURLcode test_tool1394(char *arg)
{
-
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
const char *values[] = {
/* -E parameter */ /* exp. cert name */ /* exp. passphrase */
free(passphrase);
}
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "memdebug.h" /* LAST include file */
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
#if defined(_WIN32) || defined(MSDOS)
-
static char *getflagstr(int flags)
{
char *buf = malloc(256);
}
return buf;
}
+#endif
-struct data {
- const char *input;
- int flags;
- const char *expected_output;
- SANITIZEcode expected_result;
-};
+static CURLcode test_tool1604(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+
+#if defined(_WIN32) || defined(MSDOS)
+ struct data {
+ const char *input;
+ int flags;
+ const char *expected_output;
+ SANITIZEcode expected_result;
+ };
-UNITTEST_START
-{ /* START sanitize_file_name */
+ /* START sanitize_file_name */
struct data data[] = {
{ "", 0,
"", SANITIZE_ERR_OK
free(received_ccstr);
free(expected_ccstr);
}
-} /* END sanitize_file_name */
-
+ /* END sanitize_file_name */
#else
-UNITTEST_START
-{
fprintf(stderr, "Skipped test not for this platform\n");
-}
#endif /* _WIN32 || MSDOS */
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "urldata.h"
#include "url.h"
-#include "memdebug.h" /* LAST include file */
+#include "tool_xattr.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
+#include "memdebug.h" /* LAST include file */
-static void unit_stop(void)
+static CURLcode test_tool1621(char *arg)
{
-}
-
-#ifndef USE_XATTR
-/* stripcredentials isn't available in this case */
+ UNITTEST_BEGIN_SIMPLE
-UNITTEST_START
-UNITTEST_STOP
-#else
+#ifdef USE_XATTR /* Required for stripcredentials() */
-char *stripcredentials(const char *url);
+ struct checkthis {
+ const char *input;
+ const char *output;
+ };
-struct checkthis {
- const char *input;
- const char *output;
-};
-
-static const struct checkthis tests[] = {
- { "ninja://foo@example.com", "(null)" }, /* unsupported scheme */
- { "pop3s://foo@example.com", "pop3s://example.com/" },
- { "ldap://foo@example.com", "ldap://example.com/" },
- { "https://foo@example.com", "https://example.com/" },
- { "https://localhost:45", "https://localhost:45/" },
- { "https://foo@localhost:45", "https://localhost:45/" },
- { "http://daniel:password@localhost", "http://localhost/" },
- { "http://daniel@localhost", "http://localhost/" },
- { "https://user:pass@localhost:45", "https://localhost:45/" },
- { "http://localhost/", "http://localhost/" },
- { "http://odd%40host/", "(null)" }, /* bad host */
- { "http://user@odd%40host/", "(null)" }, /* bad host */
- { "http://host/@path/", "http://host/@path/" },
- { "http://emptypw:@host/", "http://host/" },
- { "http://:emptyuser@host/", "http://host/" },
- { "http://odd%40user@host/", "http://host/" },
- { "http://only%40one%40host/", "(null)" }, /* bad host */
- { "http://odder%3auser@host/", "http://host/" },
- { NULL, NULL } /* end marker */
-};
+ static const struct checkthis tests[] = {
+ { "ninja://foo@example.com", "(null)" }, /* unsupported scheme */
+#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)
+ { "pop3s://foo@example.com", "pop3s://example.com/" },
+#endif
+#ifndef CURL_DISABLE_LDAP
+ { "ldap://foo@example.com", "ldap://example.com/" },
+#endif
+#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
+ { "https://foo@example.com", "https://example.com/" },
+ { "https://localhost:45", "https://localhost:45/" },
+ { "https://foo@localhost:45", "https://localhost:45/" },
+ { "https://user:pass@localhost:45", "https://localhost:45/" },
+#endif
+#ifndef CURL_DISABLE_HTTP
+ { "http://daniel:password@localhost", "http://localhost/" },
+ { "http://daniel@localhost", "http://localhost/" },
+ { "http://localhost/", "http://localhost/" },
+ { "http://odd%40host/", "(null)" }, /* bad host */
+ { "http://user@odd%40host/", "(null)" }, /* bad host */
+ { "http://host/@path/", "http://host/@path/" },
+ { "http://emptypw:@host/", "http://host/" },
+ { "http://:emptyuser@host/", "http://host/" },
+ { "http://odd%40user@host/", "http://host/" },
+ { "http://only%40one%40host/", "(null)" }, /* bad host */
+ { "http://odder%3auser@host/", "http://host/" },
+#endif
+ { NULL, NULL } /* end marker */
+ };
-UNITTEST_START
-{
int i;
for(i = 0; tests[i].input; i++) {
const char *url = tests[i].input;
char *stripped = stripcredentials(url);
- char *strippedstr = stripped ? stripped : "(null)";
- printf("Test %u got input \"%s\", output: \"%s\"\n",
- i, tests[i].input, strippedstr);
+ const char *strippedstr = stripped ? stripped : "(null)";
+ printf("Test %u got input \"%s\", output: \"%s\", expected: \"%s\"\n",
+ i, tests[i].input, strippedstr, tests[i].output);
fail_if(strcmp(tests[i].output, strippedstr), tests[i].output);
curl_free(stripped);
}
-}
-UNITTEST_STOP
#endif
+
+ UNITTEST_END_SIMPLE
+}
#
# SPDX-License-Identifier: curl
-/unit[0-9][0-9][0-9][0-9]
-unit_bundle.c
units
+units.c
#
###########################################################################
-# Get 'UNITPROGS', '*_SOURCES', 'FIRSTFILES' variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES 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 "unit_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)
+add_custom_command(
+ OUTPUT "${BUNDLE_SRC}"
+ COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES}
+ ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+ DEPENDS
+ "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES}
+ VERBATIM)
- set(UNITPROGS "units")
- set(units_SOURCES "unit_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}/lib/curlx" # for curlx
- "${PROJECT_SOURCE_DIR}/src"
- "${PROJECT_SOURCE_DIR}/tests/libtest"
- )
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
- # unit tests are small pretend-libcurl-programs
- set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "BUILDING_LIBCURL")
- if(CURL_TEST_BUNDLES)
- target_include_directories(${_target_name} PRIVATE "${PROJECT_SOURCE_DIR}/tests/unit")
- endif()
- set_target_properties(${_target_name} PROPERTIES
- OUTPUT_NAME "${_target}"
- PROJECT_LABEL "Test unit ${_target}")
-endforeach()
+add_executable(units EXCLUDE_FROM_ALL ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps units)
+target_link_libraries(units curltool curlu)
+target_include_directories(units PRIVATE
+ "${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
+ "${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
+ "${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx
+ "${PROJECT_SOURCE_DIR}/src"
+ "${PROJECT_SOURCE_DIR}/tests/libtest"
+ "${PROJECT_SOURCE_DIR}/tests/unit"
+)
+set_property(TARGET units APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}" "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
+set_property(TARGET units APPEND PROPERTY COMPILE_DEFINITIONS "BUILDING_LIBCURL") # unit tests are small pretend-libcurl-programs
+set_target_properties(units PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
-I$(top_srcdir)/tests/libtest \
-I$(top_srcdir)/tests/unit
-EXTRA_DIST = CMakeLists.txt README.md
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt README.md $(UTILS) $(TESTFILES)
CFLAGS += @CURL_CFLAG_EXTRAS@
AM_CPPFLAGS += -DCURLDEBUG
endif
-BUNDLE=units
+AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
if BUILD_UNITTESTS
-if USE_TEST_BUNDLES
-unit_bundle.c: $(top_srcdir)/tests/mk-bundle.pl Makefile.inc
- @PERL@ $(top_srcdir)/tests/mk-bundle.pl $(srcdir) > unit_bundle.c
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(TESTFILES)
+ @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) --test $(TESTFILES) > $(BUNDLE_SRC)
noinst_PROGRAMS = $(BUNDLE)
-nodist_units_SOURCES = unit_bundle.c
-CLEANFILES = unit_bundle.c
-else
-# Makefile.inc provides neat definitions
-include Makefile.inc
-noinst_PROGRAMS = $(UNITPROGS)
-endif
+nodist_units_SOURCES = $(BUNDLE_SRC)
+CLEANFILES = $(BUNDLE_SRC)
else
noinst_PROGRAMS =
endif
# ignore generated C files since they play by slightly different rules!
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
- -W$(srcdir)/unit_bundle.c \
+ -W$(srcdir)/$(BUNDLE_SRC) \
$(srcdir)/*.[ch])
if NOT_CURL_CI
# SPDX-License-Identifier: curl
#
###########################################################################
-
-# these files are used in every single unit test program
-
-FIRSTFILES = \
- ../libtest/first.c \
- ../libtest/first.h
-
-UNITFILES = curlcheck.h $(FIRSTFILES)
-
-# These are all unit test programs
-UNITPROGS = unit1300 unit1302 unit1303 unit1304 unit1305 unit1307 \
- unit1309 unit1323 \
- unit1330 unit1395 unit1396 unit1397 unit1398 \
- unit1399 \
- unit1600 unit1601 unit1602 unit1603 unit1605 unit1606 unit1607 \
- unit1608 unit1609 unit1610 unit1611 unit1612 unit1614 unit1615 unit1616 \
- unit1620 \
- unit1650 unit1651 unit1652 unit1653 unit1654 unit1655 unit1656 unit1657 \
- unit1658 \
- unit1660 unit1661 unit1663 unit1664 \
- unit1979 unit1980 \
- unit2600 unit2601 unit2602 unit2603 unit2604 \
- unit3200 \
- unit3205 \
- unit3211 unit3212 unit3213
-
-unit1300_SOURCES = unit1300.c $(UNITFILES)
-
-unit1302_SOURCES = unit1302.c $(UNITFILES)
-
-unit1303_SOURCES = unit1303.c $(UNITFILES)
-
-unit1304_SOURCES = unit1304.c $(UNITFILES)
-
-unit1305_SOURCES = unit1305.c $(UNITFILES)
-
-unit1307_SOURCES = unit1307.c $(UNITFILES)
-
-unit1309_SOURCES = unit1309.c $(UNITFILES)
-
-unit1323_SOURCES = unit1323.c $(UNITFILES)
-
-unit1330_SOURCES = unit1330.c $(UNITFILES)
-
-unit1395_SOURCES = unit1395.c $(UNITFILES)
-
-unit1396_SOURCES = unit1396.c $(UNITFILES)
-
-unit1397_SOURCES = unit1397.c $(UNITFILES)
-
-unit1398_SOURCES = unit1398.c $(UNITFILES)
-
-unit1399_SOURCES = unit1399.c $(UNITFILES)
-
-unit1600_SOURCES = unit1600.c $(UNITFILES)
-
-unit1601_SOURCES = unit1601.c $(UNITFILES)
-
-unit1602_SOURCES = unit1602.c $(UNITFILES)
-
-unit1603_SOURCES = unit1603.c $(UNITFILES)
-
-unit1605_SOURCES = unit1605.c $(UNITFILES)
-
-unit1606_SOURCES = unit1606.c $(UNITFILES)
-
-unit1607_SOURCES = unit1607.c $(UNITFILES)
-
-unit1608_SOURCES = unit1608.c $(UNITFILES)
-
-unit1609_SOURCES = unit1609.c $(UNITFILES)
-
-unit1610_SOURCES = unit1610.c $(UNITFILES)
-
-unit1611_SOURCES = unit1611.c $(UNITFILES)
-
-unit1612_SOURCES = unit1612.c $(UNITFILES)
-
-unit1614_SOURCES = unit1614.c $(UNITFILES)
-
-unit1615_SOURCES = unit1615.c $(UNITFILES)
-
-unit1616_SOURCES = unit1616.c $(UNITFILES)
-
-unit1620_SOURCES = unit1620.c $(UNITFILES)
-
-unit1650_SOURCES = unit1650.c $(UNITFILES)
-
-unit1651_SOURCES = unit1651.c $(UNITFILES)
-
-unit1652_SOURCES = unit1652.c $(UNITFILES)
-
-unit1653_SOURCES = unit1653.c $(UNITFILES)
-
-unit1654_SOURCES = unit1654.c $(UNITFILES)
-
-unit1655_SOURCES = unit1655.c $(UNITFILES)
-
-unit1656_SOURCES = unit1656.c $(UNITFILES)
-
-unit1657_SOURCES = unit1657.c $(UNITFILES)
-
-unit1658_SOURCES = unit1658.c $(UNITFILES)
-
-unit1660_SOURCES = unit1660.c $(UNITFILES)
-
-unit1661_SOURCES = unit1661.c $(UNITFILES)
-
-unit1663_SOURCES = unit1663.c $(UNITFILES)
-
-unit1664_SOURCES = unit1664.c $(UNITFILES)
-
-unit1979_SOURCES = unit1979.c $(UNITFILES)
-
-unit1980_SOURCES = unit1980.c $(UNITFILES)
-
-unit2600_SOURCES = unit2600.c $(UNITFILES)
-
-unit2601_SOURCES = unit2601.c $(UNITFILES)
-
-unit2602_SOURCES = unit2602.c $(UNITFILES)
-
-unit2603_SOURCES = unit2603.c $(UNITFILES)
-
-unit2604_SOURCES = unit2604.c $(UNITFILES)
-
-unit3200_SOURCES = unit3200.c $(UNITFILES)
-
-unit3205_SOURCES = unit3205.c $(UNITFILES)
-
-unit3211_SOURCES = unit3211.c $(UNITFILES)
-
-unit3212_SOURCES = unit3212.c $(UNITFILES)
-
-unit3213_SOURCES = unit3213.c $(UNITFILES)
+# Shared between CMakeLists.txt and Makefile.am
+
+BUNDLE = units
+BUNDLE_SRC = units.c
+
+# Files referenced from the bundle source
+FIRSTFILES = ../libtest/first.c ../libtest/first.h
+
+# Common files used by test programs
+UTILS = curlcheck.h
+
+# All unit test programs
+TESTFILES = \
+ unit1300.c unit1302.c unit1303.c unit1304.c unit1305.c unit1307.c \
+ unit1309.c unit1323.c \
+ unit1330.c unit1395.c unit1396.c unit1397.c unit1398.c \
+ unit1399.c \
+ unit1600.c unit1601.c unit1602.c unit1603.c unit1605.c unit1606.c unit1607.c \
+ unit1608.c unit1609.c unit1610.c unit1611.c unit1612.c unit1614.c unit1615.c unit1616.c \
+ unit1620.c \
+ unit1650.c unit1651.c unit1652.c unit1653.c unit1654.c unit1655.c unit1656.c unit1657.c \
+ unit1658.c \
+ unit1660.c unit1661.c unit1663.c unit1664.c \
+ unit1979.c unit1980.c \
+ unit2600.c unit2601.c unit2602.c unit2603.c unit2604.c \
+ unit3200.c \
+ unit3205.c \
+ unit3211.c unit3212.c unit3213.c
For the actual C file, here's a simple example:
~~~c
+ #include "curlcheck.h"
+
+ #include "a libcurl header.h" /* from the lib dir */
+
+ static CURLcode test_unit9998(char *arg)
+ {
+ UNITTEST_BEGIN_SIMPLE
+ /* here you start doing things and checking that the results are good */
+
+ fail_unless( size == 0 , "initial size should be zero" );
+ fail_if( head == NULL , "head should not be initiated to NULL" );
+
+ /* you end the test code like this: */
+
+ UNITTEST_END_SIMPLE
+ }
+~~~
+
+Here's an example using optional initialization and cleanup:
+~~~c
#include "curlcheck.h"
#include "a libcurl header.h" /* from the lib dir */
/* done before shutting down and exiting */
}
- UNITTEST_START
+ static CURLcode test_unit9999(char *arg)
+ {
+ UNITTEST_BEGIN(unit_setup())
/* here you start doing things and checking that the results are good */
/* you end the test code like this: */
- UNITTEST_STOP
+ UNITTEST_END(unit_stop())
+ }
+~~~
} while(0)
-#define UNITTEST_START \
- CURLcode test(char *arg) \
- { \
- (void)arg; \
- if(unit_setup()) { \
- fail("unit_setup() FAILURE"); \
- } \
- else {
+#define UNITTEST_BEGIN_SIMPLE \
+ (void)arg; \
+ {
-#define UNITTEST_STOP \
+#define UNITTEST_END_SIMPLE \
goto unit_test_abort; /* avoid warning */ \
+ } \
unit_test_abort: \
- unit_stop(); \
+ return (CURLcode)unitfail;
+
+#define UNITTEST_BEGIN(setupfunc) \
+ (void)arg; \
+ if(setupfunc) { \
+ fail("unit_setup() FAILURE"); \
+ return (CURLcode)unitfail; \
+ } \
+ {
+
+#define UNITTEST_END(stopfunc) \
+ goto unit_test_abort; /* avoid warning */ \
} \
- return (CURLcode)unitfail; \
- }
+unit_test_abort: \
+ stopfunc; \
+ return (CURLcode)unitfail;
#include "llist.h"
-static struct Curl_llist llist;
-
-static struct Curl_llist llist_destination;
-
static void test_Curl_llist_dtor(void *key, void *value)
{
/* used by the llist API, does nothing here */
(void)value;
}
-static CURLcode unit_setup(void)
+static CURLcode test_unit1300(char *arg)
{
- Curl_llist_init(&llist, test_Curl_llist_dtor);
- Curl_llist_init(&llist_destination, test_Curl_llist_dtor);
- return CURLE_OK;
-}
+ UNITTEST_BEGIN_SIMPLE
-static void unit_stop(void)
-{
-}
+ struct Curl_llist llist;
+ struct Curl_llist llist_destination;
-UNITTEST_START
-{
int unusedData_case1 = 1;
int unusedData_case2 = 2;
int unusedData_case3 = 3;
struct Curl_llist_node *to_remove;
size_t llist_size;
+ Curl_llist_init(&llist, test_Curl_llist_dtor);
+ Curl_llist_init(&llist_destination, test_Curl_llist_dtor);
+
/**
* testing llist_init
* case 1:
Curl_llist_destroy(&llist, NULL);
Curl_llist_destroy(&llist_destination, NULL);
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#include "curlx/base64.h"
#include "memdebug.h" /* LAST include file */
-static struct Curl_easy *t1302_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode test_unit1302(char *arg)
{
- CURLcode res = CURLE_OK;
-
- global_init(CURL_GLOBAL_ALL);
- t1302_easy = curl_easy_init();
- if(!t1302_easy) {
- curl_global_cleanup();
- return CURLE_OUT_OF_MEMORY;
- }
- return res;
+ UNITTEST_BEGIN_SIMPLE
+
+ char *output;
+ unsigned char *decoded;
+ size_t size = 0;
+ unsigned char anychar = 'x';
+ CURLcode rc;
+
+ rc = curlx_base64_encode("i", 1, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 4, "size should be 4");
+ verify_memory(output, "aQ==", 4);
+ Curl_safefree(output);
+
+ rc = curlx_base64_encode("ii", 2, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 4, "size should be 4");
+ verify_memory(output, "aWk=", 4);
+ Curl_safefree(output);
+
+ rc = curlx_base64_encode("iii", 3, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 4, "size should be 4");
+ verify_memory(output, "aWlp", 4);
+ Curl_safefree(output);
+
+ rc = curlx_base64_encode("iiii", 4, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 8, "size should be 8");
+ verify_memory(output, "aWlpaQ==", 8);
+ Curl_safefree(output);
+
+ rc = curlx_base64_encode("\xff\x01\xfe\x02", 4, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 8, "size should be 8");
+ verify_memory(output, "/wH+Ag==", 8);
+ Curl_safefree(output);
+
+ rc = curlx_base64url_encode("\xff\x01\xfe\x02", 4, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 6, "size should be 6");
+ verify_memory(output, "_wH-Ag", 6);
+ Curl_safefree(output);
+
+ rc = curlx_base64url_encode("iiii", 4, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 6, "size should be 6");
+ verify_memory(output, "aWlpaQ", 6);
+ Curl_safefree(output);
+
+ /* 0 length makes it do strlen() */
+ rc = curlx_base64_encode("iiii", 0, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 8, "size should be 8");
+ verify_memory(output, "aWlpaQ==", 8);
+ Curl_safefree(output);
+
+ rc = curlx_base64_encode("", 0, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 0, "size should be 0");
+ fail_unless(output && !output[0], "output should be a zero-length string");
+ Curl_safefree(output);
+
+ rc = curlx_base64url_encode("", 0, &output, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 0, "size should be 0");
+ fail_unless(output && !output[0], "output should be a zero-length string");
+ Curl_safefree(output);
+
+ rc = curlx_base64_decode("aWlpaQ==", &decoded, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 4, "size should be 4");
+ verify_memory(decoded, "iiii", 4);
+ Curl_safefree(decoded);
+
+ rc = curlx_base64_decode("aWlp", &decoded, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 3, "size should be 3");
+ verify_memory(decoded, "iii", 3);
+ Curl_safefree(decoded);
+
+ rc = curlx_base64_decode("aWk=", &decoded, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 2, "size should be 2");
+ verify_memory(decoded, "ii", 2);
+ Curl_safefree(decoded);
+
+ rc = curlx_base64_decode("aQ==", &decoded, &size);
+ fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ fail_unless(size == 1, "size should be 1");
+ verify_memory(decoded, "i", 2);
+ Curl_safefree(decoded);
+
+ /* This is illegal input as the data is too short */
+ size = 1; /* not zero */
+ decoded = &anychar; /* not NULL */
+ rc = curlx_base64_decode("aQ", &decoded, &size);
+ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
+ fail_unless(size == 0, "size should be 0");
+ fail_if(decoded, "returned pointer should be NULL");
+
+ /* This is illegal input as it contains three padding characters */
+ size = 1; /* not zero */
+ decoded = &anychar; /* not NULL */
+ rc = curlx_base64_decode("a===", &decoded, &size);
+ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
+ fail_unless(size == 0, "size should be 0");
+ fail_if(decoded, "returned pointer should be NULL");
+
+ /* This is illegal input as it contains a padding character mid input */
+ size = 1; /* not zero */
+ decoded = &anychar; /* not NULL */
+ rc = curlx_base64_decode("a=Q=", &decoded, &size);
+ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
+ fail_unless(size == 0, "size should be 0");
+ fail_if(decoded, "returned pointer should be NULL");
+
+ /* This is also illegal input as it contains a padding character mid input */
+ size = 1; /* not zero */
+ decoded = &anychar; /* not NULL */
+ rc = curlx_base64_decode("aWlpa=Q=", &decoded, &size);
+ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
+ fail_unless(size == 0, "size should be 0");
+ fail_if(decoded, "returned pointer should be NULL");
+
+ /* This is garbage input as it contains an illegal base64 character */
+ size = 1; /* not zero */
+ decoded = &anychar; /* not NULL */
+ rc = curlx_base64_decode("a\x1f==", &decoded, &size);
+ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
+ fail_unless(size == 0, "size should be 0");
+ fail_if(decoded, "returned pointer should be NULL");
+
+ UNITTEST_END_SIMPLE
}
-
-static void unit_stop(void)
-{
- curl_easy_cleanup(t1302_easy);
- curl_global_cleanup();
-}
-
-UNITTEST_START
-
-char *output;
-unsigned char *decoded;
-size_t size = 0;
-unsigned char anychar = 'x';
-CURLcode rc;
-
-rc = curlx_base64_encode("i", 1, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(output, "aQ==", 4);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("ii", 2, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(output, "aWk=", 4);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("iii", 3, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(output, "aWlp", 4);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("iiii", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 8, "size should be 8");
-verify_memory(output, "aWlpaQ==", 8);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("\xff\x01\xfe\x02", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 8, "size should be 8");
-verify_memory(output, "/wH+Ag==", 8);
-Curl_safefree(output);
-
-rc = curlx_base64url_encode("\xff\x01\xfe\x02", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 6, "size should be 6");
-verify_memory(output, "_wH-Ag", 6);
-Curl_safefree(output);
-
-rc = curlx_base64url_encode("iiii", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 6, "size should be 6");
-verify_memory(output, "aWlpaQ", 6);
-Curl_safefree(output);
-
-/* 0 length makes it do strlen() */
-rc = curlx_base64_encode("iiii", 0, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 8, "size should be 8");
-verify_memory(output, "aWlpaQ==", 8);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("", 0, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 0, "size should be 0");
-fail_unless(output && !output[0], "output should be a zero-length string");
-Curl_safefree(output);
-
-rc = curlx_base64url_encode("", 0, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 0, "size should be 0");
-fail_unless(output && !output[0], "output should be a zero-length string");
-Curl_safefree(output);
-
-rc = curlx_base64_decode("aWlpaQ==", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(decoded, "iiii", 4);
-Curl_safefree(decoded);
-
-rc = curlx_base64_decode("aWlp", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 3, "size should be 3");
-verify_memory(decoded, "iii", 3);
-Curl_safefree(decoded);
-
-rc = curlx_base64_decode("aWk=", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 2, "size should be 2");
-verify_memory(decoded, "ii", 2);
-Curl_safefree(decoded);
-
-rc = curlx_base64_decode("aQ==", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 1, "size should be 1");
-verify_memory(decoded, "i", 2);
-Curl_safefree(decoded);
-
-/* This is illegal input as the data is too short */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("aQ", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
- "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is illegal input as it contains three padding characters */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("a===", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
- "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is illegal input as it contains a padding character mid input */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("a=Q=", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
- "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is also illegal input as it contains a padding character mid input */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("aWlpa=Q=", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
- "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is garbage input as it contains an illegal base64 character */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("a\x1f==", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
- "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-
-UNITTEST_STOP
#include "connect.h"
#include "memdebug.h" /* LAST include file */
-static struct Curl_easy *t1303_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1303_setup(struct Curl_easy **easy)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
- t1303_easy = curl_easy_init();
- if(!t1303_easy) {
+ *easy = curl_easy_init();
+ if(!*easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
}
return res;
}
-static void unit_stop(void)
+static void t1303_stop(struct Curl_easy *easy)
{
- curl_easy_cleanup(t1303_easy);
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
/* macro to set the pretended current time */
#define NOW(x,y) now.tv_sec = x; now.tv_usec = y
/* macro to set the millisecond based timeouts to use */
-#define TIMEOUTS(x,y) t1303_easy->set.timeout = x; \
- t1303_easy->set.connecttimeout = y
+#define TIMEOUTS(x,y) easy->set.timeout = x; \
+ easy->set.connecttimeout = y
/*
* To test:
* N various values of now
*/
-struct timetest {
- int now_s;
- int now_us;
- unsigned int timeout_ms;
- unsigned int connecttimeout_ms;
- bool connecting;
- timediff_t result;
- const char *comment;
-};
-
-UNITTEST_START
+static CURLcode test_unit1303(char *arg)
{
+ struct Curl_easy *easy;
+
+ UNITTEST_BEGIN(t1303_setup(&easy))
+
struct curltime now;
unsigned int i;
+ struct timetest {
+ int now_s;
+ int now_us;
+ unsigned int timeout_ms;
+ unsigned int connecttimeout_ms;
+ bool connecting;
+ timediff_t result;
+ const char *comment;
+ };
+
const struct timetest run[] = {
/* both timeouts set, not connecting */
{BASE + 4, 0, 10000, 8000, FALSE, 6000, "6 seconds should be left"},
};
/* this is the pretended start time of the transfer */
- t1303_easy->progress.t_startsingle.tv_sec = BASE;
- t1303_easy->progress.t_startsingle.tv_usec = 0;
- t1303_easy->progress.t_startop.tv_sec = BASE;
- t1303_easy->progress.t_startop.tv_usec = 0;
+ easy->progress.t_startsingle.tv_sec = BASE;
+ easy->progress.t_startsingle.tv_usec = 0;
+ easy->progress.t_startop.tv_sec = BASE;
+ easy->progress.t_startop.tv_usec = 0;
for(i = 0; i < CURL_ARRAYSIZE(run); i++) {
timediff_t timeout;
NOW(run[i].now_s, run[i].now_us);
TIMEOUTS(run[i].timeout_ms, run[i].connecttimeout_ms);
- timeout = Curl_timeleft(t1303_easy, &now, run[i].connecting);
+ timeout = Curl_timeleft(easy, &now, run[i].connecting);
if(timeout != run[i].result)
fail(run[i].comment);
}
+
+ UNITTEST_END(t1303_stop(easy))
}
-UNITTEST_STOP
#ifndef CURL_DISABLE_NETRC
-static char *s_login;
-static char *s_password;
-
-static CURLcode unit_setup(void)
+static void t1304_stop(char **password, char **login)
{
- s_password = NULL;
- s_login = NULL;
- return CURLE_OK;
+ Curl_safefree(*password);
+ Curl_safefree(*login);
}
-static void unit_stop(void)
+static CURLcode test_unit1304(char *arg)
{
- Curl_safefree(s_password);
- Curl_safefree(s_login);
-}
+ char *login = NULL;
+ char *password = NULL;
+
+ UNITTEST_BEGIN_SIMPLE
-UNITTEST_START
-{
int result;
struct store_netrc store;
*/
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "test.example.com", &s_login, &s_password, arg);
+ "test.example.com", &login, &password, arg);
fail_unless(result == 1, "Host not found should return 1");
- abort_unless(s_password == NULL, "password did not return NULL!");
- abort_unless(s_login == NULL, "user did not return NULL!");
+ abort_unless(password == NULL, "password did not return NULL!");
+ abort_unless(login == NULL, "user did not return NULL!");
Curl_netrc_cleanup(&store);
/*
* Test a non existent login in our netrc file.
*/
- s_login = (char *)CURL_UNCONST("me");
+ login = (char *)CURL_UNCONST("me");
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "example.com", &s_login, &s_password, arg);
+ "example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password == NULL, "password is not NULL!");
+ abort_unless(password == NULL, "password is not NULL!");
Curl_netrc_cleanup(&store);
/*
* Test a non existent login and host in our netrc file.
*/
- s_login = (char *)CURL_UNCONST("me");
+ login = (char *)CURL_UNCONST("me");
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "test.example.com", &s_login, &s_password, arg);
+ "test.example.com", &login, &password, arg);
fail_unless(result == 1, "Host not found should return 1");
- abort_unless(s_password == NULL, "password is not NULL!");
+ abort_unless(password == NULL, "password is not NULL!");
Curl_netrc_cleanup(&store);
/*
* Test a non existent login (substring of an existing one) in our
* netrc file.
*/
- s_login = (char *)CURL_UNCONST("admi");
+ login = (char *)CURL_UNCONST("admi");
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "example.com", &s_login, &s_password, arg);
+ "example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password == NULL, "password is not NULL!");
+ abort_unless(password == NULL, "password is not NULL!");
Curl_netrc_cleanup(&store);
/*
* Test a non existent login (superstring of an existing one)
* in our netrc file.
*/
- s_login = (char *)CURL_UNCONST("adminn");
+ login = (char *)CURL_UNCONST("adminn");
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "example.com", &s_login, &s_password, arg);
+ "example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password == NULL, "password is not NULL!");
+ abort_unless(password == NULL, "password is not NULL!");
Curl_netrc_cleanup(&store);
/*
* Test for the first existing host in our netrc file
- * with s_login[0] = 0.
+ * with login[0] = 0.
*/
- s_login = NULL;
+ login = NULL;
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "example.com", &s_login, &s_password, arg);
+ "example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password != NULL, "returned NULL!");
- fail_unless(strncmp(s_password, "passwd", 6) == 0,
+ abort_unless(password != NULL, "returned NULL!");
+ fail_unless(strncmp(password, "passwd", 6) == 0,
"password should be 'passwd'");
- abort_unless(s_login != NULL, "returned NULL!");
- fail_unless(strncmp(s_login, "admin", 5) == 0, "login should be 'admin'");
+ abort_unless(login != NULL, "returned NULL!");
+ fail_unless(strncmp(login, "admin", 5) == 0, "login should be 'admin'");
Curl_netrc_cleanup(&store);
/*
* Test for the first existing host in our netrc file
- * with s_login[0] != 0.
+ * with login[0] != 0.
*/
- free(s_password);
- free(s_login);
- s_password = NULL;
- s_login = NULL;
+ free(password);
+ free(login);
+ password = NULL;
+ login = NULL;
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "example.com", &s_login, &s_password, arg);
+ "example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password != NULL, "returned NULL!");
- fail_unless(strncmp(s_password, "passwd", 6) == 0,
+ abort_unless(password != NULL, "returned NULL!");
+ fail_unless(strncmp(password, "passwd", 6) == 0,
"password should be 'passwd'");
- abort_unless(s_login != NULL, "returned NULL!");
- fail_unless(strncmp(s_login, "admin", 5) == 0, "login should be 'admin'");
+ abort_unless(login != NULL, "returned NULL!");
+ fail_unless(strncmp(login, "admin", 5) == 0, "login should be 'admin'");
Curl_netrc_cleanup(&store);
/*
* Test for the second existing host in our netrc file
- * with s_login[0] = 0.
+ * with login[0] = 0.
*/
- free(s_password);
- s_password = NULL;
- free(s_login);
- s_login = NULL;
+ free(password);
+ password = NULL;
+ free(login);
+ login = NULL;
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "curl.example.com", &s_login, &s_password, arg);
+ "curl.example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password != NULL, "returned NULL!");
- fail_unless(strncmp(s_password, "none", 4) == 0,
+ abort_unless(password != NULL, "returned NULL!");
+ fail_unless(strncmp(password, "none", 4) == 0,
"password should be 'none'");
- abort_unless(s_login != NULL, "returned NULL!");
- fail_unless(strncmp(s_login, "none", 4) == 0, "login should be 'none'");
+ abort_unless(login != NULL, "returned NULL!");
+ fail_unless(strncmp(login, "none", 4) == 0, "login should be 'none'");
Curl_netrc_cleanup(&store);
/*
* Test for the second existing host in our netrc file
- * with s_login[0] != 0.
+ * with login[0] != 0.
*/
- free(s_password);
- free(s_login);
- s_password = NULL;
- s_login = NULL;
+ free(password);
+ free(login);
+ password = NULL;
+ login = NULL;
Curl_netrc_init(&store);
result = Curl_parsenetrc(&store,
- "curl.example.com", &s_login, &s_password, arg);
+ "curl.example.com", &login, &password, arg);
fail_unless(result == 0, "Host should have been found");
- abort_unless(s_password != NULL, "returned NULL!");
- fail_unless(strncmp(s_password, "none", 4) == 0,
+ abort_unless(password != NULL, "returned NULL!");
+ fail_unless(strncmp(password, "none", 4) == 0,
"password should be 'none'");
- abort_unless(s_login != NULL, "returned NULL!");
- fail_unless(strncmp(s_login, "none", 4) == 0, "login should be 'none'");
+ abort_unless(login != NULL, "returned NULL!");
+ fail_unless(strncmp(login, "none", 4) == 0, "login should be 'none'");
Curl_netrc_cleanup(&store);
+
+ UNITTEST_END(t1304_stop(&password, &login))
}
-UNITTEST_STOP
#else
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-static void unit_stop(void)
+
+static CURLcode test_unit1304(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
+ UNITTEST_END_SIMPLE
}
-UNITTEST_START
-UNITTEST_STOP
#endif
#include "memdebug.h" /* LAST include file */
-static struct Curl_easy *t1305_easy;
static struct Curl_dnscache hp;
static char *data_key;
static struct Curl_dns_entry *data_node;
-static CURLcode unit_setup(void)
+static CURLcode t1305_setup(void)
{
- t1305_easy = curl_easy_init();
- if(!t1305_easy) {
- curl_global_cleanup();
- return CURLE_OUT_OF_MEMORY;
- }
-
Curl_dnscache_init(&hp, 7);
return CURLE_OK;
}
-static void unit_stop(void)
+static void t1305_stop(void)
{
if(data_node) {
Curl_freeaddrinfo(data_node->addr);
}
free(data_key);
Curl_dnscache_destroy(&hp);
-
- curl_easy_cleanup(t1305_easy);
- curl_global_cleanup();
}
static struct Curl_addrinfo *fake_ai(void)
{
static struct Curl_addrinfo *ai;
- static const char dummy[]="dummy";
+ static const char dummy[] = "dummy";
size_t namelen = sizeof(dummy); /* including the null-terminator */
ai = calloc(1, sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_in) +
return CURLE_OK;
}
-
-UNITTEST_START
+static CURLcode test_unit1305(char *arg)
+{
+ UNITTEST_BEGIN(t1305_setup())
struct Curl_dns_entry *nodep;
size_t key_len;
/* Test 1305 exits without adding anything to the hash */
- if(strcmp(arg, "1305") != 0) {
+ if(testnum == 1306) {
CURLcode rc = create_node();
abort_unless(rc == CURLE_OK, "data node creation failed");
key_len = strlen(data_key);
data_node = NULL;
}
-UNITTEST_STOP
+ UNITTEST_END(t1305_stop())
+}
#include "curl_fnmatch.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
#ifndef CURL_DISABLE_FTP
/*
/* not reached */
}
-enum system {
- SYSTEM_CUSTOM,
- SYSTEM_LINUX,
- SYSTEM_MACOS
-};
-
-UNITTEST_START
+static CURLcode test_unit1307(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
+
struct testcase {
const char *pattern;
const char *string;
};
int i;
+
+ enum system {
+ SYSTEM_CUSTOM,
+ SYSTEM_LINUX,
+ SYSTEM_MACOS
+ };
+
enum system machine;
#ifdef HAVE_FNMATCH
fail("pattern mismatch");
}
}
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#else
-UNITTEST_START
-UNITTEST_STOP
+static CURLcode test_unit1307(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+ UNITTEST_END_SIMPLE
+}
#endif
#include "splay.h"
#include "warnless.h"
-
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
static void splayprint(struct Curl_tree *t, int d, char output)
{
struct Curl_tree *node;
splayprint(t->smaller, d + 1, output);
}
-UNITTEST_START
+static CURLcode test_unit1309(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
/* number of nodes to add to the splay tree */
#define NUM_NODES 50
fail_unless(root == NULL, "tree not empty when it should be");
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "timeval.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1323(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
+ UNITTEST_BEGIN_SIMPLE
-struct a {
- struct curltime first;
- struct curltime second;
- time_t result;
-};
+ struct a {
+ struct curltime first;
+ struct curltime second;
+ time_t result;
+ };
-UNITTEST_START
-{
struct a tests[] = {
{ {36762, 8345 }, {36761, 995926 }, 13 },
{ {36761, 995926 }, {36762, 8345 }, -13 },
{ {36761, 995926 }, {0, 0}, 36761995 },
{ {0, 0}, {36761, 995926 }, -36761995 },
};
+
size_t i;
for(i = 0; i < CURL_ARRAYSIZE(tests); i++) {
fail("unexpected result!");
}
}
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#include "memdebug.h"
-
-static CURLcode unit_setup(void)
+static CURLcode test_unit1330(char *arg)
{
- return CURLE_OK;
-}
+ UNITTEST_BEGIN_SIMPLE
-static void unit_stop(void)
-{
-}
+ char *ptr = malloc(1330);
+ Curl_safefree(ptr);
-UNITTEST_START
-
-char *ptr = malloc(1330);
-Curl_safefree(ptr);
-
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "memdebug.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1395(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-struct dotdot {
- const char *input;
- const char *output;
-};
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
unsigned int i;
int fails = 0;
+
+ struct dotdot {
+ const char *input;
+ const char *output;
+ };
+
const struct dotdot pairs[] = {
{ "%2f%2e%2e%2f/../a", "%2f%2e%2e%2f/a" },
{ "%2f%2e%2e%2f/../", "%2f%2e%2e%2f/" },
fail_if(fails, "output mismatched");
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
***************************************************************************/
#include "curlcheck.h"
-static CURL *hnd;
-
-static CURLcode unit_setup(void)
+static CURLcode t1396_setup(void)
{
CURLcode res = CURLE_OK;
-
global_init(CURL_GLOBAL_ALL);
return res;
}
-static void unit_stop(void)
+static void t1396_stop(CURL *easy)
{
- if(hnd)
- curl_easy_cleanup(hnd);
+ if(easy)
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
-struct test {
- const char *in;
- int inlen;
- const char *out;
- int outlen;
-};
-
-UNITTEST_START
+static CURLcode test_unit1396(char *arg)
{
+ CURL *easy;
+
+ UNITTEST_BEGIN(t1396_setup())
+
+ struct test {
+ const char *in;
+ int inlen;
+ const char *out;
+ int outlen;
+ };
+
/* unescape, this => that */
- const struct test list1[]={
+ const struct test list1[] = {
{"%61", 3, "a", 1},
{"%61a", 4, "aa", 2},
{"%61b", 4, "ab", 2},
{NULL, 0, NULL, 0} /* end of list marker */
};
/* escape, this => that */
- const struct test list2[]={
+ const struct test list2[] = {
{"a", 1, "a", 1},
{"/", 1, "%2F", 3},
{"a=b", 3, "a%3Db", 5},
};
int i;
- hnd = curl_easy_init();
- abort_unless(hnd != NULL, "returned NULL!");
+ easy = curl_easy_init();
+ abort_unless(easy != NULL, "returned NULL!");
for(i = 0; list1[i].in; i++) {
int outlen;
- char *out = curl_easy_unescape(hnd,
+ char *out = curl_easy_unescape(easy,
list1[i].in, list1[i].inlen,
&outlen);
for(i = 0; list2[i].in; i++) {
int outlen;
- char *out = curl_easy_escape(hnd, list2[i].in, list2[i].inlen);
+ char *out = curl_easy_escape(easy, list2[i].in, list2[i].inlen);
abort_unless(out != NULL, "returned NULL!");
outlen = (int)strlen(out);
curl_free(out);
}
+
+ UNITTEST_END(t1396_stop(easy))
}
-UNITTEST_STOP
***************************************************************************/
#include "curlcheck.h"
+#include "vtls/hostcheck.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1397(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+ UNITTEST_BEGIN_SIMPLE
/* only these backends define the tested functions */
#if defined(USE_OPENSSL) || defined(USE_SCHANNEL)
-#include "vtls/hostcheck.h"
-UNITTEST_START
-{
struct testcase {
const char *host;
const char *pattern;
bool match;
};
- static struct testcase tests[] = {
+ static const struct testcase tests[] = {
{"", "", FALSE},
{"a", "", FALSE},
{"", "b", FALSE},
unitfail++;
}
}
-}
-
-UNITTEST_STOP
-#else
-
-UNITTEST_START
-
-UNITTEST_STOP
#endif
+
+ UNITTEST_END_SIMPLE
+}
#pragma GCC diagnostic ignored "-Wformat"
#endif
-static CURLcode unit_setup(void)
+static CURLcode test_unit1398(char *arg)
{
- return CURLE_OK;
+ UNITTEST_BEGIN_SIMPLE
+
+ int rc;
+ char buf[3] = {'b', 'u', 'g'};
+ const char *str = "bug";
+ int width = 3;
+ char output[130];
+
+ /*#define curl_msnprintf snprintf */
+
+ /* without a trailing zero */
+ rc = curl_msnprintf(output, 4, "%.*s", width, buf);
+ fail_unless(rc == 3, "return code should be 3");
+ fail_unless(!strcmp(output, "bug"), "wrong output");
+
+ /* with a trailing zero */
+ rc = curl_msnprintf(output, 4, "%.*s", width, str);
+ fail_unless(rc == 3, "return code should be 3");
+ fail_unless(!strcmp(output, "bug"), "wrong output");
+
+ width = 2;
+ /* one byte less */
+ rc = curl_msnprintf(output, 4, "%.*s", width, buf);
+ fail_unless(rc == 2, "return code should be 2");
+ fail_unless(!strcmp(output, "bu"), "wrong output");
+
+ /* string with larger precision */
+ rc = curl_msnprintf(output, 8, "%.8s", str);
+ fail_unless(rc == 3, "return code should be 3");
+ fail_unless(!strcmp(output, "bug"), "wrong output");
+
+ /* longer string with precision */
+ rc = curl_msnprintf(output, 8, "%.3s", "0123456789");
+ fail_unless(rc == 3, "return code should be 3");
+ fail_unless(!strcmp(output, "012"), "wrong output");
+
+ /* negative width */
+ rc = curl_msnprintf(output, 8, "%-8s", str);
+ fail_unless(rc == 7, "return code should be 7");
+ fail_unless(!strcmp(output, "bug "), "wrong output");
+
+ /* larger width that string length */
+ rc = curl_msnprintf(output, 8, "%8s", str);
+ fail_unless(rc == 7, "return code should be 7");
+ fail_unless(!strcmp(output, " bu"), "wrong output");
+
+ /* output a number in a limited output */
+ rc = curl_msnprintf(output, 4, "%d", 10240);
+ fail_unless(rc == 3, "return code should be 3");
+ fail_unless(!strcmp(output, "102"), "wrong output");
+
+ /* padded strings */
+ rc = curl_msnprintf(output, 16, "%8s%8s", str, str);
+ fail_unless(rc == 15, "return code should be 15");
+ fail_unless(!strcmp(output, " bug bu"), "wrong output");
+
+ /* padded numbers */
+ rc = curl_msnprintf(output, 16, "%8d%8d", 1234, 5678);
+ fail_unless(rc == 15, "return code should be 15");
+ fail_unless(!strcmp(output, " 1234 567"), "wrong output");
+
+ /* double precision */
+ rc = curl_msnprintf(output, 24, "%2$.*1$.99d", 3, 5678);
+ fail_unless(rc == 0, "return code should be 0");
+
+ /* 129 input % flags */
+ rc = curl_msnprintf(output, 130,
+ "%s%s%s%s%s%s%s%s%s%s" /* 10 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 20 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 30 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 40 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 50 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 60 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 70 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 80 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 90 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 100 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 110 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 120 */
+ "%s%s%s%s%s%s%s%s%s", /* 129 */
+
+ "a", "", "", "", "", "", "", "", "", "", /* 10 */
+ "b", "", "", "", "", "", "", "", "", "", /* 20 */
+ "c", "", "", "", "", "", "", "", "", "", /* 30 */
+ "d", "", "", "", "", "", "", "", "", "", /* 40 */
+ "e", "", "", "", "", "", "", "", "", "", /* 50 */
+ "f", "", "", "", "", "", "", "", "", "", /* 60 */
+ "g", "", "", "", "", "", "", "", "", "", /* 70 */
+ "h", "", "", "", "", "", "", "", "", "", /* 80 */
+ "i", "", "", "", "", "", "", "", "", "", /* 90 */
+ "j", "", "", "", "", "", "", "", "", "", /* 100 */
+ "k", "", "", "", "", "", "", "", "", "", /* 110 */
+ "l", "", "", "", "", "", "", "", "", "", /* 120 */
+ "m", "", "", "", "", "", "", "", "" /* 129 */
+ );
+ fail_unless(rc == 0, "return code should be 0");
+
+ /* 128 input % flags */
+ rc = curl_msnprintf(output, 130,
+ "%s%s%s%s%s%s%s%s%s%s" /* 10 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 20 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 30 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 40 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 50 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 60 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 70 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 80 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 90 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 100 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 110 */
+ "%s%s%s%s%s%s%s%s%s%s" /* 120 */
+ "%s%s%s%s%s%s%s%s", /* 128 */
+
+ "a", "", "", "", "", "", "", "", "", "", /* 10 */
+ "b", "", "", "", "", "", "", "", "", "", /* 20 */
+ "c", "", "", "", "", "", "", "", "", "", /* 30 */
+ "d", "", "", "", "", "", "", "", "", "", /* 40 */
+ "e", "", "", "", "", "", "", "", "", "", /* 50 */
+ "f", "", "", "", "", "", "", "", "", "", /* 60 */
+ "g", "", "", "", "", "", "", "", "", "", /* 70 */
+ "h", "", "", "", "", "", "", "", "", "", /* 80 */
+ "i", "", "", "", "", "", "", "", "", "", /* 90 */
+ "j", "", "", "", "", "", "", "", "", "", /* 100 */
+ "k", "", "", "", "", "", "", "", "", "", /* 110 */
+ "l", "", "", "", "", "", "", "", "", "", /* 120 */
+ "m", "", "", "", "", "", "", "" /* 128 */
+ );
+ fail_unless(rc == 13, "return code should be 13");
+
+ /* 129 output segments */
+ rc = curl_msnprintf(output, 130,
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
+ "%%%%%%%%%%%%%%%%%%" /* 129 */
+ );
+ fail_unless(rc == 0, "return code should be 0");
+
+ /* 128 output segments */
+ rc = curl_msnprintf(output, 129,
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
+ "%%%%%%%%%%%%%%%%" /* 128 */
+ );
+ fail_unless(rc == 128, "return code should be 128");
+
+ UNITTEST_END_SIMPLE
}
-static void unit_stop(void)
-{
-}
-
-UNITTEST_START
-
-int rc;
-char buf[3] = {'b', 'u', 'g'};
-const char *str = "bug";
-int width = 3;
-char output[130];
-
-/*#define curl_msnprintf snprintf */
-
-/* without a trailing zero */
-rc = curl_msnprintf(output, 4, "%.*s", width, buf);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "bug"), "wrong output");
-
-/* with a trailing zero */
-rc = curl_msnprintf(output, 4, "%.*s", width, str);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "bug"), "wrong output");
-
-width = 2;
-/* one byte less */
-rc = curl_msnprintf(output, 4, "%.*s", width, buf);
-fail_unless(rc == 2, "return code should be 2");
-fail_unless(!strcmp(output, "bu"), "wrong output");
-
-/* string with larger precision */
-rc = curl_msnprintf(output, 8, "%.8s", str);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "bug"), "wrong output");
-
-/* longer string with precision */
-rc = curl_msnprintf(output, 8, "%.3s", "0123456789");
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "012"), "wrong output");
-
-/* negative width */
-rc = curl_msnprintf(output, 8, "%-8s", str);
-fail_unless(rc == 7, "return code should be 7");
-fail_unless(!strcmp(output, "bug "), "wrong output");
-
-/* larger width that string length */
-rc = curl_msnprintf(output, 8, "%8s", str);
-fail_unless(rc == 7, "return code should be 7");
-fail_unless(!strcmp(output, " bu"), "wrong output");
-
-/* output a number in a limited output */
-rc = curl_msnprintf(output, 4, "%d", 10240);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "102"), "wrong output");
-
-/* padded strings */
-rc = curl_msnprintf(output, 16, "%8s%8s", str, str);
-fail_unless(rc == 15, "return code should be 15");
-fail_unless(!strcmp(output, " bug bu"), "wrong output");
-
-/* padded numbers */
-rc = curl_msnprintf(output, 16, "%8d%8d", 1234, 5678);
-fail_unless(rc == 15, "return code should be 15");
-fail_unless(!strcmp(output, " 1234 567"), "wrong output");
-
-/* double precision */
-rc = curl_msnprintf(output, 24, "%2$.*1$.99d", 3, 5678);
-fail_unless(rc == 0, "return code should be 0");
-
-/* 129 input % flags */
-rc = curl_msnprintf(output, 130,
- "%s%s%s%s%s%s%s%s%s%s" /* 10 */
- "%s%s%s%s%s%s%s%s%s%s" /* 20 */
- "%s%s%s%s%s%s%s%s%s%s" /* 30 */
- "%s%s%s%s%s%s%s%s%s%s" /* 40 */
- "%s%s%s%s%s%s%s%s%s%s" /* 50 */
- "%s%s%s%s%s%s%s%s%s%s" /* 60 */
- "%s%s%s%s%s%s%s%s%s%s" /* 70 */
- "%s%s%s%s%s%s%s%s%s%s" /* 80 */
- "%s%s%s%s%s%s%s%s%s%s" /* 90 */
- "%s%s%s%s%s%s%s%s%s%s" /* 100 */
- "%s%s%s%s%s%s%s%s%s%s" /* 110 */
- "%s%s%s%s%s%s%s%s%s%s" /* 120 */
- "%s%s%s%s%s%s%s%s%s", /* 129 */
-
- "a", "", "", "", "", "", "", "", "", "", /* 10 */
- "b", "", "", "", "", "", "", "", "", "", /* 20 */
- "c", "", "", "", "", "", "", "", "", "", /* 30 */
- "d", "", "", "", "", "", "", "", "", "", /* 40 */
- "e", "", "", "", "", "", "", "", "", "", /* 50 */
- "f", "", "", "", "", "", "", "", "", "", /* 60 */
- "g", "", "", "", "", "", "", "", "", "", /* 70 */
- "h", "", "", "", "", "", "", "", "", "", /* 80 */
- "i", "", "", "", "", "", "", "", "", "", /* 90 */
- "j", "", "", "", "", "", "", "", "", "", /* 100 */
- "k", "", "", "", "", "", "", "", "", "", /* 110 */
- "l", "", "", "", "", "", "", "", "", "", /* 120 */
- "m", "", "", "", "", "", "", "", "" /* 129 */
- );
-fail_unless(rc == 0, "return code should be 0");
-
-/* 128 input % flags */
-rc = curl_msnprintf(output, 130,
- "%s%s%s%s%s%s%s%s%s%s" /* 10 */
- "%s%s%s%s%s%s%s%s%s%s" /* 20 */
- "%s%s%s%s%s%s%s%s%s%s" /* 30 */
- "%s%s%s%s%s%s%s%s%s%s" /* 40 */
- "%s%s%s%s%s%s%s%s%s%s" /* 50 */
- "%s%s%s%s%s%s%s%s%s%s" /* 60 */
- "%s%s%s%s%s%s%s%s%s%s" /* 70 */
- "%s%s%s%s%s%s%s%s%s%s" /* 80 */
- "%s%s%s%s%s%s%s%s%s%s" /* 90 */
- "%s%s%s%s%s%s%s%s%s%s" /* 100 */
- "%s%s%s%s%s%s%s%s%s%s" /* 110 */
- "%s%s%s%s%s%s%s%s%s%s" /* 120 */
- "%s%s%s%s%s%s%s%s", /* 128 */
-
- "a", "", "", "", "", "", "", "", "", "", /* 10 */
- "b", "", "", "", "", "", "", "", "", "", /* 20 */
- "c", "", "", "", "", "", "", "", "", "", /* 30 */
- "d", "", "", "", "", "", "", "", "", "", /* 40 */
- "e", "", "", "", "", "", "", "", "", "", /* 50 */
- "f", "", "", "", "", "", "", "", "", "", /* 60 */
- "g", "", "", "", "", "", "", "", "", "", /* 70 */
- "h", "", "", "", "", "", "", "", "", "", /* 80 */
- "i", "", "", "", "", "", "", "", "", "", /* 90 */
- "j", "", "", "", "", "", "", "", "", "", /* 100 */
- "k", "", "", "", "", "", "", "", "", "", /* 110 */
- "l", "", "", "", "", "", "", "", "", "", /* 120 */
- "m", "", "", "", "", "", "", "" /* 128 */
- );
-fail_unless(rc == 13, "return code should be 13");
-
-/* 129 output segments */
-rc = curl_msnprintf(output, 130,
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
- "%%%%%%%%%%%%%%%%%%" /* 129 */
- );
-fail_unless(rc == 0, "return code should be 0");
-
-/* 128 output segments */
-rc = curl_msnprintf(output, 129,
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
- "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
- "%%%%%%%%%%%%%%%%" /* 128 */
- );
-fail_unless(rc == 128, "return code should be 128");
-
-UNITTEST_STOP
-
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
#include "urldata.h"
#include "progress.h"
-static int usec_magnitude = 1000000;
-
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
/*
* Invoke Curl_pgrsTime for TIMER_STARTSINGLE to trigger the behavior that
* manages is_t_startransfer_set, but fake the t_startsingle time for purposes
static bool usec_matches_seconds(timediff_t time_usec, int expected_seconds)
{
+ static int usec_magnitude = 1000000;
+
int time_sec = (int)(time_usec / usec_magnitude);
bool same = (time_sec == expected_seconds);
curl_mfprintf(stderr, "is %d us same as %d seconds? %s\n",
* E.g., if t_starttransfer took 2 seconds initially and took another 1
* second for the redirect request, then the resulting t_starttransfer should
* be 3 seconds. */
-UNITTEST_START
+static CURLcode test_unit1399(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+
struct Curl_easy data;
struct curltime now = curlx_now();
Curl_pgrsTime(&data, TIMER_STARTTRANSFER);
expect_timer_seconds(&data, 3);
-UNITTEST_STOP
+
+ UNITTEST_END_SIMPLE
+}
#include "urldata.h"
#include "curl_ntlm_core.h"
-static CURL *t1600_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1600_setup(CURL **easy)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
- t1600_easy = curl_easy_init();
- if(!t1600_easy) {
+ *easy = curl_easy_init();
+ if(!*easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
}
return res;
}
-static void unit_stop(void)
+static void t1600_stop(CURL *easy)
{
- curl_easy_cleanup(t1600_easy);
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
-UNITTEST_START
+static CURLcode test_unit1600(char *arg)
+{
+ CURL *easy;
+
+ UNITTEST_BEGIN(t1600_setup(&easy))
#if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || \
defined(USE_WIN32_CRYPTO))
"\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0"
"\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21);
-/* !checksrc! disable LONGLINE 2 */
+ /* !checksrc! disable LONGLINE 2 */
Curl_ntlm_core_mk_nt_hash("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output);
verify_memory(testp,
"\x36\x9d\xae\x06\x84\x7e\xe1\xc1\x4a\x94\x39\xea\x6f\x44\x8c\x65\x00\x00\x00\x00\x00", 21);
#endif
-UNITTEST_STOP
+ UNITTEST_END(t1600_stop(easy))
+}
#include "curl_md5.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1601(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \
|| !defined(CURL_DISABLE_DIGEST_AUTH)
"\x87\x5f\x22", MD5_DIGEST_LEN);
#endif
-
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include <memdebug.h> /* LAST include file */
-static struct Curl_hash t1602_hash_static;
-
static void t1602_mydtor(void *p)
{
int *ptr = (int *)p;
free(ptr);
}
-static CURLcode unit_setup(void)
+static CURLcode t1602_setup(struct Curl_hash *hash)
{
- Curl_hash_init(&t1602_hash_static, 7, Curl_hash_str,
+ Curl_hash_init(hash, 7, Curl_hash_str,
curlx_str_key_compare, t1602_mydtor);
return CURLE_OK;
}
-static void unit_stop(void)
+static void t1602_stop(struct Curl_hash *hash)
{
- Curl_hash_destroy(&t1602_hash_static);
+ Curl_hash_destroy(hash);
}
-UNITTEST_START
+static CURLcode test_unit1602(char *arg)
+{
+ struct Curl_hash hash;
+
+ UNITTEST_BEGIN(t1602_setup(&hash))
+
int *value;
int *value2;
int *nodep;
int key = 20;
int key2 = 25;
-
value = malloc(sizeof(int));
abort_unless(value != NULL, "Out of memory");
*value = 199;
- nodep = Curl_hash_add(&t1602_hash_static, &key, klen, value);
+ nodep = Curl_hash_add(&hash, &key, klen, value);
if(!nodep)
free(value);
abort_unless(nodep, "insertion into hash failed");
- Curl_hash_clean(&t1602_hash_static);
+ Curl_hash_clean(&hash);
/* Attempt to add another key/value pair */
value2 = malloc(sizeof(int));
abort_unless(value2 != NULL, "Out of memory");
*value2 = 204;
- nodep = Curl_hash_add(&t1602_hash_static, &key2, klen, value2);
+ nodep = Curl_hash_add(&hash, &key2, klen, value2);
if(!nodep)
free(value2);
abort_unless(nodep, "insertion into hash failed");
-UNITTEST_STOP
+ UNITTEST_END(t1602_stop(&hash))
+}
#include "hash.h"
#include <memdebug.h> /* LAST include file */
-static struct Curl_hash t1603_hash_static;
static const size_t slots = 3;
static void t1603_mydtor(void *p)
++elem_dtor_calls;
}
-static CURLcode unit_setup(void)
+static CURLcode t1603_setup(struct Curl_hash *hash_static)
{
- Curl_hash_init(&t1603_hash_static, slots, Curl_hash_str,
+ Curl_hash_init(hash_static, slots, Curl_hash_str,
curlx_str_key_compare, t1603_mydtor);
return CURLE_OK;
}
-static void unit_stop(void)
+static void t1603_stop(struct Curl_hash *hash_static)
{
- Curl_hash_destroy(&t1603_hash_static);
+ Curl_hash_destroy(hash_static);
}
-UNITTEST_START
+static CURLcode test_unit1603(char *arg)
+{
+ struct Curl_hash hash_static;
+
+ UNITTEST_BEGIN(t1603_setup(&hash_static))
+
char key1[] = "key1";
char key2[] = "key2b";
char key3[] = "key3";
"Warning: hashes are not computed as expected on this "
"architecture; test coverage will be less comprehensive\n");
- nodep = Curl_hash_add(&t1603_hash_static, &key1, strlen(key1), &key1);
+ nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), &key1);
fail_unless(nodep, "insertion into hash failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+ nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
fail_unless(nodep == key1, "hash retrieval failed");
- nodep = Curl_hash_add(&t1603_hash_static, &key2, strlen(key2), &key2);
+ nodep = Curl_hash_add(&hash_static, &key2, strlen(key2), &key2);
fail_unless(nodep, "insertion into hash failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key2, strlen(key2));
+ nodep = Curl_hash_pick(&hash_static, &key2, strlen(key2));
fail_unless(nodep == key2, "hash retrieval failed");
- nodep = Curl_hash_add(&t1603_hash_static, &key3, strlen(key3), &key3);
+ nodep = Curl_hash_add(&hash_static, &key3, strlen(key3), &key3);
fail_unless(nodep, "insertion into hash failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key3, strlen(key3));
+ nodep = Curl_hash_pick(&hash_static, &key3, strlen(key3));
fail_unless(nodep == key3, "hash retrieval failed");
/* The fourth element exceeds the number of slots & collides */
- nodep = Curl_hash_add(&t1603_hash_static, &key4, strlen(key4), &key4);
+ nodep = Curl_hash_add(&hash_static, &key4, strlen(key4), &key4);
fail_unless(nodep, "insertion into hash failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+ nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
fail_unless(nodep == key4, "hash retrieval failed");
/* Make sure all elements are still accessible */
- nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+ nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
fail_unless(nodep == key1, "hash retrieval failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key2, strlen(key2));
+ nodep = Curl_hash_pick(&hash_static, &key2, strlen(key2));
fail_unless(nodep == key2, "hash retrieval failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key3, strlen(key3));
+ nodep = Curl_hash_pick(&hash_static, &key3, strlen(key3));
fail_unless(nodep == key3, "hash retrieval failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+ nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
fail_unless(nodep == key4, "hash retrieval failed");
/* Delete the second of two entries in a bucket */
- rc = Curl_hash_delete(&t1603_hash_static, &key4, strlen(key4));
+ rc = Curl_hash_delete(&hash_static, &key4, strlen(key4));
fail_unless(rc == 0, "hash delete failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+ nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
fail_unless(nodep == key1, "hash retrieval failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+ nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
fail_unless(!nodep, "hash retrieval should have failed");
/* Insert that deleted node again */
- nodep = Curl_hash_add(&t1603_hash_static, &key4, strlen(key4), &key4);
+ nodep = Curl_hash_add(&hash_static, &key4, strlen(key4), &key4);
fail_unless(nodep, "insertion into hash failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+ nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
fail_unless(nodep == key4, "hash retrieval failed");
/* Delete the first of two entries in a bucket */
- rc = Curl_hash_delete(&t1603_hash_static, &key1, strlen(key1));
+ rc = Curl_hash_delete(&hash_static, &key1, strlen(key1));
fail_unless(rc == 0, "hash delete failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+ nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
fail_unless(!nodep, "hash retrieval should have failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+ nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
fail_unless(nodep == key4, "hash retrieval failed");
/* Delete the remaining one of two entries in a bucket */
- rc = Curl_hash_delete(&t1603_hash_static, &key4, strlen(key4));
+ rc = Curl_hash_delete(&hash_static, &key4, strlen(key4));
fail_unless(rc == 0, "hash delete failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+ nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
fail_unless(!nodep, "hash retrieval should have failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+ nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
fail_unless(!nodep, "hash retrieval should have failed");
/* Delete an already deleted node */
- rc = Curl_hash_delete(&t1603_hash_static, &key4, strlen(key4));
+ rc = Curl_hash_delete(&hash_static, &key4, strlen(key4));
fail_unless(rc, "hash delete should have failed");
/* Replace an existing node */
- nodep = Curl_hash_add(&t1603_hash_static, &key1, strlen(key1), ¬akey);
+ nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), ¬akey);
fail_unless(nodep, "insertion into hash failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+ nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
fail_unless(nodep == notakey, "hash retrieval failed");
/* Make sure all remaining elements are still accessible */
- nodep = Curl_hash_pick(&t1603_hash_static, &key2, strlen(key2));
+ nodep = Curl_hash_pick(&hash_static, &key2, strlen(key2));
fail_unless(nodep == key2, "hash retrieval failed");
- nodep = Curl_hash_pick(&t1603_hash_static, &key3, strlen(key3));
+ nodep = Curl_hash_pick(&hash_static, &key3, strlen(key3));
fail_unless(nodep == key3, "hash retrieval failed");
/* Add element with own destructor */
- nodep = Curl_hash_add2(&t1603_hash_static, &key1, strlen(key1), &key1,
+ nodep = Curl_hash_add2(&hash_static, &key1, strlen(key1), &key1,
my_elem_dtor);
fail_unless(nodep, "add2 insertion into hash failed");
fail_unless(elem_dtor_calls == 0, "element destructor count should be 0");
/* Add it again, should invoke destructor on first */
- nodep = Curl_hash_add2(&t1603_hash_static, &key1, strlen(key1), &key1,
+ nodep = Curl_hash_add2(&hash_static, &key1, strlen(key1), &key1,
my_elem_dtor);
fail_unless(nodep, "add2 again, insertion into hash failed");
fail_unless(elem_dtor_calls == 1, "element destructor count should be 1");
/* remove, should invoke destructor */
- rc = Curl_hash_delete(&t1603_hash_static, &key1, strlen(key1));
+ rc = Curl_hash_delete(&hash_static, &key1, strlen(key1));
fail_unless(rc == 0, "hash delete failed");
fail_unless(elem_dtor_calls == 2, "element destructor count should be 1");
-
/* Clean up */
- Curl_hash_clean(&t1603_hash_static);
+ Curl_hash_clean(&hash_static);
-UNITTEST_STOP
+ UNITTEST_END(t1603_stop(&hash_static))
+}
#include "llist.h"
-static CURL *t1605_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1605_setup(CURL **easy)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
- t1605_easy = curl_easy_init();
- if(!t1605_easy) {
+ *easy = curl_easy_init();
+ if(!*easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
}
return res;
}
-static void unit_stop(void)
+static void t1605_stop(CURL *easy)
{
- curl_easy_cleanup(t1605_easy);
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
-UNITTEST_START
+static CURLcode test_unit1605(char *arg)
+{
+ CURL *easy;
+
+ UNITTEST_BEGIN(t1605_setup(&easy))
+
int len;
char *esc;
- esc = curl_easy_escape(t1605_easy, "", -1);
+ esc = curl_easy_escape(easy, "", -1);
fail_unless(esc == NULL, "negative string length can't work");
- esc = curl_easy_unescape(t1605_easy, "%41%41%41%41", -1, &len);
+ esc = curl_easy_unescape(easy, "%41%41%41%41", -1, &len);
fail_unless(esc == NULL, "negative string length can't work");
-UNITTEST_STOP
+ UNITTEST_END(t1605_stop(easy))
+}
#include "speedcheck.h"
#include "urldata.h"
-static struct Curl_easy *t1606_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1606_setup(struct Curl_easy **easy)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
- t1606_easy = curl_easy_init();
- if(!t1606_easy) {
+ *easy = curl_easy_init();
+ if(!*easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
}
return res;
}
-static void unit_stop(void)
+static void t1606_stop(struct Curl_easy *easy)
{
- curl_easy_cleanup(t1606_easy);
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
-static int runawhile(long time_limit,
+static int runawhile(struct Curl_easy *easy,
+ long time_limit,
long speed_limit,
curl_off_t speed,
int dec)
CURLcode result;
int finaltime;
- curl_easy_setopt(t1606_easy, CURLOPT_LOW_SPEED_LIMIT, speed_limit);
- curl_easy_setopt(t1606_easy, CURLOPT_LOW_SPEED_TIME, time_limit);
- Curl_speedinit(t1606_easy);
+ curl_easy_setopt(easy, CURLOPT_LOW_SPEED_LIMIT, speed_limit);
+ curl_easy_setopt(easy, CURLOPT_LOW_SPEED_TIME, time_limit);
+ Curl_speedinit(easy);
do {
/* fake the current transfer speed */
- t1606_easy->progress.current_speed = speed;
- result = Curl_speedcheck(t1606_easy, now);
+ easy->progress.current_speed = speed;
+ result = Curl_speedcheck(easy, now);
if(result)
break;
/* step the time */
return finaltime;
}
-UNITTEST_START
- fail_unless(runawhile(41, 41, 40, 0) == 41,
+static CURLcode test_unit1606(char *arg)
+{
+ struct Curl_easy *easy;
+
+ UNITTEST_BEGIN(t1606_setup(&easy))
+
+ fail_unless(runawhile(easy, 41, 41, 40, 0) == 41,
"wrong low speed timeout");
- fail_unless(runawhile(21, 21, 20, 0) == 21,
+ fail_unless(runawhile(easy, 21, 21, 20, 0) == 21,
"wrong low speed timeout");
- fail_unless(runawhile(60, 60, 40, 0) == 60,
+ fail_unless(runawhile(easy, 60, 60, 40, 0) == 60,
"wrong log speed timeout");
- fail_unless(runawhile(50, 50, 40, 0) == 50,
+ fail_unless(runawhile(easy, 50, 50, 40, 0) == 50,
"wrong log speed timeout");
- fail_unless(runawhile(40, 40, 40, 0) == 99,
+ fail_unless(runawhile(easy, 40, 40, 40, 0) == 99,
"should not time out");
- fail_unless(runawhile(10, 50, 100, 2) == 36,
+ fail_unless(runawhile(easy, 10, 50, 100, 2) == 36,
"bad timeout");
-UNITTEST_STOP
+
+ UNITTEST_END(t1606_stop(easy))
+}
#include "memdebug.h" /* LAST include file */
-static void unit_stop(void)
-{
- curl_global_cleanup();
-}
-
-static CURLcode unit_setup(void)
+static CURLcode t1607_setup(void)
{
CURLcode res = CURLE_OK;
-
global_init(CURL_GLOBAL_ALL);
-
return res;
}
-/* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
- addresses, so we have to do that as well. */
-static const char skip = 0;
+
+static CURLcode test_unit1607(char *arg)
+{
+ /* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
+ addresses, so we have to do that as well. */
+ static const char skip = 0;
#ifdef USE_IPV6
#define IPV6ONLY(x) x
#else
#define IPV6ONLY(x) &skip
#endif
-UNITTEST_START
-{
+ UNITTEST_BEGIN(t1607_setup())
+
struct testcase {
/* host:port:address[,address]... */
const char *optval;
curl_easy_cleanup(easy);
curl_multi_cleanup(multi);
curl_slist_free_all(list);
+
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
CURLcode Curl_shuffle_addr(struct Curl_easy *data,
struct Curl_addrinfo **addr);
-#define NUM_ADDRS 8
-static struct Curl_addrinfo addrs[NUM_ADDRS];
+static struct Curl_addrinfo addrs[8];
-static CURLcode unit_setup(void)
+static CURLcode t1608_setup(void)
{
- int i;
- for(i = 0; i < NUM_ADDRS - 1; i++) {
+ size_t i;
+ for(i = 0; i < CURL_ARRAYSIZE(addrs) - 1; i++) {
addrs[i].ai_next = &addrs[i + 1];
}
return CURLE_OK;
}
-static void unit_stop(void)
+static CURLcode test_unit1608(char *arg)
{
- curl_global_cleanup();
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN(t1608_setup())
int i;
CURLcode code;
abort_unless(addrhead != addrs, "addresses are not being reordered");
-UNITTEST_STOP
+ UNITTEST_END(curl_global_cleanup())
+}
#else
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-static void unit_stop(void)
+
+static CURLcode test_unit1608(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
+ UNITTEST_END_SIMPLE
}
-UNITTEST_START
-UNITTEST_STOP
#endif
#include "memdebug.h" /* LAST include file */
-static void unit_stop(void)
-{
- curl_global_cleanup();
-}
-
-static CURLcode unit_setup(void)
+static CURLcode t1609_setup(void)
{
CURLcode res = CURLE_OK;
-
global_init(CURL_GLOBAL_ALL);
-
return res;
}
expected result: cached address has zero timestamp and new address
*/
-UNITTEST_START
+static CURLcode test_unit1609(char *arg)
{
+ UNITTEST_BEGIN(t1609_setup())
+
struct testcase {
/* host:port:address[,address]... */
const char *optval;
curl_easy_cleanup(easy);
curl_multi_cleanup(multi);
curl_slist_free_all(list);
+
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
#include "curl_sha256.h"
-static CURLcode unit_setup(void)
+static CURLcode t1610_setup(void)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
return res;
}
-static void unit_stop(void)
+static CURLcode test_unit1610(char *arg)
{
- curl_global_cleanup();
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN(t1610_setup())
#if !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) \
|| defined(USE_LIBSSH2)
"\x15\xae", CURL_SHA256_DIGEST_LENGTH);
#endif
-
-UNITTEST_STOP
+ UNITTEST_END(curl_global_cleanup())
+}
#include "curl_md4.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1611(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
#ifdef USE_CURL_NTLM_CORE
const char string1[] = "1";
"\x0b", MD4_DIGEST_LENGTH);
#endif
-
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "curl_hmac.h"
#include "curl_md5.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1612(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \
|| !defined(CURL_DISABLE_DIGEST_AUTH)
"\xd0", HMAC_MD5_LENGTH);
#endif
-
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "noproxy.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1614(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-struct check {
- const char *a;
- const char *n;
- unsigned int bits;
- bool match;
-};
-
-struct noproxy {
- const char *a;
- const char *n;
- bool match;
-};
+ UNITTEST_BEGIN_SIMPLE
-UNITTEST_START
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_PROXY)
-{
int i;
int err = 0;
+
+ struct check {
+ const char *a;
+ const char *n;
+ unsigned int bits;
+ bool match;
+ };
struct check list4[]= {
{ "192.160.0.1", "192.160.0.1", 33, FALSE},
{ "192.160.0.1", "192.160.0.1", 32, TRUE},
{ NULL, NULL, 0, FALSE} /* end marker */
};
#endif
+ struct noproxy {
+ const char *a;
+ const char *n;
+ bool match;
+ };
struct noproxy list[]= {
{ "www.example.com", "localhost .example.com .example.de", FALSE},
{ "www.example.com", "localhost,.example.com,.example.de", TRUE},
}
}
fail_if(err, "errors");
-}
#endif
-UNITTEST_STOP
+
+ UNITTEST_END_SIMPLE
+}
#include "curl_sha512_256.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1615(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
#ifdef CURL_HAVE_SHA512_256
#endif /* CURL_HAVE_SHA512_256 */
-
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include <uint-hash.h>
#include <memdebug.h> /* LAST include file */
-static struct uint_hash t1616_hash_static;
-
static void t1616_mydtor(unsigned int id, void *elem)
{
int *ptr = (int *)elem;
free(ptr);
}
-static CURLcode unit_setup(void)
+static CURLcode t1616_setup(struct uint_hash *hash)
{
- Curl_uint_hash_init(&t1616_hash_static, 15, t1616_mydtor);
+ Curl_uint_hash_init(hash, 15, t1616_mydtor);
return CURLE_OK;
}
-static void unit_stop(void)
+static void t1616_stop(struct uint_hash *hash)
{
- Curl_uint_hash_destroy(&t1616_hash_static);
+ Curl_uint_hash_destroy(hash);
}
-UNITTEST_START
+static CURLcode test_unit1616(char *arg)
+{
+ struct uint_hash hash;
+
+ UNITTEST_BEGIN(t1616_setup(&hash))
+
int *value, *v;
int *value2;
bool ok;
unsigned int key = 20;
unsigned int key2 = 25;
-
value = malloc(sizeof(int));
abort_unless(value != NULL, "Out of memory");
*value = 199;
- ok = Curl_uint_hash_set(&t1616_hash_static, key, value);
+ ok = Curl_uint_hash_set(&hash, key, value);
if(!ok)
free(value);
abort_unless(ok, "insertion into hash failed");
- v = Curl_uint_hash_get(&t1616_hash_static, key);
+ v = Curl_uint_hash_get(&hash, key);
abort_unless(v == value, "lookup present entry failed");
- v = Curl_uint_hash_get(&t1616_hash_static, key2);
+ v = Curl_uint_hash_get(&hash, key2);
abort_unless(!v, "lookup missing entry failed");
- Curl_uint_hash_clear(&t1616_hash_static);
+ Curl_uint_hash_clear(&hash);
/* Attempt to add another key/value pair */
value2 = malloc(sizeof(int));
abort_unless(value2 != NULL, "Out of memory");
*value2 = 204;
- ok = Curl_uint_hash_set(&t1616_hash_static, key2, value2);
+ ok = Curl_uint_hash_set(&hash, key2, value2);
if(!ok)
free(value2);
abort_unless(ok, "insertion into hash failed");
- v = Curl_uint_hash_get(&t1616_hash_static, key2);
+ v = Curl_uint_hash_get(&hash, key2);
abort_unless(v == value2, "lookup present entry failed");
- v = Curl_uint_hash_get(&t1616_hash_static, key);
+ v = Curl_uint_hash_get(&hash, key);
abort_unless(!v, "lookup missing entry failed");
-UNITTEST_STOP
+ UNITTEST_END(t1616_stop(&hash))
+}
#include "memdebug.h" /* LAST include file */
-static CURLcode unit_setup(void)
+static CURLcode t1620_setup(void)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
return res;
}
-static void unit_stop(void)
-{
- curl_global_cleanup();
-}
-
static void t1620_parse(
const char *input,
const char *exp_username,
free(options);
}
-UNITTEST_START
+static CURLcode test_unit1620(char *arg)
{
+ UNITTEST_BEGIN(t1620_setup())
+
CURLcode rc;
struct Curl_easy *empty;
enum dupstring i;
rc = Curl_close(&empty);
fail_unless(rc == CURLE_OK, "Curl_close() failed");
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
#include "doh.h"
#include "dynbuf.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1650(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
+ UNITTEST_BEGIN_SIMPLE
#ifndef CURL_DISABLE_DOH
+
#define DNS_PREAMBLE "\x00\x00\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00"
#define LABEL_TEST "\x04\x74\x65\x73\x74"
#define LABEL_HOST "\x04\x68\x6f\x73\x74"
#define DNS_Q1 DNS_PREAMBLE LABEL_TEST LABEL_HOST LABEL_NAME DNSA_EPILOGUE
#define DNS_Q2 DNS_PREAMBLE LABEL_TEST LABEL_HOST LABEL_NAME DNSAAAA_EPILOGUE
-struct dohrequest {
- /* input */
- const char *name;
- DNStype type;
-
- /* output */
- const char *packet;
- size_t size;
- DOHcode rc;
-};
-
-
-static const struct dohrequest req[] = {
- {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
- {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
- {"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
- ".host.name",
- DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
-};
-
-struct dohresp {
- /* input */
- const char *packet;
- size_t size;
- DNStype type;
+ struct dohrequest {
+ /* input */
+ const char *name;
+ DNStype type;
- /* output */
- DOHcode rc;
- const char *out;
-};
+ /* output */
+ const char *packet;
+ size_t size;
+ DOHcode rc;
+ };
+
+ static const struct dohrequest req[] = {
+ {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
+ {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
+ {"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
+ ".host.name",
+ DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
+ };
+
+ struct dohresp {
+ /* input */
+ const char *packet;
+ size_t size;
+ DNStype type;
+
+ /* output */
+ DOHcode rc;
+ const char *out;
+ };
#define DNS_FOO_EXAMPLE_COM \
"\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x03\x66\x6f\x6f" \
"\x01\xc0\x0c\x00\x01\x00\x01\x00\x00\x00\x37\x00\x04\x7f\x00\x00" \
"\x01"
-static const char full49[] = DNS_FOO_EXAMPLE_COM;
+ static const char full49[] = DNS_FOO_EXAMPLE_COM;
-static const struct dohresp resp[] = {
+ static const struct dohresp resp[] = {
{"\x00\x00", 2, DNS_TYPE_A, DOH_TOO_SMALL_BUFFER, NULL },
{"\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01", 12,
DNS_TYPE_A, DOH_DNS_BAD_ID, NULL },
DNS_TYPE_AAAA, DOH_OK,
"2020:2020:0000:0000:0000:0000:0000:2020 " },
-};
+ };
-UNITTEST_START
-{
size_t size = 0;
unsigned char buffer[256];
size_t i;
}
fail_if(d.numcname, "bad cname counter");
}
-}
-UNITTEST_STOP
-
-#else /* CURL_DISABLE_DOH */
-UNITTEST_START
-/* nothing to do, just succeed */
-UNITTEST_STOP
-
-
#endif
+
+ UNITTEST_END_SIMPLE
+}
#include "vtls/x509asn1.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
+static CURLcode test_unit1651(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
-}
#if defined(USE_GNUTLS) || defined(USE_SCHANNEL)
-/* cert captured from gdb when connecting to curl.se on October 26
- 2018 */
-static unsigned char cert[] = {
+ /* cert captured from gdb when connecting to curl.se on October 26
+ 2018 */
+ static unsigned char cert[] = {
0x30, 0x82, 0x0F, 0x5B, 0x30, 0x82, 0x0E, 0x43, 0xA0, 0x03, 0x02, 0x01, 0x02,
0x02, 0x0C, 0x08, 0x77, 0x99, 0x2C, 0x6B, 0x67, 0xE1, 0x18, 0xD6, 0x66, 0x66,
0x9E, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01,
0x70, 0x77, 0x54, 0x57, 0x09, 0x03, 0x56, 0x4A, 0x33, 0x60, 0x00, 0x27, 0xFE,
0xA7, 0xD7, 0xA9, 0xC4, 0xEC, 0x17, 0x17, 0x8D, 0x87, 0x70, 0x6B, 0x48, 0x88,
0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB,
-};
+ };
-UNITTEST_START
-{
CURLcode result;
const char *beg = (const char *)&cert[0];
const char *end = (const char *)&cert[sizeof(cert)];
curl_easy_cleanup(data);
}
curl_global_cleanup();
-}
-UNITTEST_STOP
-
#else
+ puts("not tested since Curl_extract_certinfo() is not built in");
+#endif
-UNITTEST_START
-{
- puts("not tested since Curl_extract_certinfo() is not built-in");
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
-
-#endif
* updated to still be valid.
*/
-static struct Curl_easy *t1652_easy;
-
static char input[4096];
static char output[4096];
-int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
- void *userptr);
-
/*
* This debugf callback is simply dumping the string into the static buffer
* for the unit test to inspect. Since we know that we're only dealing with
* text we can afford the luxury of skipping the type check here.
*/
-int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
- void *userptr)
+static int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
+ void *userptr)
{
(void)handle;
(void)type;
return 0;
}
-static CURLcode unit_setup(void)
+static CURLcode t1652_setup(struct Curl_easy **easy)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
- t1652_easy = curl_easy_init();
- if(!t1652_easy) {
+ *easy = curl_easy_init();
+ if(!*easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
}
- curl_easy_setopt(t1652_easy, CURLOPT_DEBUGFUNCTION, debugf_cb);
- curl_easy_setopt(t1652_easy, CURLOPT_VERBOSE, 1L);
+ curl_easy_setopt(*easy, CURLOPT_DEBUGFUNCTION, debugf_cb);
+ curl_easy_setopt(*easy, CURLOPT_VERBOSE, 1L);
return res;
}
-static void unit_stop(void)
+static void t1652_stop(struct Curl_easy *easy)
{
- curl_easy_cleanup(t1652_easy);
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
return strncmp(info, two, nl - info);
}
-UNITTEST_START
+static CURLcode test_unit1652(char *arg)
+{
+ struct Curl_easy *easy;
+
+ UNITTEST_BEGIN(t1652_setup(&easy))
#if defined(CURL_GNUC_DIAG) && !defined(__clang__)
#pragma GCC diagnostic push
/* Injecting a simple short string via a format */
curl_msnprintf(input, sizeof(input), "Simple Test");
- Curl_infof(t1652_easy, "%s", input);
+ Curl_infof(easy, "%s", input);
fail_unless(verify(output, input) == 0, "Simple string test");
/* Injecting a few different variables with a format */
- Curl_infof(t1652_easy, "%s %u testing %lu", input, 42, 43L);
+ Curl_infof(easy, "%s %u testing %lu", input, 42, 43L);
fail_unless(verify(output, "Simple Test 42 testing 43\n") == 0,
"Format string");
/* Variations of empty strings */
- Curl_infof(t1652_easy, "");
+ Curl_infof(easy, "");
fail_unless(strlen(output) == 1, "Empty string");
- Curl_infof(t1652_easy, "%s", (char *)NULL);
+ Curl_infof(easy, "%s", (char *)NULL);
fail_unless(verify(output, "(nil)") == 0, "Passing NULL as string");
/* Note: libcurl's tracebuffer hold 2048 bytes, so the max strlen() we
/* A string just long enough to not be truncated */
memset(input, '\0', sizeof(input));
memset(input, 'A', 2045);
- Curl_infof(t1652_easy, "%s", input);
+ Curl_infof(easy, "%s", input);
fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
/* output is input + \n */
fail_unless(strlen(output) == 2046, "No truncation of infof input");
/* Just over the limit without newline for truncation via '...' */
memset(input + 2045, 'A', 4);
- Curl_infof(t1652_easy, "%s", input);
+ Curl_infof(easy, "%s", input);
fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
fail_unless(strlen(output) == 2047, "Truncation of infof input 1");
fail_unless(output[sizeof(output) - 1] == '\0',
/* Just over the limit with newline for truncation via '...' */
memset(input + 2045, 'A', 4);
memset(input + 2045 + 4, '\n', 1);
- Curl_infof(t1652_easy, "%s", input);
+ Curl_infof(easy, "%s", input);
fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
fail_unless(strlen(output) == 2047, "Truncation of infof input 2");
fail_unless(output[sizeof(output) - 1] == '\0',
/* Way over the limit for truncation via '...' */
memset(input, '\0', sizeof(input));
memset(input, 'A', sizeof(input) - 1);
- Curl_infof(t1652_easy, "%s", input);
+ Curl_infof(easy, "%s", input);
fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
fail_unless(strlen(output) == 2047, "Truncation of infof input 3");
fail_unless(output[sizeof(output) - 1] == '\0',
#pragma GCC diagnostic pop
#endif
-UNITTEST_STOP
+ UNITTEST_END(t1652_stop(easy))
+}
#include "curl/urlapi.h"
#include "urlapi-int.h"
-
-static CURLU *u;
-
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
- curl_global_cleanup();
-}
-
#define free_and_clear(x) free(x); x = NULL
-static CURLUcode parse_port(CURLU *url,
- char *h, bool has_scheme)
+static CURLUcode parse_port(CURLU *url, char *h, bool has_scheme)
{
struct dynbuf host;
CURLUcode ret;
return ret;
}
-UNITTEST_START
+static CURLcode test_unit1653(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
+
+ CURLU *u;
+
CURLUcode ret;
char *ipv6port = NULL;
char *portnum;
free(ipv6port);
curl_url_cleanup(u);
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#include "urldata.h"
#include "altsvc.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1654(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
- curl_global_cleanup();
-}
+ UNITTEST_BEGIN_SIMPLE
-UNITTEST_START
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
-{
char outname[256];
CURL *curl;
CURLcode result;
curl_easy_cleanup(curl);
fail:
Curl_altsvc_cleanup(&asi);
-}
#endif
-UNITTEST_STOP
+
+ UNITTEST_END(curl_global_cleanup())
+}
#include "doh.h" /* from the lib dir */
-static CURLcode unit_setup(void)
+static CURLcode test_unit1655(char *arg)
{
- /* whatever you want done first */
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
- /* done before shutting down and exiting */
-}
+ UNITTEST_BEGIN_SIMPLE
#ifndef CURL_DISABLE_DOH
-
-UNITTEST_START
-
-/*
- * Prove detection of write overflow using a short buffer and a name
- * of maximal valid length.
- *
- * Prove detection of other invalid input.
- */
-do {
- static const char max[] =
- /* ..|....1.........2.........3.........4.........5.........6... */
- /* 3456789012345678901234567890123456789012345678901234567890123 */
- "this.is.a.maximum-length.hostname." /* 34: 34 */
- "with-no-label-of-greater-length-than-the-sixty-three-characters."
- /* 64: 98 */
- "specified.in.the.RFCs." /* 22: 120 */
- "and.with.a.QNAME.encoding.whose.length.is.exactly." /* 50: 170 */
- "the.maximum.length.allowed." /* 27: 197 */
- "that.is.two-hundred.and.fifty-six." /* 34: 231 */
- "including.the.last.null." /* 24: 255 */
- "";
- static const char toolong[] =
- /* ..|....1.........2.........3.........4.........5.........6... */
- /* 3456789012345678901234567890123456789012345678901234567890123 */
- "here.is.a.hostname.which.is.just.barely.too.long." /* 49: 49 */
- "to.be.encoded.as.a.QNAME.of.the.maximum.allowed.length."
- /* 55: 104 */
- "which.is.256.including.a.final.zero-length.label." /* 49: 153 */
- "representing.the.root.node.so.that.a.name.with." /* 47: 200 */
- "a.trailing.dot.may.have.up.to." /* 30: 230 */
- "255.characters.never.more." /* 26: 256 */
- "";
- static const char emptylabel[] =
- "this.is.an.otherwise-valid.hostname."
- ".with.an.empty.label.";
- static const char outsizelabel[] =
- "this.is.an.otherwise-valid.hostname."
- "with-a-label-of-greater-length-than-the-sixty-three-characters-"
- "specified.in.the.RFCs.";
- int i;
-
- struct test {
- const char *name;
- const DOHcode expected_result;
- };
-
- /* plays the role of struct dnsprobe in urldata.h */
- struct demo {
- unsigned char dohbuffer[255 + 16]; /* deliberately short buffer */
- unsigned char canary1;
- unsigned char canary2;
- unsigned char canary3;
- };
-
- const struct test playlist[4] = {
- { toolong, DOH_DNS_NAME_TOO_LONG }, /* expect early failure */
- { emptylabel, DOH_DNS_BAD_LABEL }, /* also */
- { outsizelabel, DOH_DNS_BAD_LABEL }, /* also */
- { max, DOH_OK } /* expect buffer overwrite */
- };
-
- for(i = 0; i < (int)(CURL_ARRAYSIZE(playlist)); i++) {
- const char *name = playlist[i].name;
- size_t olen = 100000;
- struct demo victim;
- DOHcode d;
-
- victim.canary1 = 87; /* magic numbers, arbitrarily picked */
- victim.canary2 = 35;
- victim.canary3 = 41;
- d = doh_req_encode(name, DNS_TYPE_A, victim.dohbuffer,
- sizeof(struct demo), /* allow room for overflow */
- &olen);
-
- fail_unless(d == playlist[i].expected_result,
- "result returned was not as expected");
- if(d == playlist[i].expected_result) {
- if(name == max) {
- fail_if(victim.canary1 == 87,
- "demo one-byte buffer overwrite did not happen");
+ /*
+ * Prove detection of write overflow using a short buffer and a name
+ * of maximal valid length.
+ *
+ * Prove detection of other invalid input.
+ */
+ do {
+ static const char max[] =
+ /* ..|....1.........2.........3.........4.........5.........6... */
+ /* 3456789012345678901234567890123456789012345678901234567890123 */
+ "this.is.a.maximum-length.hostname." /* 34: 34 */
+ "with-no-label-of-greater-length-than-the-sixty-three-characters."
+ /* 64: 98 */
+ "specified.in.the.RFCs." /* 22: 120 */
+ "and.with.a.QNAME.encoding.whose.length.is.exactly." /* 50: 170 */
+ "the.maximum.length.allowed." /* 27: 197 */
+ "that.is.two-hundred.and.fifty-six." /* 34: 231 */
+ "including.the.last.null." /* 24: 255 */
+ "";
+ static const char toolong[] =
+ /* ..|....1.........2.........3.........4.........5.........6... */
+ /* 3456789012345678901234567890123456789012345678901234567890123 */
+ "here.is.a.hostname.which.is.just.barely.too.long." /* 49: 49 */
+ "to.be.encoded.as.a.QNAME.of.the.maximum.allowed.length."
+ /* 55: 104 */
+ "which.is.256.including.a.final.zero-length.label." /* 49: 153 */
+ "representing.the.root.node.so.that.a.name.with." /* 47: 200 */
+ "a.trailing.dot.may.have.up.to." /* 30: 230 */
+ "255.characters.never.more." /* 26: 256 */
+ "";
+ static const char emptylabel[] =
+ "this.is.an.otherwise-valid.hostname."
+ ".with.an.empty.label.";
+ static const char outsizelabel[] =
+ "this.is.an.otherwise-valid.hostname."
+ "with-a-label-of-greater-length-than-the-sixty-three-characters-"
+ "specified.in.the.RFCs.";
+ int i;
+
+ struct test {
+ const char *name;
+ const DOHcode expected_result;
+ };
+
+ /* plays the role of struct dnsprobe in urldata.h */
+ struct demo {
+ unsigned char dohbuffer[255 + 16]; /* deliberately short buffer */
+ unsigned char canary1;
+ unsigned char canary2;
+ unsigned char canary3;
+ };
+
+ const struct test playlist[4] = {
+ { toolong, DOH_DNS_NAME_TOO_LONG }, /* expect early failure */
+ { emptylabel, DOH_DNS_BAD_LABEL }, /* also */
+ { outsizelabel, DOH_DNS_BAD_LABEL }, /* also */
+ { max, DOH_OK } /* expect buffer overwrite */
+ };
+
+ for(i = 0; i < (int)(CURL_ARRAYSIZE(playlist)); i++) {
+ const char *name = playlist[i].name;
+ size_t olen = 100000;
+ struct demo victim;
+ DOHcode d;
+
+ victim.canary1 = 87; /* magic numbers, arbitrarily picked */
+ victim.canary2 = 35;
+ victim.canary3 = 41;
+ d = doh_req_encode(name, DNS_TYPE_A, victim.dohbuffer,
+ sizeof(struct demo), /* allow room for overflow */
+ &olen);
+
+ fail_unless(d == playlist[i].expected_result,
+ "result returned was not as expected");
+ if(d == playlist[i].expected_result) {
+ if(name == max) {
+ fail_if(victim.canary1 == 87,
+ "demo one-byte buffer overwrite did not happen");
+ }
+ else {
+ fail_unless(victim.canary1 == 87,
+ "one-byte buffer overwrite has happened");
+ }
+ fail_unless(victim.canary2 == 35,
+ "two-byte buffer overwrite has happened");
+ fail_unless(victim.canary3 == 41,
+ "three-byte buffer overwrite has happened");
}
else {
- fail_unless(victim.canary1 == 87,
- "one-byte buffer overwrite has happened");
+ if(d == DOH_OK) {
+ fail_unless(olen <= sizeof(victim.dohbuffer),
+ "wrote outside bounds");
+ fail_unless(olen > strlen(name), "unrealistic low size");
+ }
}
- fail_unless(victim.canary2 == 35,
- "two-byte buffer overwrite has happened");
- fail_unless(victim.canary3 == 41,
- "three-byte buffer overwrite has happened");
}
- else {
- if(d == DOH_OK) {
- fail_unless(olen <= sizeof(victim.dohbuffer), "wrote outside bounds");
- fail_unless(olen > strlen(name), "unrealistic low size");
- }
- }
- }
-} while(0);
-
-/* run normal cases and try to trigger buffer length related errors */
-do {
- DNStype dnstype = DNS_TYPE_A;
- unsigned char buffer[128];
- const size_t buflen = sizeof(buffer);
- const size_t magic1 = 9765;
- size_t olen1 = magic1;
- const char *sunshine1 = "a.com";
- const char *dotshine1 = "a.com.";
- const char *sunshine2 = "aa.com";
- size_t olen2;
- DOHcode ret2;
- size_t olen;
-
- DOHcode ret = doh_req_encode(sunshine1, dnstype, buffer, buflen, &olen1);
- fail_unless(ret == DOH_OK, "sunshine case 1 should pass fine");
- fail_if(olen1 == magic1, "olen has not been assigned properly");
- fail_unless(olen1 > strlen(sunshine1), "bad out length");
-
- /* with a trailing dot, the response should have the same length */
- olen2 = magic1;
- ret2 = doh_req_encode(dotshine1, dnstype, buffer, buflen, &olen2);
- fail_unless(ret2 == DOH_OK, "dotshine case should pass fine");
- fail_if(olen2 == magic1, "olen has not been assigned properly");
- fail_unless(olen1 == olen2, "olen should not grow for a trailing dot");
-
- /* add one letter, the response should be one longer */
- olen2 = magic1;
- ret2 = doh_req_encode(sunshine2, dnstype, buffer, buflen, &olen2);
- fail_unless(ret2 == DOH_OK, "sunshine case 2 should pass fine");
- fail_if(olen2 == magic1, "olen has not been assigned properly");
- fail_unless(olen1 + 1 == olen2, "olen should grow with the hostname");
-
- /* pass a short buffer, should fail */
- ret = doh_req_encode(sunshine1, dnstype, buffer, olen1 - 1, &olen);
- fail_if(ret == DOH_OK, "short buffer should have been noticed");
-
- /* pass a minimum buffer, should succeed */
- ret = doh_req_encode(sunshine1, dnstype, buffer, olen1, &olen);
- fail_unless(ret == DOH_OK, "minimal length buffer should be long enough");
- fail_unless(olen == olen1, "bad buffer length");
-} while(0);
-UNITTEST_STOP
-
-#else /* CURL_DISABLE_DOH */
-
-UNITTEST_START
-/* nothing to do, just succeed */
-UNITTEST_STOP
-
-#endif
+ } while(0);
+
+ /* run normal cases and try to trigger buffer length related errors */
+ do {
+ DNStype dnstype = DNS_TYPE_A;
+ unsigned char buffer[128];
+ const size_t buflen = sizeof(buffer);
+ const size_t magic1 = 9765;
+ size_t olen1 = magic1;
+ const char *sunshine1 = "a.com";
+ const char *dotshine1 = "a.com.";
+ const char *sunshine2 = "aa.com";
+ size_t olen2;
+ DOHcode ret2;
+ size_t olen;
+
+ DOHcode ret = doh_req_encode(sunshine1, dnstype, buffer, buflen, &olen1);
+ fail_unless(ret == DOH_OK, "sunshine case 1 should pass fine");
+ fail_if(olen1 == magic1, "olen has not been assigned properly");
+ fail_unless(olen1 > strlen(sunshine1), "bad out length");
+
+ /* with a trailing dot, the response should have the same length */
+ olen2 = magic1;
+ ret2 = doh_req_encode(dotshine1, dnstype, buffer, buflen, &olen2);
+ fail_unless(ret2 == DOH_OK, "dotshine case should pass fine");
+ fail_if(olen2 == magic1, "olen has not been assigned properly");
+ fail_unless(olen1 == olen2, "olen should not grow for a trailing dot");
+
+ /* add one letter, the response should be one longer */
+ olen2 = magic1;
+ ret2 = doh_req_encode(sunshine2, dnstype, buffer, buflen, &olen2);
+ fail_unless(ret2 == DOH_OK, "sunshine case 2 should pass fine");
+ fail_if(olen2 == magic1, "olen has not been assigned properly");
+ fail_unless(olen1 + 1 == olen2, "olen should grow with the hostname");
+
+ /* pass a short buffer, should fail */
+ ret = doh_req_encode(sunshine1, dnstype, buffer, olen1 - 1, &olen);
+ fail_if(ret == DOH_OK, "short buffer should have been noticed");
+
+ /* pass a minimum buffer, should succeed */
+ ret = doh_req_encode(sunshine1, dnstype, buffer, olen1, &olen);
+ fail_unless(ret == DOH_OK, "minimal length buffer should be long enough");
+ fail_unless(olen == olen1, "bad buffer length");
+ } while(0);
+
+#endif /* CURL_DISABLE_DOH */
+
+ UNITTEST_END_SIMPLE
+}
#include "vtls/x509asn1.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
struct test_spec {
CURLcode exp_result;
};
-static struct test_spec test_specs[] = {
+static bool do_test(const struct test_spec *spec, size_t i,
+ struct dynbuf *dbuf)
+{
+ CURLcode result;
+ const char *in = spec->input;
+
+ curlx_dyn_reset(dbuf);
+ result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
+ if(result != spec->exp_result) {
+ curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
+ i, spec->exp_result, result);
+ return FALSE;
+ }
+ else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
+ curl_mfprintf(stderr,
+ "test %zu: input '%s', expected output '%s', got '%s'\n",
+ i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static CURLcode test_unit1656(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+
+ static const struct test_spec test_specs[] = {
{ "190321134340", "1903-21-13 43:40:00", CURLE_OK },
{ "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
{ "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
{ "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
{ "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
{ "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10", CURLE_OK },
-};
-
-static bool do_test(struct test_spec *spec, size_t i, struct dynbuf *dbuf)
-{
- CURLcode result;
- const char *in = spec->input;
+ };
- curlx_dyn_reset(dbuf);
- result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
- if(result != spec->exp_result) {
- curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
- i, spec->exp_result, result);
- return FALSE;
- }
- else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
- curl_mfprintf(stderr,
- "test %zu: input '%s', expected output '%s', got '%s'\n",
- i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
- return FALSE;
- }
-
- return TRUE;
-}
-
-UNITTEST_START
-{
size_t i;
struct dynbuf dbuf;
bool all_ok = TRUE;
curlx_dyn_free(&dbuf);
curl_global_cleanup();
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#else
-UNITTEST_START
+static CURLcode test_unit1656(char *arg)
{
- puts("not tested since Curl_x509_GTime2str() is not built-in");
+ UNITTEST_BEGIN_SIMPLE
+ puts("not tested since Curl_x509_GTime2str() is not built in");
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#endif
#include "vtls/x509asn1.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
struct test1657_spec {
- CURLcode (*setbuf)(struct test1657_spec *spec, struct dynbuf *buf);
+ CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
size_t n;
CURLcode exp_result;
};
-static CURLcode make1657_nested(struct test1657_spec *spec, struct dynbuf *buf)
+static CURLcode make1657_nested(const struct test1657_spec *spec,
+ struct dynbuf *buf)
{
CURLcode r;
size_t i;
- unsigned char open_undef[] = { 0x32, 0x80 };
- unsigned char close_undef[] = { 0x00, 0x00 };
+ unsigned char open_undef[] = { 0x32, 0x80 };
+ unsigned char close_undef[] = { 0x00, 0x00 };
for(i = 0; i < spec->n; ++i) {
r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
return CURLE_OK;
}
-static struct test1657_spec test1657_specs[] = {
+static const struct test1657_spec test1657_specs[] = {
{ make1657_nested, 3, CURLE_OK },
{ make1657_nested, 16, CURLE_OK },
{ make1657_nested, 17, CURLE_BAD_FUNCTION_ARGUMENT },
{ make1657_nested, 1024, CURLE_BAD_FUNCTION_ARGUMENT },
};
-static bool do_test1657(struct test1657_spec *spec, size_t i,
+static bool do_test1657(const struct test1657_spec *spec, size_t i,
struct dynbuf *buf)
{
CURLcode result;
return TRUE;
}
-UNITTEST_START
+static CURLcode test_unit1657(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
+
size_t i;
bool all_ok = TRUE;
struct dynbuf dbuf;
curlx_dyn_free(&dbuf);
curl_global_cleanup();
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#else
-UNITTEST_START
+static CURLcode test_unit1657(char *arg)
{
- puts("not tested since Curl_x509_getASN1Element() is not built-in");
+ UNITTEST_BEGIN_SIMPLE
+ puts("not tested since Curl_x509_getASN1Element() is not built in");
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#endif
#include "doh.h" /* from the lib dir */
-static CURLcode unit_setup(void)
+/* DoH + HTTPSRR are required */
+#if !defined(CURL_DISABLE_DOH) && defined(USE_HTTPSRR)
+
+static CURLcode t1658_setup(void)
{
/* whatever you want done first */
curl_global_init(CURL_GLOBAL_ALL);
return CURLE_OK;
}
-static void unit_stop(void)
-{
- curl_global_cleanup();
- /* done before shutting down and exiting */
-}
-
-/* DoH + HTTPSRR are required */
-#if !defined(CURL_DISABLE_DOH) && defined(USE_HTTPSRR)
-
extern CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data,
const unsigned char *cp, size_t len,
struct Curl_https_rrinfo **hrr);
extern void doh_print_httpsrr(struct Curl_easy *data,
struct Curl_https_rrinfo *hrr);
-struct test {
- const char *name;
- const unsigned char *dns;
- size_t len; /* size of the dns packet */
- const char *expect;
-};
-
/*
* The idea here is that we pass one DNS packet at the time to the decoder. we
* then generate a string output with the results and compare if it matches
}
}
-UNITTEST_START
+static CURLcode test_unit1658(char *arg)
{
+ UNITTEST_BEGIN(t1658_setup())
+
/* The "SvcParamKeys" specified within the HTTPS RR packet *must* be
provided in numerical order. */
- static struct test t[] = {
+ struct test {
+ const char *name;
+ const unsigned char *dns;
+ size_t len; /* size of the dns packet */
+ const char *expect;
+ };
+
+ static const struct test t[] = {
{
"single h2 alpn",
(const unsigned char *)"\x00\x00" /* 16-bit prio */
}
curl_easy_cleanup(easy);
}
+
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
#else /* CURL_DISABLE_DOH or not HTTPSRR enabled */
-UNITTEST_START
-/* nothing to do, just succeed */
-UNITTEST_STOP
+static CURLcode test_unit1658(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+ UNITTEST_END_SIMPLE
+}
#endif
#include "urldata.h"
#include "hsts.h"
-static CURLcode unit_setup(void)
+#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS)
+static CURLcode test_unit1660(char *arg)
{
- return CURLE_OK;
+ UNITTEST_BEGIN_SIMPLE
+ puts("nothing to do when HTTP or HSTS are disabled");
+ UNITTEST_END_SIMPLE
}
+#else
-static void unit_stop(void)
+static void showsts(struct stsentry *e, const char *chost)
{
- curl_global_cleanup();
+ if(!e)
+ printf("'%s' is not HSTS\n", chost);
+ else {
+ curl_mprintf("%s [%s]: %" CURL_FORMAT_CURL_OFF_T "%s\n",
+ chost, e->host, e->expires,
+ e->includeSubDomains ? " includeSubDomains" : "");
+ }
}
-#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS)
-UNITTEST_START
+static CURLcode test_unit1660(char *arg)
{
- puts("nothing to do when HTTP or HSTS are disabled");
-}
-UNITTEST_STOP
-#else
+ UNITTEST_BEGIN_SIMPLE
-struct testit {
- const char *host;
- const char *chost; /* if non-NULL, use to lookup with */
- const char *hdr; /* if NULL, just do the lookup */
- const CURLcode result; /* parse result */
-};
+ struct testit {
+ const char *host;
+ const char *chost; /* if non-NULL, use to lookup with */
+ const char *hdr; /* if NULL, just do the lookup */
+ const CURLcode result; /* parse result */
+ };
-static const struct testit headers[] = {
+ static const struct testit headers[] = {
/* two entries read from disk cache, verify first */
{ "-", "readfrom.example", NULL, CURLE_OK},
{ "-", "old.example", NULL, CURLE_OK},
/* make this live for 7 seconds */
{ "expire.example", NULL, "max-age=\"7\"\r\n", CURLE_OK },
{ NULL, NULL, NULL, CURLE_OK }
-};
-
-static void showsts(struct stsentry *e, const char *chost)
-{
- if(!e)
- printf("'%s' is not HSTS\n", chost);
- else {
- curl_mprintf("%s [%s]: %" CURL_FORMAT_CURL_OFF_T "%s\n",
- chost, e->host, e->expires,
- e->includeSubDomains ? " includeSubDomains" : "");
- }
-}
+ };
-UNITTEST_START
-{
CURLcode result;
struct stsentry *e;
struct hsts *h = Curl_hsts_init();
Curl_hsts_cleanup(&h);
curl_easy_cleanup(easy);
curl_global_cleanup();
+
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
#endif
#include "bufref.h"
#include "memdebug.h"
-static struct bufref bufref;
-
static int freecount = 0;
static void test_free(void *p)
free(p);
}
-static CURLcode unit_setup(void)
+static CURLcode t1661_setup(struct bufref *bufref)
{
- Curl_bufref_init(&bufref);
+ Curl_bufref_init(bufref);
return CURLE_OK;
}
-static void unit_stop(void)
+static void t1661_stop(struct bufref *bufref)
{
- Curl_bufref_free(&bufref);
+ Curl_bufref_free(bufref);
}
-UNITTEST_START
+static CURLcode test_unit1661(char *arg)
{
+ struct bufref bufref;
+
+ UNITTEST_BEGIN(t1661_setup(&bufref))
+
const char *buffer = NULL;
CURLcode result = CURLE_OK;
* 2: reference will be NULL
* 3: destructor will be NULL
*/
-
fail_unless(!bufref.ptr, "Initial reference must be NULL");
fail_unless(!bufref.len, "Initial length must be NULL");
fail_unless(!bufref.dtor, "Destructor must be NULL");
/**
* testing Curl_bufref_set
*/
-
buffer = malloc(13);
abort_unless(buffer, "Out of memory");
Curl_bufref_set(&bufref, buffer, 13, test_free);
/**
* testing Curl_bufref_ptr
*/
-
fail_unless((const char *) Curl_bufref_ptr(&bufref) == buffer,
"Wrong pointer value returned");
/**
* testing Curl_bufref_len
*/
-
fail_unless(Curl_bufref_len(&bufref) == 13, "Wrong data size returned");
/**
* testing Curl_bufref_memdup
*/
-
result = Curl_bufref_memdup(&bufref, "1661", 3);
abort_unless(result == CURLE_OK, curl_easy_strerror(result));
fail_unless(freecount == 1, "Destructor not called");
/**
* testing Curl_bufref_free
*/
-
Curl_bufref_free(&bufref);
fail_unless(freecount == 1, "Wrong destructor called");
fail_unless(!bufref.ptr, "Initial reference must be NULL");
fail_unless(!bufref.len, "Initial length must be NULL");
fail_unless(!bufref.dtor, "Destructor must be NULL");
+
+ UNITTEST_END(t1661_stop(&bufref))
}
-UNITTEST_STOP
#include <netinet/in6.h>
#endif
-#include <curl/curl.h>
-
#include "cf-socket.h"
#include "memdebug.h" /* LAST include file */
-static CURLcode unit_setup(void)
+static CURLcode t1663_setup(void)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
return res;
}
-static void unit_stop(void)
-{
- curl_global_cleanup();
-}
-
static void t1663_parse(
const char *input_data,
const char *exp_dev,
free(host);
}
-UNITTEST_START
+static CURLcode test_unit1663(char *arg)
{
+ UNITTEST_BEGIN(t1663_setup())
+
t1663_parse("dev", "dev", NULL, NULL, CURLE_OK);
t1663_parse("if!eth0", NULL, "eth0", NULL, CURLE_OK);
t1663_parse("host!myname", NULL, NULL, "myname", CURLE_OK);
t1663_parse("ifhost!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("ifhost!eth0", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
t1663_parse("ifhost!eth0!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
+
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
#include <netinet/in6.h>
#endif
-#include <curl/curl.h>
-
#include "curlx/strparse.h"
#include "memdebug.h" /* LAST include file */
-static CURLcode unit_setup(void)
+static CURLcode t1664_setup(void)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
return res;
}
-static void unit_stop(void)
+static CURLcode test_unit1664(char *arg)
{
- curl_global_cleanup();
-}
+ UNITTEST_BEGIN(t1664_setup())
-UNITTEST_START
-{
static const char *wordparse[] = {
"word",
"word ",
}
}
+ UNITTEST_END(curl_global_cleanup())
}
-UNITTEST_STOP
#include "http_aws_sigv4.h"
#include "dynbuf.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1979(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+ UNITTEST_BEGIN_SIMPLE
-UNITTEST_START
-{
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS)
struct testcase {
const char *testname;
curlx_dyn_free(&canonical_path);
}
#endif /* !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS) */
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#include "http_aws_sigv4.h"
#include "dynbuf.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit1980(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+ UNITTEST_BEGIN_SIMPLE
-UNITTEST_START
-{
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS)
struct testcase {
const char *testname;
curlx_dyn_free(&canonical_query);
}
#endif /* !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS) */
+
+ UNITTEST_END_SIMPLE
}
-UNITTEST_STOP
#include "curl_trc.h"
#include "memdebug.h"
-static CURL *t2600_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t2600_setup(CURL **easy)
{
CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
- t2600_easy = curl_easy_init();
- if(!t2600_easy) {
+ *easy = curl_easy_init();
+ if(!*easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
}
curl_global_trace("all");
- curl_easy_setopt(t2600_easy, CURLOPT_VERBOSE, 1L);
+ curl_easy_setopt(*easy, CURLOPT_VERBOSE, 1L);
return res;
}
-static void unit_stop(void)
+static void t2600_stop(CURL *easy)
{
- curl_easy_cleanup(t2600_easy);
+ curl_easy_cleanup(easy);
curl_global_cleanup();
}
struct ai_family_stats cf6;
};
-static struct test_case *current_tc;
+static const struct test_case *current_tc;
static struct test_result *current_tr;
struct cf_test_ctx {
Curl_pollset_set(data, ps, 1, TRUE, TRUE);
}
-static struct Curl_cftype cft_test = {
- "TEST",
- CF_TYPE_IP_CONNECT,
- CURL_LOG_LVL_NONE,
- cf_test_destroy,
- cf_test_connect,
- Curl_cf_def_close,
- Curl_cf_def_shutdown,
- Curl_cf_def_get_host,
- cf_test_adjust_pollset,
- Curl_cf_def_data_pending,
- Curl_cf_def_send,
- Curl_cf_def_recv,
- Curl_cf_def_cntrl,
- Curl_cf_def_conn_is_alive,
- Curl_cf_def_conn_keep_alive,
- Curl_cf_def_query,
-};
-
static CURLcode cf_test_create(struct Curl_cfilter **pcf,
struct Curl_easy *data,
struct connectdata *conn,
const struct Curl_addrinfo *ai,
int transport)
{
+ static const struct Curl_cftype cft_test = {
+ "TEST",
+ CF_TYPE_IP_CONNECT,
+ CURL_LOG_LVL_NONE,
+ cf_test_destroy,
+ cf_test_connect,
+ Curl_cf_def_close,
+ Curl_cf_def_shutdown,
+ Curl_cf_def_get_host,
+ cf_test_adjust_pollset,
+ Curl_cf_def_data_pending,
+ Curl_cf_def_send,
+ Curl_cf_def_recv,
+ Curl_cf_def_cntrl,
+ Curl_cf_def_conn_is_alive,
+ Curl_cf_def_conn_keep_alive,
+ Curl_cf_def_query,
+ };
+
struct cf_test_ctx *ctx = NULL;
struct Curl_cfilter *cf = NULL;
timediff_t created_at;
return result;
}
-static void check_result(struct test_case *tc,
+static void check_result(const struct test_case *tc,
struct test_result *tr)
{
char msg[256];
}
}
-static void test_connect(struct test_case *tc)
+static void test_connect(CURL *easy, const struct test_case *tc)
{
struct test_result tr;
struct curl_slist *list = NULL;
list = curl_slist_append(NULL, tc->resolve_info);
fail_unless(list, "error allocating resolve list entry");
- curl_easy_setopt(t2600_easy, CURLOPT_RESOLVE, list);
- curl_easy_setopt(t2600_easy, CURLOPT_IPRESOLVE, (long)tc->ip_version);
- curl_easy_setopt(t2600_easy, CURLOPT_CONNECTTIMEOUT_MS,
+ curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
+ curl_easy_setopt(easy, CURLOPT_IPRESOLVE, (long)tc->ip_version);
+ curl_easy_setopt(easy, CURLOPT_CONNECTTIMEOUT_MS,
(long)tc->connect_timeout_ms);
- curl_easy_setopt(t2600_easy, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
+ curl_easy_setopt(easy, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
(long)tc->he_timeout_ms);
- curl_easy_setopt(t2600_easy, CURLOPT_URL, tc->url);
+ curl_easy_setopt(easy, CURLOPT_URL, tc->url);
memset(&tr, 0, sizeof(tr));
tr.cf6.family = "v6";
tr.cf4.family = "v4";
tr.started = curlx_now();
- tr.result = curl_easy_perform(t2600_easy);
+ tr.result = curl_easy_perform(easy);
tr.ended = curlx_now();
- curl_easy_setopt(t2600_easy, CURLOPT_RESOLVE, NULL);
+ curl_easy_setopt(easy, CURLOPT_RESOLVE, NULL);
curl_slist_free_all(list);
list = NULL;
current_tc = NULL;
#define TC_TMOT 90000 /* 90 sec max test duration */
#define CNCT_TMOT 60000 /* 60sec connect timeout */
-static struct test_case TEST_CASES[] = {
- /* TIMEOUT_MS, FAIL_MS CREATED DURATION Result, HE_PREF */
- /* CNCT HE v4 v6 v4 v6 MIN MAX */
- { 1, TURL, "test.com:123:192.0.2.1", CURL_IPRESOLVE_WHATEVER,
- CNCT_TMOT, 150, 200, 200, 1, 0, 200, TC_TMOT, R_FAIL, NULL },
- /* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT */
- { 2, TURL, "test.com:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER,
- CNCT_TMOT, 150, 200, 200, 2, 0, 400, TC_TMOT, R_FAIL, NULL },
- /* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
+static CURLcode test_unit2600(char *arg)
+{
+ CURL *easy;
+
+ UNITTEST_BEGIN(t2600_setup(&easy))
+
+ static const struct test_case TEST_CASES[] = {
+ /* TIMEOUT_MS, FAIL_MS CREATED DURATION Result, HE_PREF */
+ /* CNCT HE v4 v6 v4 v6 MIN MAX */
+ { 1, TURL, "test.com:123:192.0.2.1", CURL_IPRESOLVE_WHATEVER,
+ CNCT_TMOT, 150, 200, 200, 1, 0, 200, TC_TMOT, R_FAIL, NULL },
+ /* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT */
+ { 2, TURL, "test.com:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER,
+ CNCT_TMOT, 150, 200, 200, 2, 0, 400, TC_TMOT, R_FAIL, NULL },
+ /* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
#ifdef USE_IPV6
- { 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
- CNCT_TMOT, 150, 200, 200, 0, 1, 200, TC_TMOT, R_FAIL, NULL },
- /* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
- { 4, TURL, "test.com:123:::1,::2", CURL_IPRESOLVE_WHATEVER,
- CNCT_TMOT, 150, 200, 200, 0, 2, 400, TC_TMOT, R_FAIL, NULL },
- /* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT */
-
- { 5, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_WHATEVER,
- CNCT_TMOT, 150, 200, 200, 1, 1, 350, TC_TMOT, R_FAIL, "v6" },
- /* mixed ip4+6, v6 always first, v4 kicks in on HE, fails after ~350ms */
- { 6, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_WHATEVER,
- CNCT_TMOT, 150, 200, 200, 1, 1, 350, TC_TMOT, R_FAIL, "v6" },
- /* mixed ip6+4, v6 starts, v4 never starts due to high HE, TIMEOUT */
- { 7, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_V4,
- CNCT_TMOT, 150, 500, 500, 1, 0, 400, TC_TMOT, R_FAIL, NULL },
- /* mixed ip4+6, but only use v4, check it uses full connect timeout,
- although another address of the 'wrong' family is available */
- { 8, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_V6,
- CNCT_TMOT, 150, 500, 500, 0, 1, 400, TC_TMOT, R_FAIL, NULL },
- /* mixed ip4+6, but only use v6, check it uses full connect timeout,
- although another address of the 'wrong' family is available */
+ { 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
+ CNCT_TMOT, 150, 200, 200, 0, 1, 200, TC_TMOT, R_FAIL, NULL },
+ /* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
+ { 4, TURL, "test.com:123:::1,::2", CURL_IPRESOLVE_WHATEVER,
+ CNCT_TMOT, 150, 200, 200, 0, 2, 400, TC_TMOT, R_FAIL, NULL },
+ /* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT */
+
+ { 5, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_WHATEVER,
+ CNCT_TMOT, 150, 200, 200, 1, 1, 350, TC_TMOT, R_FAIL, "v6" },
+ /* mixed ip4+6, v6 always first, v4 kicks in on HE, fails after ~350ms */
+ { 6, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_WHATEVER,
+ CNCT_TMOT, 150, 200, 200, 1, 1, 350, TC_TMOT, R_FAIL, "v6" },
+ /* mixed ip6+4, v6 starts, v4 never starts due to high HE, TIMEOUT */
+ { 7, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_V4,
+ CNCT_TMOT, 150, 500, 500, 1, 0, 400, TC_TMOT, R_FAIL, NULL },
+ /* mixed ip4+6, but only use v4, check it uses full connect timeout,
+ although another address of the 'wrong' family is available */
+ { 8, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_V6,
+ CNCT_TMOT, 150, 500, 500, 0, 1, 400, TC_TMOT, R_FAIL, NULL },
+ /* mixed ip4+6, but only use v6, check it uses full connect timeout,
+ although another address of the 'wrong' family is available */
#endif
-};
-
-UNITTEST_START
+ };
size_t i;
for(i = 0; i < CURL_ARRAYSIZE(TEST_CASES); ++i) {
- test_connect(&TEST_CASES[i]);
+ test_connect(easy, &TEST_CASES[i]);
}
-UNITTEST_STOP
+ UNITTEST_END(t2600_stop(easy))
+}
#include "bufq.h"
#include "curl_trc.h"
-static CURLcode unit_setup(void)
-{
- CURLcode res = CURLE_OK;
- return res;
-}
-
-static void unit_stop(void)
-{
-}
-
static const char *tail_err(struct bufq *q)
{
struct buf_chunk *chunk;
curl_mfprintf(stderr, "- spares: %zu\n", n);
}
-static unsigned char test_data[32*1024];
-
static void check_bufq(size_t pool_spares,
size_t chunk_size, size_t max_chunks,
size_t wsize, size_t rsize, int opts)
{
+ static unsigned char test_data[32*1024];
+
struct bufq q;
struct bufc_pool pool;
size_t max_len = chunk_size * max_chunks;
Curl_bufcp_free(&pool);
}
-UNITTEST_START
+static CURLcode test_unit2601(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+
struct bufq q;
ssize_t n;
CURLcode result;
check_bufq(8, 8000, 10, 1234, 1234, BUFQ_OPT_NONE);
check_bufq(8, 1024, 4, 129, 127, BUFQ_OPT_NO_SPARES);
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "dynhds.h"
#include "curl_trc.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit2602(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
struct dynhds hds;
struct dynbuf dbuf;
Curl_dynhds_free(&hds);
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "http1.h"
#include "curl_trc.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
#ifndef CURL_DISABLE_HTTP
-struct tcase {
- const char **input;
- const char *default_scheme;
- const char *method;
- const char *scheme;
- const char *authority;
- const char *path;
- size_t header_count;
- size_t input_remain;
-};
-
static void check_eq(const char *s, const char *exp_s, const char *name)
{
if(s && exp_s) {
}
}
-static void parse_success(struct tcase *t)
+struct tcase {
+ const char **input;
+ const char *default_scheme;
+ const char *method;
+ const char *scheme;
+ const char *authority;
+ const char *path;
+ size_t header_count;
+ size_t input_remain;
+};
+
+static void parse_success(const struct tcase *t)
{
struct h1_req_parser p;
const char *buf;
Curl_h1_req_parse_free(&p);
}
-
-static const char *T1_INPUT[] = {
- "GET /path HTTP/1.1\r\nHost: test.curl.se\r\n\r\n",
- NULL,
-};
-static struct tcase TEST1a = {
- T1_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 0
-};
-static struct tcase TEST1b = {
- T1_INPUT, "https", "GET", "https", NULL, "/path", 1, 0
-};
-
-static const char *T2_INPUT[] = {
- "GET /path HTT",
- "P/1.1\r\nHost: te",
- "st.curl.se\r\n\r",
- "\n12345678",
- NULL,
-};
-static struct tcase TEST2 = {
- T2_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 8
-};
-
-static const char *T3_INPUT[] = {
- "GET ftp://ftp.curl.se/xxx?a=2 HTTP/1.1\r\nContent-Length: 0\r",
- "\nUser-Agent: xxx\r\n\r\n",
- NULL,
-};
-static struct tcase TEST3a = {
- T3_INPUT, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0
-};
-
-static const char *T4_INPUT[] = {
- "CONNECT ftp.curl.se:123 HTTP/1.1\r\nContent-Length: 0\r\n",
- "User-Agent: xxx\r\n",
- "nothing: \r\n\r\n\n\n",
- NULL,
-};
-static struct tcase TEST4a = {
- T4_INPUT, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2
-};
-
-static const char *T5_INPUT[] = {
- "OPTIONS * HTTP/1.1\r\nContent-Length: 0\r\nBlabla: xxx.yyy\r",
- "\n\tzzzzzz\r\n\r\n",
- "123",
- NULL,
-};
-static struct tcase TEST5a = {
- T5_INPUT, NULL, "OPTIONS", NULL, NULL, "*", 2, 3
-};
-
-static const char *T6_INPUT[] = {
- "PUT /path HTTP/1.1\nHost: test.curl.se\n\n123",
- NULL,
-};
-static struct tcase TEST6a = {
- T6_INPUT, NULL, "PUT", NULL, NULL, "/path", 1, 3
-};
#endif
-UNITTEST_START
+static CURLcode test_unit2603(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
#ifndef CURL_DISABLE_HTTP
+ static const char *T1_INPUT[] = {
+ "GET /path HTTP/1.1\r\nHost: test.curl.se\r\n\r\n",
+ NULL,
+ };
+ static const struct tcase TEST1a = {
+ T1_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 0
+ };
+ static const struct tcase TEST1b = {
+ T1_INPUT, "https", "GET", "https", NULL, "/path", 1, 0
+ };
+
+ static const char *T2_INPUT[] = {
+ "GET /path HTT",
+ "P/1.1\r\nHost: te",
+ "st.curl.se\r\n\r",
+ "\n12345678",
+ NULL,
+ };
+ static const struct tcase TEST2 = {
+ T2_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 8
+ };
+
+ static const char *T3_INPUT[] = {
+ "GET ftp://ftp.curl.se/xxx?a=2 HTTP/1.1\r\nContent-Length: 0\r",
+ "\nUser-Agent: xxx\r\n\r\n",
+ NULL,
+ };
+ static const struct tcase TEST3a = {
+ T3_INPUT, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0
+ };
+
+ static const char *T4_INPUT[] = {
+ "CONNECT ftp.curl.se:123 HTTP/1.1\r\nContent-Length: 0\r\n",
+ "User-Agent: xxx\r\n",
+ "nothing: \r\n\r\n\n\n",
+ NULL,
+ };
+ static const struct tcase TEST4a = {
+ T4_INPUT, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2
+ };
+
+ static const char *T5_INPUT[] = {
+ "OPTIONS * HTTP/1.1\r\nContent-Length: 0\r\nBlabla: xxx.yyy\r",
+ "\n\tzzzzzz\r\n\r\n",
+ "123",
+ NULL,
+ };
+ static const struct tcase TEST5a = {
+ T5_INPUT, NULL, "OPTIONS", NULL, NULL, "*", 2, 3
+ };
+
+ static const char *T6_INPUT[] = {
+ "PUT /path HTTP/1.1\nHost: test.curl.se\n\n123",
+ NULL,
+ };
+ static const struct tcase TEST6a = {
+ T6_INPUT, NULL, "PUT", NULL, NULL, "/path", 1, 3
+ };
+
parse_success(&TEST1a);
parse_success(&TEST1b);
parse_success(&TEST2);
parse_success(&TEST6a);
#endif
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "vssh/curl_path.h"
#include "memdebug.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit2604(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+ UNITTEST_BEGIN_SIMPLE
+#ifdef USE_SSH
-struct set {
- const char *cp;
- const char *expect; /* the returned content */
- const char *next; /* what cp points to after the call */
- const char *home;
- CURLcode result;
-};
+ struct set {
+ const char *cp;
+ const char *expect; /* the returned content */
+ const char *next; /* what cp points to after the call */
+ const char *home;
+ CURLcode result;
+ };
-UNITTEST_START
-#ifdef USE_SSH
-{
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverlength-strings"
};
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic warning "-Woverlength-strings"
+#pragma GCC diagnostic pop
#endif
list[0].cp = calloc(1, too_long + 1);
}
free(CURL_UNCONST(list[0].cp));
-}
-#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
#endif
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#include "curl_get_line.h"
#include "memdebug.h"
+static CURLcode test_unit3200(char *arg)
+{
+ UNITTEST_BEGIN_SIMPLE
+
#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
!defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
-/* The test XML does not supply a way to write files without newlines
- * so we write our own
- */
+#if defined(CURL_GNUC_DIAG) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverlength-strings"
+#endif
+
+ /* The test XML does not supply a way to write files without newlines
+ * so we write our own
+ */
#define C64 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
#define C256 C64 C64 C64 C64
#define C1024 C256 C256 C256 C256
#define C4096 C1024 C1024 C1024 C1024
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
+ static const char *filecontents[] = {
+ /* Both should be read */
+ "LINE1\n"
+ "LINE2 NEWLINE\n",
-static void unit_stop(void)
-{
-}
+ /* Both should be read */
+ "LINE1\n"
+ "LINE2 NONEWLINE",
-#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Woverlength-strings"
-#endif
-
-#define NUMTESTS 6
-static const char *filecontents[] = {
- /* Both should be read */
- "LINE1\n"
- "LINE2 NEWLINE\n",
-
- /* Both should be read */
- "LINE1\n"
- "LINE2 NONEWLINE",
-
- /* Only first should be read */
- "LINE1\n"
- C4096,
+ /* Only first should be read */
+ "LINE1\n"
+ C4096,
- /* First line should be read */
- "LINE1\n"
- C4096 "SOME EXTRA TEXT",
+ /* First line should be read */
+ "LINE1\n"
+ C4096 "SOME EXTRA TEXT",
- /* Only first should be read */
- "LINE1\n"
- C4096 "SOME EXTRA TEXT\n"
- "LINE3\n",
+ /* Only first should be read */
+ "LINE1\n"
+ C4096 "SOME EXTRA TEXT\n"
+ "LINE3\n",
- "LINE1\x1aTEST"
-};
+ "LINE1\x1aTEST"
+ };
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic warning "-Woverlength-strings"
+#pragma GCC diagnostic pop
#endif
-
-UNITTEST_START
size_t i;
int rc = 0;
- for(i = 0; i < NUMTESTS; i++) {
+ for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
FILE *fp;
struct dynbuf buf;
size_t len = 4096;
curl_mfprintf(stderr, "OK\n");
}
return (CURLcode)rc;
-UNITTEST_STOP
-#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic pop
#endif
-#else
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-static void unit_stop(void)
-{
+ UNITTEST_END_SIMPLE
}
-UNITTEST_START
-UNITTEST_STOP
-
-#endif
#include "vtls/cipher_suite.h"
-static CURLcode unit_setup(void)
+static CURLcode test_unit3205(char *arg)
{
- return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+ UNITTEST_BEGIN_SIMPLE
#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
-struct test_cs_entry {
- uint16_t id;
- const char *rfc;
- const char *openssl;
-};
-static const struct test_cs_entry test_cs_list[] = {
-#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
- { 0x1301, "TLS_AES_128_GCM_SHA256",
- NULL },
- { 0x1302, "TLS_AES_256_GCM_SHA384",
- NULL },
- { 0x1303, "TLS_CHACHA20_POLY1305_SHA256",
- NULL },
- { 0x1304, "TLS_AES_128_CCM_SHA256",
- NULL },
- { 0x1305, "TLS_AES_128_CCM_8_SHA256",
- NULL },
-#endif
- { 0xC02B, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
- "ECDHE-ECDSA-AES128-GCM-SHA256" },
- { 0xC02C, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
- "ECDHE-ECDSA-AES256-GCM-SHA384" },
- { 0xC02F, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
- "ECDHE-RSA-AES128-GCM-SHA256" },
- { 0xC030, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
- "ECDHE-RSA-AES256-GCM-SHA384" },
- { 0xCCA8, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
- "ECDHE-RSA-CHACHA20-POLY1305" },
- { 0xCCA9, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
- "ECDHE-ECDSA-CHACHA20-POLY1305" },
-#if defined(USE_MBEDTLS)
- { 0x002F, "TLS_RSA_WITH_AES_128_CBC_SHA",
- "AES128-SHA" },
- { 0x0035, "TLS_RSA_WITH_AES_256_CBC_SHA",
- "AES256-SHA" },
- { 0x003C, "TLS_RSA_WITH_AES_128_CBC_SHA256",
- "AES128-SHA256" },
- { 0x003D, "TLS_RSA_WITH_AES_256_CBC_SHA256",
- "AES256-SHA256" },
- { 0x009C, "TLS_RSA_WITH_AES_128_GCM_SHA256",
- "AES128-GCM-SHA256" },
- { 0x009D, "TLS_RSA_WITH_AES_256_GCM_SHA384",
- "AES256-GCM-SHA384" },
- { 0xC004, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
- "ECDH-ECDSA-AES128-SHA" },
- { 0xC005, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
- "ECDH-ECDSA-AES256-SHA" },
- { 0xC009, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
- "ECDHE-ECDSA-AES128-SHA" },
- { 0xC00A, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
- "ECDHE-ECDSA-AES256-SHA" },
- { 0xC00E, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
- "ECDH-RSA-AES128-SHA" },
- { 0xC00F, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
- "ECDH-RSA-AES256-SHA" },
- { 0xC013, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
- "ECDHE-RSA-AES128-SHA" },
- { 0xC014, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
- "ECDHE-RSA-AES256-SHA" },
- { 0xC023, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
- "ECDHE-ECDSA-AES128-SHA256" },
- { 0xC024, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
- "ECDHE-ECDSA-AES256-SHA384" },
- { 0xC025, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
- "ECDH-ECDSA-AES128-SHA256" },
- { 0xC026, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
- "ECDH-ECDSA-AES256-SHA384" },
- { 0xC027, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
- "ECDHE-RSA-AES128-SHA256" },
- { 0xC028, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
- "ECDHE-RSA-AES256-SHA384" },
- { 0xC029, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
- "ECDH-RSA-AES128-SHA256" },
- { 0xC02A, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
- "ECDH-RSA-AES256-SHA384" },
- { 0xC02D, "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
- "ECDH-ECDSA-AES128-GCM-SHA256" },
- { 0xC02E, "TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
- "ECDH-ECDSA-AES256-GCM-SHA384" },
- { 0xC031, "TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
- "ECDH-RSA-AES128-GCM-SHA256" },
- { 0xC032, "TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
- "ECDH-RSA-AES256-GCM-SHA384" },
-#endif
-#if defined(USE_MBEDTLS)
- { 0x0001, "TLS_RSA_WITH_NULL_MD5",
- "NULL-MD5" },
- { 0x0002, "TLS_RSA_WITH_NULL_SHA",
- "NULL-SHA" },
- { 0x002C, "TLS_PSK_WITH_NULL_SHA",
- "PSK-NULL-SHA" },
- { 0x002D, "TLS_DHE_PSK_WITH_NULL_SHA",
- "DHE-PSK-NULL-SHA" },
- { 0x002E, "TLS_RSA_PSK_WITH_NULL_SHA",
- "RSA-PSK-NULL-SHA" },
- { 0x0033, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
- "DHE-RSA-AES128-SHA" },
- { 0x0039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
- "DHE-RSA-AES256-SHA" },
- { 0x003B, "TLS_RSA_WITH_NULL_SHA256",
- "NULL-SHA256" },
- { 0x0067, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
- "DHE-RSA-AES128-SHA256" },
- { 0x006B, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
- "DHE-RSA-AES256-SHA256" },
- { 0x008C, "TLS_PSK_WITH_AES_128_CBC_SHA",
- "PSK-AES128-CBC-SHA" },
- { 0x008D, "TLS_PSK_WITH_AES_256_CBC_SHA",
- "PSK-AES256-CBC-SHA" },
- { 0x0090, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA",
- "DHE-PSK-AES128-CBC-SHA" },
- { 0x0091, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA",
- "DHE-PSK-AES256-CBC-SHA" },
- { 0x0094, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA",
- "RSA-PSK-AES128-CBC-SHA" },
- { 0x0095, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA",
- "RSA-PSK-AES256-CBC-SHA" },
- { 0x009E, "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
- "DHE-RSA-AES128-GCM-SHA256" },
- { 0x009F, "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
- "DHE-RSA-AES256-GCM-SHA384" },
- { 0x00A8, "TLS_PSK_WITH_AES_128_GCM_SHA256",
- "PSK-AES128-GCM-SHA256" },
- { 0x00A9, "TLS_PSK_WITH_AES_256_GCM_SHA384",
- "PSK-AES256-GCM-SHA384" },
- { 0x00AA, "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256",
- "DHE-PSK-AES128-GCM-SHA256" },
- { 0x00AB, "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384",
- "DHE-PSK-AES256-GCM-SHA384" },
- { 0x00AC, "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256",
- "RSA-PSK-AES128-GCM-SHA256" },
- { 0x00AD, "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384",
- "RSA-PSK-AES256-GCM-SHA384" },
- { 0x00AE, "TLS_PSK_WITH_AES_128_CBC_SHA256",
- "PSK-AES128-CBC-SHA256" },
- { 0x00AF, "TLS_PSK_WITH_AES_256_CBC_SHA384",
- "PSK-AES256-CBC-SHA384" },
- { 0x00B0, "TLS_PSK_WITH_NULL_SHA256",
- "PSK-NULL-SHA256" },
- { 0x00B1, "TLS_PSK_WITH_NULL_SHA384",
- "PSK-NULL-SHA384" },
- { 0x00B2, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256",
- "DHE-PSK-AES128-CBC-SHA256" },
- { 0x00B3, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384",
- "DHE-PSK-AES256-CBC-SHA384" },
- { 0x00B4, "TLS_DHE_PSK_WITH_NULL_SHA256",
- "DHE-PSK-NULL-SHA256" },
- { 0x00B5, "TLS_DHE_PSK_WITH_NULL_SHA384",
- "DHE-PSK-NULL-SHA384" },
- { 0x00B6, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256",
- "RSA-PSK-AES128-CBC-SHA256" },
- { 0x00B7, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384",
- "RSA-PSK-AES256-CBC-SHA384" },
- { 0x00B8, "TLS_RSA_PSK_WITH_NULL_SHA256",
- "RSA-PSK-NULL-SHA256" },
- { 0x00B9, "TLS_RSA_PSK_WITH_NULL_SHA384",
- "RSA-PSK-NULL-SHA384" },
- { 0xC001, "TLS_ECDH_ECDSA_WITH_NULL_SHA",
- "ECDH-ECDSA-NULL-SHA" },
- { 0xC006, "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
- "ECDHE-ECDSA-NULL-SHA" },
- { 0xC00B, "TLS_ECDH_RSA_WITH_NULL_SHA",
- "ECDH-RSA-NULL-SHA" },
- { 0xC010, "TLS_ECDHE_RSA_WITH_NULL_SHA",
- "ECDHE-RSA-NULL-SHA" },
- { 0xC035, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA",
- "ECDHE-PSK-AES128-CBC-SHA" },
- { 0xC036, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA",
- "ECDHE-PSK-AES256-CBC-SHA" },
- { 0xCCAB, "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256",
- "PSK-CHACHA20-POLY1305" },
-#endif
-#if defined(USE_MBEDTLS)
- { 0xC09C, "TLS_RSA_WITH_AES_128_CCM",
- "AES128-CCM" },
- { 0xC09D, "TLS_RSA_WITH_AES_256_CCM",
- "AES256-CCM" },
- { 0xC0A0, "TLS_RSA_WITH_AES_128_CCM_8",
- "AES128-CCM8" },
- { 0xC0A1, "TLS_RSA_WITH_AES_256_CCM_8",
- "AES256-CCM8" },
- { 0xC0AC, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM",
- "ECDHE-ECDSA-AES128-CCM" },
- { 0xC0AD, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM",
- "ECDHE-ECDSA-AES256-CCM" },
- { 0xC0AE, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8",
- "ECDHE-ECDSA-AES128-CCM8" },
- { 0xC0AF, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8",
- "ECDHE-ECDSA-AES256-CCM8" },
-#endif
+ struct test_cs_entry {
+ uint16_t id;
+ const char *rfc;
+ const char *openssl;
+ };
+
+ static const struct test_cs_entry test_cs_list[] = {
+ { 0x1301, "TLS_AES_128_GCM_SHA256",
+ NULL },
+ { 0x1302, "TLS_AES_256_GCM_SHA384",
+ NULL },
+ { 0x1303, "TLS_CHACHA20_POLY1305_SHA256",
+ NULL },
+ { 0x1304, "TLS_AES_128_CCM_SHA256",
+ NULL },
+ { 0x1305, "TLS_AES_128_CCM_8_SHA256",
+ NULL },
+ { 0xC02B, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
+ "ECDHE-ECDSA-AES128-GCM-SHA256" },
+ { 0xC02C, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
+ "ECDHE-ECDSA-AES256-GCM-SHA384" },
+ { 0xC02F, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
+ "ECDHE-RSA-AES128-GCM-SHA256" },
+ { 0xC030, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
+ "ECDHE-RSA-AES256-GCM-SHA384" },
+ { 0xCCA8, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
+ "ECDHE-RSA-CHACHA20-POLY1305" },
+ { 0xCCA9, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
+ "ECDHE-ECDSA-CHACHA20-POLY1305" },
#if defined(USE_MBEDTLS)
- /* entries marked ns are non-"standard", they are not in OpenSSL */
- { 0x0041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA",
- "CAMELLIA128-SHA" },
- { 0x0045, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA",
- "DHE-RSA-CAMELLIA128-SHA" },
- { 0x0084, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA",
- "CAMELLIA256-SHA" },
- { 0x0088, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA",
- "DHE-RSA-CAMELLIA256-SHA" },
- { 0x00BA, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256",
- "CAMELLIA128-SHA256" },
- { 0x00BE, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
- "DHE-RSA-CAMELLIA128-SHA256" },
- { 0x00C0, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256",
- "CAMELLIA256-SHA256" },
- { 0x00C4, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256",
- "DHE-RSA-CAMELLIA256-SHA256" },
- { 0xC037, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256",
- "ECDHE-PSK-AES128-CBC-SHA256" },
- { 0xC038, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384",
- "ECDHE-PSK-AES256-CBC-SHA384" },
- { 0xC039, "TLS_ECDHE_PSK_WITH_NULL_SHA",
- "ECDHE-PSK-NULL-SHA" },
- { 0xC03A, "TLS_ECDHE_PSK_WITH_NULL_SHA256",
- "ECDHE-PSK-NULL-SHA256" },
- { 0xC03B, "TLS_ECDHE_PSK_WITH_NULL_SHA384",
- "ECDHE-PSK-NULL-SHA384" },
- { 0xC03C, "TLS_RSA_WITH_ARIA_128_CBC_SHA256",
- "ARIA128-SHA256" /* ns */ },
- { 0xC03D, "TLS_RSA_WITH_ARIA_256_CBC_SHA384",
- "ARIA256-SHA384" /* ns */ },
- { 0xC044, "TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256",
- "DHE-RSA-ARIA128-SHA256" /* ns */ },
- { 0xC045, "TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384",
- "DHE-RSA-ARIA256-SHA384" /* ns */ },
- { 0xC048, "TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256",
- "ECDHE-ECDSA-ARIA128-SHA256" /* ns */ },
- { 0xC049, "TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384",
- "ECDHE-ECDSA-ARIA256-SHA384" /* ns */ },
- { 0xC04A, "TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256",
- "ECDH-ECDSA-ARIA128-SHA256" /* ns */ },
- { 0xC04B, "TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384",
- "ECDH-ECDSA-ARIA256-SHA384" /* ns */ },
- { 0xC04C, "TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256",
- "ECDHE-ARIA128-SHA256" /* ns */ },
- { 0xC04D, "TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384",
- "ECDHE-ARIA256-SHA384" /* ns */ },
- { 0xC04E, "TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256",
- "ECDH-ARIA128-SHA256" /* ns */ },
- { 0xC04F, "TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384",
- "ECDH-ARIA256-SHA384" /* ns */ },
- { 0xC050, "TLS_RSA_WITH_ARIA_128_GCM_SHA256",
- "ARIA128-GCM-SHA256" },
- { 0xC051, "TLS_RSA_WITH_ARIA_256_GCM_SHA384",
- "ARIA256-GCM-SHA384" },
- { 0xC052, "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256",
- "DHE-RSA-ARIA128-GCM-SHA256" },
- { 0xC053, "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384",
- "DHE-RSA-ARIA256-GCM-SHA384" },
- { 0xC05C, "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256",
- "ECDHE-ECDSA-ARIA128-GCM-SHA256" },
- { 0xC05D, "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384",
- "ECDHE-ECDSA-ARIA256-GCM-SHA384" },
- { 0xC05E, "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256",
- "ECDH-ECDSA-ARIA128-GCM-SHA256" /* ns */ },
- { 0xC05F, "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384",
- "ECDH-ECDSA-ARIA256-GCM-SHA384" /* ns */ },
- { 0xC060, "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256",
- "ECDHE-ARIA128-GCM-SHA256" },
- { 0xC061, "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384",
- "ECDHE-ARIA256-GCM-SHA384" },
- { 0xC062, "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256",
- "ECDH-ARIA128-GCM-SHA256" /* ns */ },
- { 0xC063, "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384",
- "ECDH-ARIA256-GCM-SHA384" /* ns */ },
- { 0xC064, "TLS_PSK_WITH_ARIA_128_CBC_SHA256",
- "PSK-ARIA128-SHA256" /* ns */ },
- { 0xC065, "TLS_PSK_WITH_ARIA_256_CBC_SHA384",
- "PSK-ARIA256-SHA384" /* ns */ },
- { 0xC066, "TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256",
- "DHE-PSK-ARIA128-SHA256" /* ns */ },
- { 0xC067, "TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384",
- "DHE-PSK-ARIA256-SHA384" /* ns */ },
- { 0xC068, "TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256",
- "RSA-PSK-ARIA128-SHA256" /* ns */ },
- { 0xC069, "TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384",
- "RSA-PSK-ARIA256-SHA384" /* ns */ },
- { 0xC06A, "TLS_PSK_WITH_ARIA_128_GCM_SHA256",
- "PSK-ARIA128-GCM-SHA256" },
- { 0xC06B, "TLS_PSK_WITH_ARIA_256_GCM_SHA384",
- "PSK-ARIA256-GCM-SHA384" },
- { 0xC06C, "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256",
- "DHE-PSK-ARIA128-GCM-SHA256" },
- { 0xC06D, "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384",
- "DHE-PSK-ARIA256-GCM-SHA384" },
- { 0xC06E, "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256",
- "RSA-PSK-ARIA128-GCM-SHA256" },
- { 0xC06F, "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384",
- "RSA-PSK-ARIA256-GCM-SHA384" },
- { 0xC070, "TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256",
- "ECDHE-PSK-ARIA128-SHA256" /* ns */ },
- { 0xC071, "TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384",
- "ECDHE-PSK-ARIA256-SHA384" /* ns */ },
- { 0xC072, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
- "ECDHE-ECDSA-CAMELLIA128-SHA256" },
- { 0xC073, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
- "ECDHE-ECDSA-CAMELLIA256-SHA384" },
- { 0xC074, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
- "ECDH-ECDSA-CAMELLIA128-SHA256" /* ns */ },
- { 0xC075, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
- "ECDH-ECDSA-CAMELLIA256-SHA384" /* ns */ },
- { 0xC076, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
- "ECDHE-RSA-CAMELLIA128-SHA256" },
- { 0xC077, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384",
- "ECDHE-RSA-CAMELLIA256-SHA384" },
- { 0xC078, "TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256",
- "ECDH-CAMELLIA128-SHA256" /* ns */ },
- { 0xC079, "TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384",
- "ECDH-CAMELLIA256-SHA384" /* ns */ },
- { 0xC07A, "TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256",
- "CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC07B, "TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384",
- "CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC07C, "TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
- "DHE-RSA-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC07D, "TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
- "DHE-RSA-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC086, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
- "ECDHE-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC087, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
- "ECDHE-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC088, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
- "ECDH-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC089, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
- "ECDH-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC08A, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
- "ECDHE-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC08B, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
- "ECDHE-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC08C, "TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256",
- "ECDH-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC08D, "TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384",
- "ECDH-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC08E, "TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256",
- "PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC08F, "TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384",
- "PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC090, "TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256",
- "DHE-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC091, "TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384",
- "DHE-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC092, "TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256",
- "RSA-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
- { 0xC093, "TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384",
- "RSA-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
- { 0xC094, "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256",
- "PSK-CAMELLIA128-SHA256" },
- { 0xC095, "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384",
- "PSK-CAMELLIA256-SHA384" },
- { 0xC096, "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
- "DHE-PSK-CAMELLIA128-SHA256" },
- { 0xC097, "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
- "DHE-PSK-CAMELLIA256-SHA384" },
- { 0xC098, "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256",
- "RSA-PSK-CAMELLIA128-SHA256" },
- { 0xC099, "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384",
- "RSA-PSK-CAMELLIA256-SHA384" },
- { 0xC09A, "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
- "ECDHE-PSK-CAMELLIA128-SHA256" },
- { 0xC09B, "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
- "ECDHE-PSK-CAMELLIA256-SHA384" },
- { 0xC09E, "TLS_DHE_RSA_WITH_AES_128_CCM",
- "DHE-RSA-AES128-CCM" },
- { 0xC09F, "TLS_DHE_RSA_WITH_AES_256_CCM",
- "DHE-RSA-AES256-CCM" },
- { 0xC0A2, "TLS_DHE_RSA_WITH_AES_128_CCM_8",
- "DHE-RSA-AES128-CCM8" },
- { 0xC0A3, "TLS_DHE_RSA_WITH_AES_256_CCM_8",
- "DHE-RSA-AES256-CCM8" },
- { 0xC0A4, "TLS_PSK_WITH_AES_128_CCM",
- "PSK-AES128-CCM" },
- { 0xC0A5, "TLS_PSK_WITH_AES_256_CCM",
- "PSK-AES256-CCM" },
- { 0xC0A6, "TLS_DHE_PSK_WITH_AES_128_CCM",
- "DHE-PSK-AES128-CCM" },
- { 0xC0A7, "TLS_DHE_PSK_WITH_AES_256_CCM",
- "DHE-PSK-AES256-CCM" },
- { 0xC0A8, "TLS_PSK_WITH_AES_128_CCM_8",
- "PSK-AES128-CCM8" },
- { 0xC0A9, "TLS_PSK_WITH_AES_256_CCM_8",
- "PSK-AES256-CCM8" },
- { 0xC0AA, "TLS_PSK_DHE_WITH_AES_128_CCM_8",
- "DHE-PSK-AES128-CCM8" },
- { 0xC0AB, "TLS_PSK_DHE_WITH_AES_256_CCM_8",
- "DHE-PSK-AES256-CCM8" },
- { 0xCCAA, "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
- "DHE-RSA-CHACHA20-POLY1305" },
- { 0xCCAC, "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
- "ECDHE-PSK-CHACHA20-POLY1305" },
- { 0xCCAD, "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
- "DHE-PSK-CHACHA20-POLY1305" },
- { 0xCCAE, "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256",
- "RSA-PSK-CHACHA20-POLY1305" },
+ { 0x002F, "TLS_RSA_WITH_AES_128_CBC_SHA",
+ "AES128-SHA" },
+ { 0x0035, "TLS_RSA_WITH_AES_256_CBC_SHA",
+ "AES256-SHA" },
+ { 0x003C, "TLS_RSA_WITH_AES_128_CBC_SHA256",
+ "AES128-SHA256" },
+ { 0x003D, "TLS_RSA_WITH_AES_256_CBC_SHA256",
+ "AES256-SHA256" },
+ { 0x009C, "TLS_RSA_WITH_AES_128_GCM_SHA256",
+ "AES128-GCM-SHA256" },
+ { 0x009D, "TLS_RSA_WITH_AES_256_GCM_SHA384",
+ "AES256-GCM-SHA384" },
+ { 0xC004, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
+ "ECDH-ECDSA-AES128-SHA" },
+ { 0xC005, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
+ "ECDH-ECDSA-AES256-SHA" },
+ { 0xC009, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
+ "ECDHE-ECDSA-AES128-SHA" },
+ { 0xC00A, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
+ "ECDHE-ECDSA-AES256-SHA" },
+ { 0xC00E, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
+ "ECDH-RSA-AES128-SHA" },
+ { 0xC00F, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
+ "ECDH-RSA-AES256-SHA" },
+ { 0xC013, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
+ "ECDHE-RSA-AES128-SHA" },
+ { 0xC014, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
+ "ECDHE-RSA-AES256-SHA" },
+ { 0xC023, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
+ "ECDHE-ECDSA-AES128-SHA256" },
+ { 0xC024, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
+ "ECDHE-ECDSA-AES256-SHA384" },
+ { 0xC025, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
+ "ECDH-ECDSA-AES128-SHA256" },
+ { 0xC026, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
+ "ECDH-ECDSA-AES256-SHA384" },
+ { 0xC027, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
+ "ECDHE-RSA-AES128-SHA256" },
+ { 0xC028, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
+ "ECDHE-RSA-AES256-SHA384" },
+ { 0xC029, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
+ "ECDH-RSA-AES128-SHA256" },
+ { 0xC02A, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
+ "ECDH-RSA-AES256-SHA384" },
+ { 0xC02D, "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
+ "ECDH-ECDSA-AES128-GCM-SHA256" },
+ { 0xC02E, "TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
+ "ECDH-ECDSA-AES256-GCM-SHA384" },
+ { 0xC031, "TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
+ "ECDH-RSA-AES128-GCM-SHA256" },
+ { 0xC032, "TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
+ "ECDH-RSA-AES256-GCM-SHA384" },
+ { 0x0001, "TLS_RSA_WITH_NULL_MD5",
+ "NULL-MD5" },
+ { 0x0002, "TLS_RSA_WITH_NULL_SHA",
+ "NULL-SHA" },
+ { 0x002C, "TLS_PSK_WITH_NULL_SHA",
+ "PSK-NULL-SHA" },
+ { 0x002D, "TLS_DHE_PSK_WITH_NULL_SHA",
+ "DHE-PSK-NULL-SHA" },
+ { 0x002E, "TLS_RSA_PSK_WITH_NULL_SHA",
+ "RSA-PSK-NULL-SHA" },
+ { 0x0033, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
+ "DHE-RSA-AES128-SHA" },
+ { 0x0039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
+ "DHE-RSA-AES256-SHA" },
+ { 0x003B, "TLS_RSA_WITH_NULL_SHA256",
+ "NULL-SHA256" },
+ { 0x0067, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
+ "DHE-RSA-AES128-SHA256" },
+ { 0x006B, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
+ "DHE-RSA-AES256-SHA256" },
+ { 0x008C, "TLS_PSK_WITH_AES_128_CBC_SHA",
+ "PSK-AES128-CBC-SHA" },
+ { 0x008D, "TLS_PSK_WITH_AES_256_CBC_SHA",
+ "PSK-AES256-CBC-SHA" },
+ { 0x0090, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA",
+ "DHE-PSK-AES128-CBC-SHA" },
+ { 0x0091, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA",
+ "DHE-PSK-AES256-CBC-SHA" },
+ { 0x0094, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA",
+ "RSA-PSK-AES128-CBC-SHA" },
+ { 0x0095, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA",
+ "RSA-PSK-AES256-CBC-SHA" },
+ { 0x009E, "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
+ "DHE-RSA-AES128-GCM-SHA256" },
+ { 0x009F, "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
+ "DHE-RSA-AES256-GCM-SHA384" },
+ { 0x00A8, "TLS_PSK_WITH_AES_128_GCM_SHA256",
+ "PSK-AES128-GCM-SHA256" },
+ { 0x00A9, "TLS_PSK_WITH_AES_256_GCM_SHA384",
+ "PSK-AES256-GCM-SHA384" },
+ { 0x00AA, "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256",
+ "DHE-PSK-AES128-GCM-SHA256" },
+ { 0x00AB, "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384",
+ "DHE-PSK-AES256-GCM-SHA384" },
+ { 0x00AC, "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256",
+ "RSA-PSK-AES128-GCM-SHA256" },
+ { 0x00AD, "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384",
+ "RSA-PSK-AES256-GCM-SHA384" },
+ { 0x00AE, "TLS_PSK_WITH_AES_128_CBC_SHA256",
+ "PSK-AES128-CBC-SHA256" },
+ { 0x00AF, "TLS_PSK_WITH_AES_256_CBC_SHA384",
+ "PSK-AES256-CBC-SHA384" },
+ { 0x00B0, "TLS_PSK_WITH_NULL_SHA256",
+ "PSK-NULL-SHA256" },
+ { 0x00B1, "TLS_PSK_WITH_NULL_SHA384",
+ "PSK-NULL-SHA384" },
+ { 0x00B2, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256",
+ "DHE-PSK-AES128-CBC-SHA256" },
+ { 0x00B3, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384",
+ "DHE-PSK-AES256-CBC-SHA384" },
+ { 0x00B4, "TLS_DHE_PSK_WITH_NULL_SHA256",
+ "DHE-PSK-NULL-SHA256" },
+ { 0x00B5, "TLS_DHE_PSK_WITH_NULL_SHA384",
+ "DHE-PSK-NULL-SHA384" },
+ { 0x00B6, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256",
+ "RSA-PSK-AES128-CBC-SHA256" },
+ { 0x00B7, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384",
+ "RSA-PSK-AES256-CBC-SHA384" },
+ { 0x00B8, "TLS_RSA_PSK_WITH_NULL_SHA256",
+ "RSA-PSK-NULL-SHA256" },
+ { 0x00B9, "TLS_RSA_PSK_WITH_NULL_SHA384",
+ "RSA-PSK-NULL-SHA384" },
+ { 0xC001, "TLS_ECDH_ECDSA_WITH_NULL_SHA",
+ "ECDH-ECDSA-NULL-SHA" },
+ { 0xC006, "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
+ "ECDHE-ECDSA-NULL-SHA" },
+ { 0xC00B, "TLS_ECDH_RSA_WITH_NULL_SHA",
+ "ECDH-RSA-NULL-SHA" },
+ { 0xC010, "TLS_ECDHE_RSA_WITH_NULL_SHA",
+ "ECDHE-RSA-NULL-SHA" },
+ { 0xC035, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA",
+ "ECDHE-PSK-AES128-CBC-SHA" },
+ { 0xC036, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA",
+ "ECDHE-PSK-AES256-CBC-SHA" },
+ { 0xCCAB, "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256",
+ "PSK-CHACHA20-POLY1305" },
+ { 0xC09C, "TLS_RSA_WITH_AES_128_CCM",
+ "AES128-CCM" },
+ { 0xC09D, "TLS_RSA_WITH_AES_256_CCM",
+ "AES256-CCM" },
+ { 0xC0A0, "TLS_RSA_WITH_AES_128_CCM_8",
+ "AES128-CCM8" },
+ { 0xC0A1, "TLS_RSA_WITH_AES_256_CCM_8",
+ "AES256-CCM8" },
+ { 0xC0AC, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM",
+ "ECDHE-ECDSA-AES128-CCM" },
+ { 0xC0AD, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM",
+ "ECDHE-ECDSA-AES256-CCM" },
+ { 0xC0AE, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8",
+ "ECDHE-ECDSA-AES128-CCM8" },
+ { 0xC0AF, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8",
+ "ECDHE-ECDSA-AES256-CCM8" },
+ /* entries marked ns are non-"standard", they are not in OpenSSL */
+ { 0x0041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA",
+ "CAMELLIA128-SHA" },
+ { 0x0045, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA",
+ "DHE-RSA-CAMELLIA128-SHA" },
+ { 0x0084, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA",
+ "CAMELLIA256-SHA" },
+ { 0x0088, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA",
+ "DHE-RSA-CAMELLIA256-SHA" },
+ { 0x00BA, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+ "CAMELLIA128-SHA256" },
+ { 0x00BE, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+ "DHE-RSA-CAMELLIA128-SHA256" },
+ { 0x00C0, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256",
+ "CAMELLIA256-SHA256" },
+ { 0x00C4, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256",
+ "DHE-RSA-CAMELLIA256-SHA256" },
+ { 0xC037, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256",
+ "ECDHE-PSK-AES128-CBC-SHA256" },
+ { 0xC038, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384",
+ "ECDHE-PSK-AES256-CBC-SHA384" },
+ { 0xC039, "TLS_ECDHE_PSK_WITH_NULL_SHA",
+ "ECDHE-PSK-NULL-SHA" },
+ { 0xC03A, "TLS_ECDHE_PSK_WITH_NULL_SHA256",
+ "ECDHE-PSK-NULL-SHA256" },
+ { 0xC03B, "TLS_ECDHE_PSK_WITH_NULL_SHA384",
+ "ECDHE-PSK-NULL-SHA384" },
+ { 0xC03C, "TLS_RSA_WITH_ARIA_128_CBC_SHA256",
+ "ARIA128-SHA256" /* ns */ },
+ { 0xC03D, "TLS_RSA_WITH_ARIA_256_CBC_SHA384",
+ "ARIA256-SHA384" /* ns */ },
+ { 0xC044, "TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256",
+ "DHE-RSA-ARIA128-SHA256" /* ns */ },
+ { 0xC045, "TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384",
+ "DHE-RSA-ARIA256-SHA384" /* ns */ },
+ { 0xC048, "TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256",
+ "ECDHE-ECDSA-ARIA128-SHA256" /* ns */ },
+ { 0xC049, "TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384",
+ "ECDHE-ECDSA-ARIA256-SHA384" /* ns */ },
+ { 0xC04A, "TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256",
+ "ECDH-ECDSA-ARIA128-SHA256" /* ns */ },
+ { 0xC04B, "TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384",
+ "ECDH-ECDSA-ARIA256-SHA384" /* ns */ },
+ { 0xC04C, "TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256",
+ "ECDHE-ARIA128-SHA256" /* ns */ },
+ { 0xC04D, "TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384",
+ "ECDHE-ARIA256-SHA384" /* ns */ },
+ { 0xC04E, "TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256",
+ "ECDH-ARIA128-SHA256" /* ns */ },
+ { 0xC04F, "TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384",
+ "ECDH-ARIA256-SHA384" /* ns */ },
+ { 0xC050, "TLS_RSA_WITH_ARIA_128_GCM_SHA256",
+ "ARIA128-GCM-SHA256" },
+ { 0xC051, "TLS_RSA_WITH_ARIA_256_GCM_SHA384",
+ "ARIA256-GCM-SHA384" },
+ { 0xC052, "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256",
+ "DHE-RSA-ARIA128-GCM-SHA256" },
+ { 0xC053, "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384",
+ "DHE-RSA-ARIA256-GCM-SHA384" },
+ { 0xC05C, "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256",
+ "ECDHE-ECDSA-ARIA128-GCM-SHA256" },
+ { 0xC05D, "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384",
+ "ECDHE-ECDSA-ARIA256-GCM-SHA384" },
+ { 0xC05E, "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256",
+ "ECDH-ECDSA-ARIA128-GCM-SHA256" /* ns */ },
+ { 0xC05F, "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384",
+ "ECDH-ECDSA-ARIA256-GCM-SHA384" /* ns */ },
+ { 0xC060, "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256",
+ "ECDHE-ARIA128-GCM-SHA256" },
+ { 0xC061, "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384",
+ "ECDHE-ARIA256-GCM-SHA384" },
+ { 0xC062, "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256",
+ "ECDH-ARIA128-GCM-SHA256" /* ns */ },
+ { 0xC063, "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384",
+ "ECDH-ARIA256-GCM-SHA384" /* ns */ },
+ { 0xC064, "TLS_PSK_WITH_ARIA_128_CBC_SHA256",
+ "PSK-ARIA128-SHA256" /* ns */ },
+ { 0xC065, "TLS_PSK_WITH_ARIA_256_CBC_SHA384",
+ "PSK-ARIA256-SHA384" /* ns */ },
+ { 0xC066, "TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256",
+ "DHE-PSK-ARIA128-SHA256" /* ns */ },
+ { 0xC067, "TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384",
+ "DHE-PSK-ARIA256-SHA384" /* ns */ },
+ { 0xC068, "TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256",
+ "RSA-PSK-ARIA128-SHA256" /* ns */ },
+ { 0xC069, "TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384",
+ "RSA-PSK-ARIA256-SHA384" /* ns */ },
+ { 0xC06A, "TLS_PSK_WITH_ARIA_128_GCM_SHA256",
+ "PSK-ARIA128-GCM-SHA256" },
+ { 0xC06B, "TLS_PSK_WITH_ARIA_256_GCM_SHA384",
+ "PSK-ARIA256-GCM-SHA384" },
+ { 0xC06C, "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256",
+ "DHE-PSK-ARIA128-GCM-SHA256" },
+ { 0xC06D, "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384",
+ "DHE-PSK-ARIA256-GCM-SHA384" },
+ { 0xC06E, "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256",
+ "RSA-PSK-ARIA128-GCM-SHA256" },
+ { 0xC06F, "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384",
+ "RSA-PSK-ARIA256-GCM-SHA384" },
+ { 0xC070, "TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256",
+ "ECDHE-PSK-ARIA128-SHA256" /* ns */ },
+ { 0xC071, "TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384",
+ "ECDHE-PSK-ARIA256-SHA384" /* ns */ },
+ { 0xC072, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
+ "ECDHE-ECDSA-CAMELLIA128-SHA256" },
+ { 0xC073, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
+ "ECDHE-ECDSA-CAMELLIA256-SHA384" },
+ { 0xC074, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
+ "ECDH-ECDSA-CAMELLIA128-SHA256" /* ns */ },
+ { 0xC075, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
+ "ECDH-ECDSA-CAMELLIA256-SHA384" /* ns */ },
+ { 0xC076, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+ "ECDHE-RSA-CAMELLIA128-SHA256" },
+ { 0xC077, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384",
+ "ECDHE-RSA-CAMELLIA256-SHA384" },
+ { 0xC078, "TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+ "ECDH-CAMELLIA128-SHA256" /* ns */ },
+ { 0xC079, "TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384",
+ "ECDH-CAMELLIA256-SHA384" /* ns */ },
+ { 0xC07A, "TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+ "CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC07B, "TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+ "CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC07C, "TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+ "DHE-RSA-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC07D, "TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+ "DHE-RSA-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC086, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
+ "ECDHE-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC087, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
+ "ECDHE-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC088, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
+ "ECDH-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC089, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
+ "ECDH-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC08A, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+ "ECDHE-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC08B, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+ "ECDHE-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC08C, "TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+ "ECDH-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC08D, "TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+ "ECDH-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC08E, "TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256",
+ "PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC08F, "TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384",
+ "PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC090, "TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256",
+ "DHE-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC091, "TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384",
+ "DHE-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC092, "TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256",
+ "RSA-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
+ { 0xC093, "TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384",
+ "RSA-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
+ { 0xC094, "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+ "PSK-CAMELLIA128-SHA256" },
+ { 0xC095, "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+ "PSK-CAMELLIA256-SHA384" },
+ { 0xC096, "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+ "DHE-PSK-CAMELLIA128-SHA256" },
+ { 0xC097, "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+ "DHE-PSK-CAMELLIA256-SHA384" },
+ { 0xC098, "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+ "RSA-PSK-CAMELLIA128-SHA256" },
+ { 0xC099, "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+ "RSA-PSK-CAMELLIA256-SHA384" },
+ { 0xC09A, "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+ "ECDHE-PSK-CAMELLIA128-SHA256" },
+ { 0xC09B, "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+ "ECDHE-PSK-CAMELLIA256-SHA384" },
+ { 0xC09E, "TLS_DHE_RSA_WITH_AES_128_CCM",
+ "DHE-RSA-AES128-CCM" },
+ { 0xC09F, "TLS_DHE_RSA_WITH_AES_256_CCM",
+ "DHE-RSA-AES256-CCM" },
+ { 0xC0A2, "TLS_DHE_RSA_WITH_AES_128_CCM_8",
+ "DHE-RSA-AES128-CCM8" },
+ { 0xC0A3, "TLS_DHE_RSA_WITH_AES_256_CCM_8",
+ "DHE-RSA-AES256-CCM8" },
+ { 0xC0A4, "TLS_PSK_WITH_AES_128_CCM",
+ "PSK-AES128-CCM" },
+ { 0xC0A5, "TLS_PSK_WITH_AES_256_CCM",
+ "PSK-AES256-CCM" },
+ { 0xC0A6, "TLS_DHE_PSK_WITH_AES_128_CCM",
+ "DHE-PSK-AES128-CCM" },
+ { 0xC0A7, "TLS_DHE_PSK_WITH_AES_256_CCM",
+ "DHE-PSK-AES256-CCM" },
+ { 0xC0A8, "TLS_PSK_WITH_AES_128_CCM_8",
+ "PSK-AES128-CCM8" },
+ { 0xC0A9, "TLS_PSK_WITH_AES_256_CCM_8",
+ "PSK-AES256-CCM8" },
+ { 0xC0AA, "TLS_PSK_DHE_WITH_AES_128_CCM_8",
+ "DHE-PSK-AES128-CCM8" },
+ { 0xC0AB, "TLS_PSK_DHE_WITH_AES_256_CCM_8",
+ "DHE-PSK-AES256-CCM8" },
+ { 0xCCAA, "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
+ "DHE-RSA-CHACHA20-POLY1305" },
+ { 0xCCAC, "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
+ "ECDHE-PSK-CHACHA20-POLY1305" },
+ { 0xCCAD, "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
+ "DHE-PSK-CHACHA20-POLY1305" },
+ { 0xCCAE, "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256",
+ "RSA-PSK-CHACHA20-POLY1305" },
#endif
-};
+ };
-static const char *cs_test_string =
- "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:"
- "TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:"
- "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:"
- "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:"
- "ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:"
- "DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:"
- "ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:"
- "ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:"
- "ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:"
- "DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:"
- "AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:"
- "DES-CBC3-SHA:"
- ":: GIBBERISH ::"
-;
+ static const char *cs_test_string =
+ "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:"
+ "TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:"
+ "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:"
+ "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:"
+ "ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:"
+ "DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:"
+ "ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:"
+ "ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:"
+ "ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:"
+ "DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:"
+ "AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:"
+ "DES-CBC3-SHA:"
+ ":: GIBBERISH ::"
+ ;
-struct test_str_entry {
- uint16_t id;
- const char *str;
-};
-static const struct test_str_entry test_str_list[] = {
-#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
- { 0x1301, "TLS_AES_128_GCM_SHA256"},
- { 0x1302, "TLS_AES_256_GCM_SHA384"},
- { 0x1303, "TLS_CHACHA20_POLY1305_SHA256"},
-#else
- { 0x0000, "TLS_AES_128_GCM_SHA256"},
- { 0x0000, "TLS_AES_256_GCM_SHA384"},
- { 0x0000, "TLS_CHACHA20_POLY1305_SHA256"},
-#endif
- { 0xC02B, "ECDHE-ECDSA-AES128-GCM-SHA256"},
- { 0xC02F, "ECDHE-RSA-AES128-GCM-SHA256"},
- { 0xC02C, "ECDHE-ECDSA-AES256-GCM-SHA384"},
- { 0xC030, "ECDHE-RSA-AES256-GCM-SHA384"},
- { 0xCCA9, "ECDHE-ECDSA-CHACHA20-POLY1305"},
- { 0xCCA8, "ECDHE-RSA-CHACHA20-POLY1305"},
+ struct test_str_entry {
+ uint16_t id;
+ const char *str;
+ };
+ static const struct test_str_entry test_str_list[] = {
+ { 0x1301, "TLS_AES_128_GCM_SHA256"},
+ { 0x1302, "TLS_AES_256_GCM_SHA384"},
+ { 0x1303, "TLS_CHACHA20_POLY1305_SHA256"},
+ { 0xC02B, "ECDHE-ECDSA-AES128-GCM-SHA256"},
+ { 0xC02F, "ECDHE-RSA-AES128-GCM-SHA256"},
+ { 0xC02C, "ECDHE-ECDSA-AES256-GCM-SHA384"},
+ { 0xC030, "ECDHE-RSA-AES256-GCM-SHA384"},
+ { 0xCCA9, "ECDHE-ECDSA-CHACHA20-POLY1305"},
+ { 0xCCA8, "ECDHE-RSA-CHACHA20-POLY1305"},
#if defined(USE_MBEDTLS)
- { 0x009E, "DHE-RSA-AES128-GCM-SHA256"},
- { 0x009F, "DHE-RSA-AES256-GCM-SHA384"},
+ { 0x009E, "DHE-RSA-AES128-GCM-SHA256"},
+ { 0x009F, "DHE-RSA-AES256-GCM-SHA384"},
#else
- { 0x0000, "DHE-RSA-AES128-GCM-SHA256"},
- { 0x0000, "DHE-RSA-AES256-GCM-SHA384"},
+ { 0x0000, "DHE-RSA-AES128-GCM-SHA256"},
+ { 0x0000, "DHE-RSA-AES256-GCM-SHA384"},
#endif
#if defined(USE_MBEDTLS)
- { 0xCCAA, "DHE-RSA-CHACHA20-POLY1305"},
+ { 0xCCAA, "DHE-RSA-CHACHA20-POLY1305"},
#else
- { 0x0000, "DHE-RSA-CHACHA20-POLY1305"},
+ { 0x0000, "DHE-RSA-CHACHA20-POLY1305"},
#endif
#if defined(USE_MBEDTLS)
- { 0xC023, "ECDHE-ECDSA-AES128-SHA256" },
- { 0xC027, "ECDHE-RSA-AES128-SHA256" },
- { 0xC009, "ECDHE-ECDSA-AES128-SHA" },
- { 0xC013, "ECDHE-RSA-AES128-SHA" },
- { 0xC024, "ECDHE-ECDSA-AES256-SHA384" },
- { 0xC028, "ECDHE-RSA-AES256-SHA384" },
- { 0xC00A, "ECDHE-ECDSA-AES256-SHA" },
- { 0xC014, "ECDHE-RSA-AES256-SHA" },
+ { 0xC023, "ECDHE-ECDSA-AES128-SHA256" },
+ { 0xC027, "ECDHE-RSA-AES128-SHA256" },
+ { 0xC009, "ECDHE-ECDSA-AES128-SHA" },
+ { 0xC013, "ECDHE-RSA-AES128-SHA" },
+ { 0xC024, "ECDHE-ECDSA-AES256-SHA384" },
+ { 0xC028, "ECDHE-RSA-AES256-SHA384" },
+ { 0xC00A, "ECDHE-ECDSA-AES256-SHA" },
+ { 0xC014, "ECDHE-RSA-AES256-SHA" },
#else
- { 0x0000, "ECDHE-ECDSA-AES128-SHA256" },
- { 0x0000, "ECDHE-RSA-AES128-SHA256" },
- { 0x0000, "ECDHE-ECDSA-AES128-SHA" },
- { 0x0000, "ECDHE-RSA-AES128-SHA" },
- { 0x0000, "ECDHE-ECDSA-AES256-SHA384" },
- { 0x0000, "ECDHE-RSA-AES256-SHA384" },
- { 0x0000, "ECDHE-ECDSA-AES256-SHA" },
- { 0x0000, "ECDHE-RSA-AES256-SHA" },
+ { 0x0000, "ECDHE-ECDSA-AES128-SHA256" },
+ { 0x0000, "ECDHE-RSA-AES128-SHA256" },
+ { 0x0000, "ECDHE-ECDSA-AES128-SHA" },
+ { 0x0000, "ECDHE-RSA-AES128-SHA" },
+ { 0x0000, "ECDHE-ECDSA-AES256-SHA384" },
+ { 0x0000, "ECDHE-RSA-AES256-SHA384" },
+ { 0x0000, "ECDHE-ECDSA-AES256-SHA" },
+ { 0x0000, "ECDHE-RSA-AES256-SHA" },
#endif
#if defined(USE_MBEDTLS)
- { 0x0067, "DHE-RSA-AES128-SHA256" },
- { 0x006B, "DHE-RSA-AES256-SHA256" },
+ { 0x0067, "DHE-RSA-AES128-SHA256" },
+ { 0x006B, "DHE-RSA-AES256-SHA256" },
#else
- { 0x0000, "DHE-RSA-AES128-SHA256" },
- { 0x0000, "DHE-RSA-AES256-SHA256" },
+ { 0x0000, "DHE-RSA-AES128-SHA256" },
+ { 0x0000, "DHE-RSA-AES256-SHA256" },
#endif
#if defined(USE_MBEDTLS)
- { 0x009C, "AES128-GCM-SHA256" },
- { 0x009D, "AES256-GCM-SHA384" },
- { 0x003C, "AES128-SHA256" },
- { 0x003D, "AES256-SHA256" },
- { 0x002F, "AES128-SHA" },
- { 0x0035, "AES256-SHA" },
+ { 0x009C, "AES128-GCM-SHA256" },
+ { 0x009D, "AES256-GCM-SHA384" },
+ { 0x003C, "AES128-SHA256" },
+ { 0x003D, "AES256-SHA256" },
+ { 0x002F, "AES128-SHA" },
+ { 0x0035, "AES256-SHA" },
#else
- { 0x0000, "AES128-GCM-SHA256" },
- { 0x0000, "AES256-GCM-SHA384" },
- { 0x0000, "AES128-SHA256" },
- { 0x0000, "AES256-SHA256" },
- { 0x0000, "AES128-SHA" },
- { 0x0000, "AES256-SHA" },
+ { 0x0000, "AES128-GCM-SHA256" },
+ { 0x0000, "AES256-GCM-SHA384" },
+ { 0x0000, "AES128-SHA256" },
+ { 0x0000, "AES256-SHA256" },
+ { 0x0000, "AES128-SHA" },
+ { 0x0000, "AES256-SHA" },
#endif
- { 0x0000, "DES-CBC3-SHA" },
- { 0x0000, "GIBBERISH" },
- { 0x0000, "" },
-};
+ { 0x0000, "DES-CBC3-SHA" },
+ { 0x0000, "GIBBERISH" },
+ { 0x0000, "" },
+ };
-UNITTEST_START
-{
- for(size_t i = 0; i < CURL_ARRAYSIZE(test_cs_list); i++) {
+ size_t i;
+ for(i = 0; i < CURL_ARRAYSIZE(test_cs_list); i++) {
const struct test_cs_entry *test = &test_cs_list[i];
const char *expect;
char buf[64] = "";
/* test Curl_cipher_suite_walk_str() */
{
const char *ptr, *end = cs_test_string;
- int i = 0;
+ int j = 0;
uint16_t id;
size_t len;
for(ptr = cs_test_string; ptr[0] != '\0'; ptr = end) {
- const struct test_str_entry *test = &test_str_list[i];
- abort_if(i == CURL_ARRAYSIZE(test_str_list), "should have been done");
+ const struct test_str_entry *test = &test_str_list[j];
+ abort_if(j == CURL_ARRAYSIZE(test_str_list), "should have been done");
id = Curl_cipher_suite_walk_str(&ptr, &end);
len = end - ptr;
unitfail++;
goto unit_test_abort;
}
- i++;
+ j++;
}
}
-}
-UNITTEST_STOP
-
-#else /* defined(USE_MBEDTLS) */
-
-UNITTEST_START
-UNITTEST_STOP
-
#endif /* defined(USE_MBEDTLS) || defined(USE_RUSTLS) */
+
+ UNITTEST_END_SIMPLE
+}
#include "uint-bset.h"
#include "curl_trc.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static unsigned int s1[] = { /* spread numbers, some at slot edges */
- 0, 1, 4, 17, 63, 64, 65, 66,
- 90, 99,
-};
-static unsigned int s2[] = { /* set with all bits in slot1 set */
- 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127,
-};
-
static void check_set(const char *name, unsigned int capacity,
- unsigned int *s, size_t slen)
+ const unsigned int *s, size_t slen)
{
struct uint_bset bset;
size_t i, j;
Curl_uint_bset_destroy(&bset);
}
-static void unit_stop(void)
+static CURLcode test_unit3211(char *arg)
{
-}
-
-
-UNITTEST_START
+ UNITTEST_BEGIN_SIMPLE
+
+ static const unsigned int s1[] = { /* spread numbers, some at slot edges */
+ 0, 1, 4, 17, 63, 64, 65, 66,
+ 90, 99,
+ };
+ static const unsigned int s2[] = { /* set with all bits in slot1 set */
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127,
+ };
check_set("s1", 100, s1, CURL_ARRAYSIZE(s1));
check_set("s2", 1000, s2, CURL_ARRAYSIZE(s2));
-UNITTEST_STOP
+ UNITTEST_END_SIMPLE
+}
#define TBL_SIZE 100
-static struct uint_tbl tbl;
-
-static int dummy;
-
-static CURLcode unit_setup(void)
+static CURLcode t3212_setup(struct uint_tbl *tbl)
{
- Curl_uint_tbl_init(&tbl, NULL);
- return Curl_uint_tbl_resize(&tbl, TBL_SIZE);
+ Curl_uint_tbl_init(tbl, NULL);
+ return Curl_uint_tbl_resize(tbl, TBL_SIZE);
}
-static void unit_stop(void)
+static void t3212_stop(struct uint_tbl *tbl)
{
- Curl_uint_tbl_destroy(&tbl);
+ Curl_uint_tbl_destroy(tbl);
}
-static void check3212(void)
+static CURLcode test_unit3212(char *arg)
{
+ struct uint_tbl tbl;
+ int dummy;
+
+ UNITTEST_BEGIN(t3212_setup(&tbl))
+
unsigned int i, key, n;
void *entry;
Curl_uint_tbl_remove(&tbl, 17);
fail_unless(Curl_uint_tbl_add(&tbl, &dummy, &key), "failed to add again");
fail_unless(key == 17, "unexpected key assigned");
-}
-
-UNITTEST_START
-check3212();
-
-UNITTEST_STOP
+ UNITTEST_END(t3212_stop(&tbl))
+}
#include "uint-spbset.h"
#include "curl_trc.h"
-static CURLcode unit_setup(void)
-{
- return CURLE_OK;
-}
-
-static unsigned int s1_3213[] = { /* spread numbers, some at slot edges */
- 0, 1, 4, 17, 63, 64, 65, 66,
- 90, 99,
-};
-static unsigned int s2_3213[] = { /* set with all bits in slot1 set */
- 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127,
-};
-static unsigned int s3_3213[] = { /* very spread numbers */
- 2232, 5167, 8204, 8526, 8641, 10056, 10140, 10611,
- 10998, 11626, 13735, 15539, 17947, 24295, 27833, 30318,
-};
-
-static void check_spbset(const char *name, unsigned int *s, size_t slen)
+static void check_spbset(const char *name, const unsigned int *s, size_t slen)
{
struct uint_spbset bset;
size_t i, j;
Curl_uint_spbset_destroy(&bset);
}
-static void unit_stop(void)
+static CURLcode test_unit3213(char *arg)
{
+ UNITTEST_BEGIN_SIMPLE
+
+ static const unsigned int s1[] = { /* spread numbers, some at slot edges */
+ 0, 1, 4, 17, 63, 64, 65, 66,
+ 90, 99,
+ };
+ static const unsigned int s2[] = { /* set with all bits in slot1 set */
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127,
+ };
+ static const unsigned int s3[] = { /* very spread numbers */
+ 2232, 5167, 8204, 8526, 8641, 10056, 10140, 10611,
+ 10998, 11626, 13735, 15539, 17947, 24295, 27833, 30318,
+ };
+
+ check_spbset("s1", s1, CURL_ARRAYSIZE(s1));
+ check_spbset("s2", s2, CURL_ARRAYSIZE(s2));
+ check_spbset("s3", s3, CURL_ARRAYSIZE(s3));
+
+ UNITTEST_END_SIMPLE
}
-
-
-UNITTEST_START
-
- check_spbset("s1", s1_3213, CURL_ARRAYSIZE(s1_3213));
- check_spbset("s2", s2_3213, CURL_ARRAYSIZE(s2_3213));
- check_spbset("s3", s3_3213, CURL_ARRAYSIZE(s3_3213));
-
-UNITTEST_STOP