From: Viktor Szakats Date: Wed, 11 Jun 2025 09:31:14 +0000 (+0200) Subject: tests: always make bundles, adapt build and tests X-Git-Tag: curl-8_15_0~273 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c27a67daa1b76859c18d63e4e1f528db05b5e13;p=thirdparty%2Fcurl.git tests: always make bundles, adapt build and tests Make test bundles the default. Drop non-bundle build mode. Also do all the optimizations and tidy-ups this allows, simpler builds, less bundle exceptions, streamlined build mechanics. Also rework the init/deinit macro magic for unit tests. The new method allows using unique init/deinit function names, and calling them with arguments. This is in turn makes it possible to reduce the use of global variables. Note this drop existing build options `-DCURL_TEST_BUNDLES=` from cmake and `--enable-test-bundles` / `--disable-test-bundles` from autotools. Also: - rename test entry functions to have unique names: `test_` This removes the last exception that was handled in the generator. - fix `make dist` to not miss test sources with test bundles enabled. - sync and merge `tests/mk-bundle.pl` into `scripts/mk-unity.pl`. - mk-unity.pl: add `--embed` option and use it when `CURL_CLANG_TIDY=ON` to ensure that `clang-tidy` does not miss external test C sources. (because `clang-tidy` ignores code that's #included.) - tests/unit: drop no-op setup/stop functions. - tests: reduce symbol scopes, global macros, other fixes and tidy-ups. - tool1621: fix to run, also fix it to pass. - sockfilt: fix Windows compiler warning in certain unity include order, by explicitly including `warnless.h`. Follow-up to 6897aeb10561b55c6659866fc0518dd67422f267 #17468 Closes #17590 --- diff --git a/.github/workflows/http3-linux.yml b/.github/workflows/http3-linux.yml index e34340df3b..3b881d4d2a 100644 --- a/.github/workflows/http3-linux.yml +++ b/.github/workflows/http3-linux.yml @@ -468,10 +468,10 @@ jobs: 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 diff --git a/.github/workflows/linux-old.yml b/.github/workflows/linux-old.yml index bc33b4a0d4..f1c4ebbc10 100644 --- a/.github/workflows/linux-old.yml +++ b/.github/workflows/linux-old.yml @@ -82,7 +82,7 @@ jobs: 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 @@ -98,7 +98,7 @@ jobs: 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 @@ -128,7 +128,7 @@ jobs: 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 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b0c8315c21..a8bea98b1d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -573,12 +573,12 @@ jobs: 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 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b0dbdba714..88ebd647de 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -236,7 +236,7 @@ jobs: [ "${_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} @@ -256,7 +256,7 @@ jobs: 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} @@ -458,7 +458,7 @@ jobs: [ -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)" \ @@ -478,7 +478,7 @@ jobs: 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)" \ diff --git a/.github/workflows/non-native.yml b/.github/workflows/non-native.yml index 89def2b28b..dba8e3ffca 100644 --- a/.github/workflows/non-native.yml +++ b/.github/workflows/non-native.yml @@ -64,7 +64,7 @@ jobs: 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 \ @@ -110,7 +110,7 @@ jobs: 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 \ @@ -137,7 +137,7 @@ jobs: 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 @@ -175,7 +175,7 @@ jobs: 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 \ @@ -188,7 +188,7 @@ jobs: 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 \ @@ -258,7 +258,7 @@ jobs: 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 \ @@ -378,12 +378,12 @@ jobs: # 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 \ @@ -469,12 +469,12 @@ jobs: -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" \ @@ -569,7 +569,7 @@ jobs: -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" \ @@ -580,7 +580,7 @@ jobs: -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" \ diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 871501ad23..c7c597e344 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -96,11 +96,11 @@ jobs: 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 \ @@ -290,7 +290,7 @@ jobs: -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 @@ -300,7 +300,7 @@ jobs: 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 \ @@ -512,7 +512,7 @@ jobs: 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} @@ -636,13 +636,13 @@ jobs: 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 \ @@ -741,14 +741,14 @@ jobs: -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 \ @@ -936,7 +936,7 @@ jobs: -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" \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b7db24843..2d9291009c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,14 +287,12 @@ if(ENABLE_CURLDEBUG) 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") diff --git a/appveyor.sh b/appveyor.sh index 9deac61e0b..72ecba7bd2 100644 --- a/appveyor.sh +++ b/appveyor.sh @@ -68,7 +68,6 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then 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 \ diff --git a/configure.ac b/configure.ac index aae5bb9c52..3926cf3c4a 100644 --- a/configure.ac +++ b/configure.ac @@ -651,29 +651,6 @@ AS_HELP_STRING([--disable-unity],[Disable unity (default)]), 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 diff --git a/docs/INSTALL-CMAKE.md b/docs/INSTALL-CMAKE.md index f896e481c2..35451075dc 100644 --- a/docs/INSTALL-CMAKE.md +++ b/docs/INSTALL-CMAKE.md @@ -244,7 +244,6 @@ target_link_libraries(my_target PRIVATE CURL::libcurl) - `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` diff --git a/docs/cmdline-opts/CMakeLists.txt b/docs/cmdline-opts/CMakeLists.txt index 4a32f2d9d9..2e13906967 100644 --- a/docs/cmdline-opts/CMakeLists.txt +++ b/docs/cmdline-opts/CMakeLists.txt @@ -21,7 +21,7 @@ # 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") diff --git a/docs/cmdline-opts/Makefile.am b/docs/cmdline-opts/Makefile.am index b087e38525..e016be286c 100644 --- a/docs/cmdline-opts/Makefile.am +++ b/docs/cmdline-opts/Makefile.am @@ -27,6 +27,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies MANPAGE = curl.1 ASCIIPAGE = curl.txt +# Get SUPPORT, DPAGES variables include Makefile.inc EXTRA_DIST = $(DPAGES) MANPAGE.md $(SUPPORT) CMakeLists.txt mainpage.idx diff --git a/docs/cmdline-opts/Makefile.inc b/docs/cmdline-opts/Makefile.inc index 82e64daa88..6e7f0aafa6 100644 --- a/docs/cmdline-opts/Makefile.inc +++ b/docs/cmdline-opts/Makefile.inc @@ -21,7 +21,7 @@ # SPDX-License-Identifier: curl # ########################################################################### -# Shared between Makefile.am and CMakeLists.txt +# Shared between CMakeLists.txt and Makefile.am SUPPORT = \ _AUTHORS.md \ diff --git a/docs/examples/CMakeLists.txt b/docs/examples/CMakeLists.txt index ff7cf9b6cf..e27ed47ac1 100644 --- a/docs/examples/CMakeLists.txt +++ b/docs/examples/CMakeLists.txt @@ -24,7 +24,7 @@ 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") @@ -37,7 +37,6 @@ foreach(_target IN LISTS check_PROGRAMS) 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() diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am index 042922f1c4..6abbe956cb 100644 --- a/docs/examples/Makefile.am +++ b/docs/examples/Makefile.am @@ -57,7 +57,7 @@ LDADD = $(LIBDIR)/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@ # 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) diff --git a/docs/examples/Makefile.inc b/docs/examples/Makefile.inc index 8c0ceee6de..57e320c96e 100644 --- a/docs/examples/Makefile.inc +++ b/docs/examples/Makefile.inc @@ -21,6 +21,7 @@ # SPDX-License-Identifier: curl # ########################################################################### +# Shared between CMakeLists.txt and Makefile.am # These are all libcurl example programs to be test compiled check_PROGRAMS = \ diff --git a/docs/libcurl/CMakeLists.txt b/docs/libcurl/CMakeLists.txt index 56992da0de..2102dd8ee3 100644 --- a/docs/libcurl/CMakeLists.txt +++ b/docs/libcurl/CMakeLists.txt @@ -21,7 +21,7 @@ # 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") diff --git a/docs/libcurl/Makefile.am b/docs/libcurl/Makefile.am index d6e4314926..7b84ef44f8 100644 --- a/docs/libcurl/Makefile.am +++ b/docs/libcurl/Makefile.am @@ -27,6 +27,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies SUBDIRS = opts if BUILD_DOCS +# Get man_MANS variable include Makefile.inc CURLPAGES = $(man_MANS:.3=.md) diff --git a/docs/libcurl/Makefile.inc b/docs/libcurl/Makefile.inc index c0d1d716f1..83357cf42b 100644 --- a/docs/libcurl/Makefile.inc +++ b/docs/libcurl/Makefile.inc @@ -21,8 +21,7 @@ # SPDX-License-Identifier: curl # ########################################################################### - -# Shared between Makefile.am and CMakeLists.txt +# Shared between CMakeLists.txt and Makefile.am man_MANS = \ curl_easy_cleanup.3 \ diff --git a/docs/libcurl/opts/CMakeLists.txt b/docs/libcurl/opts/CMakeLists.txt index f7632c49d5..c3e2c2cc6b 100644 --- a/docs/libcurl/opts/CMakeLists.txt +++ b/docs/libcurl/opts/CMakeLists.txt @@ -21,7 +21,7 @@ # 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") diff --git a/docs/libcurl/opts/Makefile.am b/docs/libcurl/opts/Makefile.am index be877c52ef..cf33491367 100644 --- a/docs/libcurl/opts/Makefile.am +++ b/docs/libcurl/opts/Makefile.am @@ -25,6 +25,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies if BUILD_DOCS +# Get man_MANS variable include Makefile.inc CURLPAGES = $(man_MANS:.3=.md) diff --git a/docs/libcurl/opts/Makefile.inc b/docs/libcurl/opts/Makefile.inc index 794f47b9f3..d62d369a66 100644 --- a/docs/libcurl/opts/Makefile.inc +++ b/docs/libcurl/opts/Makefile.inc @@ -21,7 +21,7 @@ # SPDX-License-Identifier: curl # ########################################################################### -# Shared between Makefile.am and CMakeLists.txt +# Shared between CMakeLists.txt and Makefile.am man_MANS = \ CURLINFO_ACTIVESOCKET.3 \ diff --git a/docs/tests/TEST-SUITE.md b/docs/tests/TEST-SUITE.md index e6fce14f0a..1e387898f7 100644 --- a/docs/tests/TEST-SUITE.md +++ b/docs/tests/TEST-SUITE.md @@ -312,11 +312,9 @@ SPDX-License-Identifier: curl ### 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_`, e.g. `test_lib1598` or `test_unit1305`. For servers `main` becomes `main_sws` for the `sws` server, diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8cc5844227..54eaf6e6d4 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -29,7 +29,7 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS} 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") @@ -231,7 +231,7 @@ if(BUILD_SHARED_LIBS) 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") diff --git a/lib/Makefile.am b/lib/Makefile.am index 463b72ed8e..8306607e40 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -57,8 +57,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ # Prevent LIBS from being used for all link targets LIBS = $(BLANK_AT_MAKETIME) -include Makefile.soname - AM_CPPFLAGS += -DBUILDING_LIBCURL AM_LDFLAGS = AM_CFLAGS = @@ -69,7 +67,7 @@ if CURLDEBUG AM_CPPFLAGS += -DCURLDEBUG endif -# Makefile.inc provides the CSOURCES and HHEADERS defines +# Get CSOURCES, HHEADERS variables include Makefile.inc if DOING_NATIVE_WINDOWS @@ -86,7 +84,7 @@ if CURLDEBUG 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) @@ -103,6 +101,8 @@ libcurl_la_LDFLAGS_EXTRA = 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 diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 0b1ad1ac76..fd2546b1d7 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -21,6 +21,7 @@ # SPDX-License-Identifier: curl # ########################################################################### +# Shared between CMakeLists.txt and Makefile.am LIB_CURLX_CFILES = \ curlx/base64.c \ diff --git a/lib/Makefile.soname b/lib/Makefile.soname index eee661b750..22c04e24c7 100644 --- a/lib/Makefile.soname +++ b/lib/Makefile.soname @@ -21,6 +21,7 @@ # 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 diff --git a/scripts/mk-unity.pl b/scripts/mk-unity.pl index 4ad86d1c77..c1878b1216 100755 --- a/scripts/mk-unity.pl +++ b/scripts/mk-unity.pl @@ -23,48 +23,91 @@ # ########################################################################### -# 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 [] [--exclude ]\n"; + die "Usage: $0 [--test ] [--include ] [--exclude ] [--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 <
}; + 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"; +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9cae87b01d..0d095b9429 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -68,7 +68,7 @@ if(CURL_CA_EMBED_SET) 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") diff --git a/src/Makefile.am b/src/Makefile.am index 2df95a0f94..0195c0b773 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -67,6 +67,7 @@ if USE_UNICODE UNICODEFLAG = -municode endif +# Get CURL_CFILES, CURLX_CFILES, CURL_HFILES variables include Makefile.inc curl_cfiles_gen = @@ -80,7 +81,7 @@ else 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 = @@ -112,7 +113,7 @@ libcurltool_la_CFLAGS = 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 = diff --git a/src/Makefile.inc b/src/Makefile.inc index dd7ffc3575..c83154474a 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -21,7 +21,8 @@ # 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 : diff --git a/src/tool_setup.h b/src/tool_setup.h index b198d89dee..d1d5ad9d79 100644 --- a/src/tool_setup.h +++ b/src/tool_setup.h @@ -24,7 +24,9 @@ * ***************************************************************************/ +#ifndef CURL_NO_OLDIES #define CURL_NO_OLDIES +#endif /* * curl_setup.h may define preprocessor macros such as _FILE_OFFSET_BITS and diff --git a/src/tool_xattr.c b/src/tool_xattr.c index c0c1b2a99d..ee35d4d464 100644 --- a/src/tool_xattr.c +++ b/src/tool_xattr.c @@ -43,12 +43,7 @@ static const struct xattr_mapping { /* 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; diff --git a/src/tool_xattr.h b/src/tool_xattr.h index 2ffffd275f..31301b3b06 100644 --- a/src/tool_xattr.h +++ b/src/tool_xattr.h @@ -38,6 +38,10 @@ #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 diff --git a/tests/Makefile.am b/tests/Makefile.am index 3315090e2c..ed7c55e62e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -62,7 +62,6 @@ EXTRA_DIST = \ http2-server.pl \ http3-server.pl \ memanalyze.pl \ - mk-bundle.pl \ negtelnetserver.py \ nghttpx.conf \ pathhelp.pm \ diff --git a/tests/certs/CMakeLists.txt b/tests/certs/CMakeLists.txt index 2bc8e5ce07..399483a738 100644 --- a/tests/certs/CMakeLists.txt +++ b/tests/certs/CMakeLists.txt @@ -21,7 +21,7 @@ # 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") diff --git a/tests/certs/Makefile.am b/tests/certs/Makefile.am index 78303c2526..c9e1e38c3d 100644 --- a/tests/certs/Makefile.am +++ b/tests/certs/Makefile.am @@ -23,6 +23,7 @@ ########################################################################### AUTOMAKE_OPTIONS = foreign +# Get CERTCONFIG_CA, CERTCONFIGS, GENERATEDCERTS, SRPFILES variables include Makefile.inc EXTRA_DIST = $(CERTCONFIG_CA) $(CERTCONFIGS) $(SRPFILES) CMakeLists.txt \ diff --git a/tests/certs/Makefile.inc b/tests/certs/Makefile.inc index cc9514c206..2131172f4c 100644 --- a/tests/certs/Makefile.inc +++ b/tests/certs/Makefile.inc @@ -21,6 +21,8 @@ # SPDX-License-Identifier: curl # ########################################################################### +# Shared between CMakeLists.txt and Makefile.am + CERTCONFIG_CA = \ test-ca.cnf \ test-ca.prm diff --git a/tests/data/test1306 b/tests/data/test1306 index 6588fe7fcd..5512c3f5fe 100644 --- a/tests/data/test1306 +++ b/tests/data/test1306 @@ -22,9 +22,6 @@ internal hash create/add/destroy testing unit1305 - -%TESTNUMBER - diff --git a/tests/data/test1621 b/tests/data/test1621 index 4a6ad5e9b0..a93c07f02f 100644 --- a/tests/data/test1621 +++ b/tests/data/test1621 @@ -14,8 +14,6 @@ none unittest -https -pop3s unit tests for stripcredentials from URL diff --git a/tests/data/test2023 b/tests/data/test2023 index 759e682803..57998df96e 100644 --- a/tests/data/test2023 +++ b/tests/data/test2023 @@ -106,7 +106,7 @@ Finally, this is the real page! http -libauthretry +lib2023 diff --git a/tests/data/test2024 b/tests/data/test2024 index 915f76919b..376552f3fe 100644 --- a/tests/data/test2024 +++ b/tests/data/test2024 @@ -120,7 +120,7 @@ http crypto -libauthretry +lib2023 diff --git a/tests/data/test2025 b/tests/data/test2025 index 4794d3c0e9..f9bfa93aac 100644 --- a/tests/data/test2025 +++ b/tests/data/test2025 @@ -203,7 +203,7 @@ SSL http -libauthretry +lib2023 diff --git a/tests/data/test2026 b/tests/data/test2026 index 96e2ad4963..75fee9b2c2 100644 --- a/tests/data/test2026 +++ b/tests/data/test2026 @@ -156,7 +156,7 @@ http crypto -libauthretry +lib2023 diff --git a/tests/data/test2027 b/tests/data/test2027 index 45baa64bc0..f134830077 100644 --- a/tests/data/test2027 +++ b/tests/data/test2027 @@ -179,7 +179,7 @@ http crypto -libauthretry +lib2023 diff --git a/tests/data/test2028 b/tests/data/test2028 index 0ad03db587..ad37813c86 100644 --- a/tests/data/test2028 +++ b/tests/data/test2028 @@ -239,7 +239,7 @@ SSL http -libauthretry +lib2023 diff --git a/tests/data/test2029 b/tests/data/test2029 index 616fec179d..8bdae52787 100644 --- a/tests/data/test2029 +++ b/tests/data/test2029 @@ -176,7 +176,7 @@ SSL http -libauthretry +lib2023 diff --git a/tests/data/test2030 b/tests/data/test2030 index 8931ca749d..f423adc84e 100644 --- a/tests/data/test2030 +++ b/tests/data/test2030 @@ -228,7 +228,7 @@ SSL http -libauthretry +lib2023 diff --git a/tests/data/test2031 b/tests/data/test2031 index 20dd874131..b464b0b7a2 100644 --- a/tests/data/test2031 +++ b/tests/data/test2031 @@ -242,7 +242,7 @@ SSL http -libauthretry +lib2023 diff --git a/tests/data/test2032 b/tests/data/test2032 index d3d199c14c..ba32820d6f 100644 --- a/tests/data/test2032 +++ b/tests/data/test2032 @@ -75,7 +75,7 @@ SSL http -libntlmconnect +lib2032 diff --git a/tests/data/test2082 b/tests/data/test2082 index 4c37772d5e..1d548ef96d 100644 --- a/tests/data/test2082 +++ b/tests/data/test2082 @@ -27,7 +27,7 @@ http Pre-request callback for HTTP -libprereq +lib2082 diff --git a/tests/data/test2083 b/tests/data/test2083 index 9256151a86..0604d20c8f 100644 --- a/tests/data/test2083 +++ b/tests/data/test2083 @@ -21,7 +21,7 @@ ftp Pre-request callback for FTP -libprereq +lib2082 diff --git a/tests/data/test2084 b/tests/data/test2084 index ced7086c4b..00cbd67ccf 100644 --- a/tests/data/test2084 +++ b/tests/data/test2084 @@ -27,7 +27,7 @@ http Pre-request callback for HTTP with callback terminating transfer -libprereq +lib2082 diff --git a/tests/data/test2085 b/tests/data/test2085 index 665a756c0e..f229818a2d 100644 --- a/tests/data/test2085 +++ b/tests/data/test2085 @@ -35,7 +35,7 @@ http Pre-request callback for HTTP with location following -libprereq +lib2082 diff --git a/tests/data/test2086 b/tests/data/test2086 index c0dd97c55e..2dcafa75df 100644 --- a/tests/data/test2086 +++ b/tests/data/test2086 @@ -32,7 +32,7 @@ http-ipv6 Pre-request callback for HTTP IPv6 -libprereq +lib2082 diff --git a/tests/globalconfig.pm b/tests/globalconfig.pm index 5f7f413637..7aabd9d48d 100644 --- a/tests/globalconfig.pm +++ b/tests/globalconfig.pm @@ -71,7 +71,6 @@ BEGIN { %feature %keywords @protocols - $bundle $dev_null ); } @@ -141,6 +140,5 @@ our @protocols; # array of lowercase supported protocol servers 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; diff --git a/tests/http/clients/CMakeLists.txt b/tests/http/clients/CMakeLists.txt index f8a6a5face..7e4590ccff 100644 --- a/tests/http/clients/CMakeLists.txt +++ b/tests/http/clients/CMakeLists.txt @@ -24,7 +24,7 @@ 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") @@ -42,7 +42,6 @@ foreach(_target IN LISTS check_PROGRAMS) 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() diff --git a/tests/http/clients/Makefile.am b/tests/http/clients/Makefile.am index d1acb95da1..86a834e275 100644 --- a/tests/http/clients/Makefile.am +++ b/tests/http/clients/Makefile.am @@ -58,7 +58,7 @@ LDADD = $(LIBDIR)/libcurl.la @LIBCURL_PC_LIBS_PRIVATE@ # 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) diff --git a/tests/http/clients/Makefile.inc b/tests/http/clients/Makefile.inc index d0494a3904..f11d42944c 100644 --- a/tests/http/clients/Makefile.inc +++ b/tests/http/clients/Makefile.inc @@ -21,8 +21,8 @@ # 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 \ diff --git a/tests/libtest/.gitignore b/tests/libtest/.gitignore index 3c84193426..c78bdfd766 100644 --- a/tests/libtest/.gitignore +++ b/tests/libtest/.gitignore @@ -2,11 +2,6 @@ # # 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 diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt index e903379952..eb9188a521 100644 --- a/tests/libtest/CMakeLists.txt +++ b/tests/libtest/CMakeLists.txt @@ -22,8 +22,7 @@ # ########################################################################### -# 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") @@ -35,54 +34,29 @@ add_custom_command( "${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}") diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index 07980f8526..2d5329c7f4 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -40,27 +40,21 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ -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 = @@ -74,49 +68,38 @@ if CURLDEBUG 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 @@ -129,7 +112,7 @@ CS_ = $(CS_0) # 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 diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index 2357092451..41c9441d11 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -21,292 +21,73 @@ # 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 diff --git a/tests/libtest/first.c b/tests/libtest/first.c index a90c2d7f1e..3a201fb6de 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -21,9 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#include "test.h" -#include "first.h" - #ifdef HAVE_LOCALE_H # include /* for setlocale() */ #endif @@ -120,9 +117,10 @@ int main(int argc, char **argv) { 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); @@ -137,61 +135,38 @@ int main(int argc, char **argv) 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) @@ -201,7 +176,7 @@ int main(int argc, char **argv) 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 diff --git a/tests/libtest/first.h b/tests/libtest/first.h index acf00a3a89..5148616716 100644 --- a/tests/libtest/first.h +++ b/tests/libtest/first.h @@ -23,17 +23,13 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#define CURL_DISABLE_DEPRECATION 1 -#include "curl_setup.h" -#include +#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 */ diff --git a/tests/libtest/lib1156.c b/tests/libtest/lib1156.c index 1db7c7d867..5abd9016d8 100644 --- a/tests/libtest/lib1156.c +++ b/tests/libtest/lib1156.c @@ -131,7 +131,7 @@ test_cleanup: /* for debugging: */ /* #define SINGLETEST 9 */ -CURLcode test(char *URL) +static CURLcode test_lib1156(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib1301.c b/tests/libtest/lib1301.c index 0a6080e711..81baaeecb1 100644 --- a/tests/libtest/lib1301.c +++ b/tests/libtest/lib1301.c @@ -23,7 +23,7 @@ ***************************************************************************/ #include "curlcheck.h" -CURLcode test(char *URL) +static CURLcode test_lib1301(char *URL) { int rc; (void)URL; diff --git a/tests/libtest/lib1308.c b/tests/libtest/lib1308.c index 0c70f3d6bc..44620e1388 100644 --- a/tests/libtest/lib1308.c +++ b/tests/libtest/lib1308.c @@ -23,8 +23,6 @@ ***************************************************************************/ #include "curlcheck.h" -#include - static size_t print_httppost_callback(void *arg, const char *buf, size_t len) { fwrite(buf, len, 1, stdout); @@ -32,7 +30,7 @@ static size_t print_httppost_callback(void *arg, const char *buf, size_t len) return len; } -CURLcode test(char *URL) +static CURLcode test_lib1308(char *URL) { CURLFORMcode rc; int res; diff --git a/tests/libtest/lib1485.c b/tests/libtest/lib1485.c index c980dfb75c..9a8e7a297a 100644 --- a/tests/libtest/lib1485.c +++ b/tests/libtest/lib1485.c @@ -87,7 +87,7 @@ static size_t t1485_write_cb(char *ptr, size_t size, size_t nmemb, void *userp) return len; } -CURLcode test(char *URL) +static CURLcode test_lib1485(char *URL) { CURL *curls = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1500.c b/tests/libtest/lib1500.c index f72b2dd720..dc9e662399 100644 --- a/tests/libtest/lib1500.c +++ b/tests/libtest/lib1500.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1500(char *URL) { CURL *curls = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib1501.c b/tests/libtest/lib1501.c index 0644b83748..0afbda1cf5 100644 --- a/tests/libtest/lib1501.c +++ b/tests/libtest/lib1501.c @@ -32,12 +32,12 @@ #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; diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c index b118fd7786..38783802f2 100644 --- a/tests/libtest/lib1502.c +++ b/tests/libtest/lib1502.c @@ -37,7 +37,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1502(char *URL) { CURL *easy = NULL; CURL *dup; diff --git a/tests/libtest/lib1506.c b/tests/libtest/lib1506.c index 0a4507a211..f63156dc9a 100644 --- a/tests/libtest/lib1506.c +++ b/tests/libtest/lib1506.c @@ -27,13 +27,13 @@ #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; @@ -43,9 +43,9 @@ CURLcode test(char *URL) (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) { @@ -63,14 +63,14 @@ CURLcode test(char *URL) 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 */ @@ -83,7 +83,7 @@ CURLcode test(char *URL) 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]); @@ -121,7 +121,7 @@ test_cleanup: /* 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]); } diff --git a/tests/libtest/lib1507.c b/tests/libtest/lib1507.c index f2f25f057a..edbce6ca2b 100644 --- a/tests/libtest/lib1507.c +++ b/tests/libtest/lib1507.c @@ -36,8 +36,6 @@ #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; @@ -47,8 +45,10 @@ static size_t t1507_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) 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; diff --git a/tests/libtest/lib1508.c b/tests/libtest/lib1508.c index 5e8547bb8a..488242b56f 100644 --- a/tests/libtest/lib1508.c +++ b/tests/libtest/lib1508.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1508(char *URL) { CURLcode res = CURLE_OK; CURLM *m = NULL; diff --git a/tests/libtest/lib1509.c b/tests/libtest/lib1509.c index a289da56dc..ba74b2f59e 100644 --- a/tests/libtest/lib1509.c +++ b/tests/libtest/lib1509.c @@ -32,7 +32,7 @@ size_t WriteHeader(char *ptr, size_t size, size_t nmemb, void *stream); static unsigned long realHeaderSize = 0; -CURLcode test(char *URL) +static CURLcode test_lib1509(char *URL) { long headerSize; CURLcode code; diff --git a/tests/libtest/lib1510.c b/tests/libtest/lib1510.c index ec4c0baba3..14d75fec07 100644 --- a/tests/libtest/lib1510.c +++ b/tests/libtest/lib1510.c @@ -27,10 +27,10 @@ #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; diff --git a/tests/libtest/lib1511.c b/tests/libtest/lib1511.c index abc1356e5b..0402421fa6 100644 --- a/tests/libtest/lib1511.c +++ b/tests/libtest/lib1511.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1511(char *URL) { long unmet; CURL *curl = NULL; diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c index 763694837d..8bde4c9454 100644 --- a/tests/libtest/lib1512.c +++ b/tests/libtest/lib1512.c @@ -32,18 +32,15 @@ #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 */ @@ -57,14 +54,14 @@ CURLcode test(char *URL) 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 */ @@ -78,8 +75,8 @@ CURLcode test(char *URL) /* 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; diff --git a/tests/libtest/lib1513.c b/tests/libtest/lib1513.c index 9da57d967d..2ca54ec12b 100644 --- a/tests/libtest/lib1513.c +++ b/tests/libtest/lib1513.c @@ -47,7 +47,7 @@ static int progressKiller(void *arg, return 1; } -CURLcode test(char *URL) +static CURLcode test_lib1513(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1514.c b/tests/libtest/lib1514.c index 612fad8f4e..68cf384171 100644 --- a/tests/libtest/lib1514.c +++ b/tests/libtest/lib1514.c @@ -52,7 +52,7 @@ static size_t t1514_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; /* no more data left to deliver */ } -CURLcode test(char *URL) +static CURLcode test_lib1514(char *URL) { CURL *curl; CURLcode result = CURLE_OK; diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c index fda322e604..7d98cfe61c 100644 --- a/tests/libtest/lib1515.c +++ b/tests/libtest/lib1515.c @@ -101,7 +101,7 @@ test_cleanup: return res; } -CURLcode test(char *URL) +static CURLcode test_lib1515(char *URL) { CURLM *multi = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1517.c b/tests/libtest/lib1517.c index 7d9e39dc1d..214a76928b 100644 --- a/tests/libtest/lib1517.c +++ b/tests/libtest/lib1517.c @@ -51,7 +51,7 @@ static size_t t1517_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) 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"; diff --git a/tests/libtest/lib1518.c b/tests/libtest/lib1518.c index 7d8f593382..59a67d5bca 100644 --- a/tests/libtest/lib1518.c +++ b/tests/libtest/lib1518.c @@ -37,7 +37,7 @@ static size_t t1518_write_cb(char *buffer, size_t size, size_t nitems, return 0; } -CURLcode test(char *URL) +static CURLcode test_lib1518(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1520.c b/tests/libtest/lib1520.c index 9eb2840228..68b1ca8914 100644 --- a/tests/libtest/lib1520.c +++ b/tests/libtest/lib1520.c @@ -71,7 +71,7 @@ static size_t t1520_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib1520(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib1522.c b/tests/libtest/lib1522.c index 6d3b8d5ea9..5fe4283abc 100644 --- a/tests/libtest/lib1522.c +++ b/tests/libtest/lib1522.c @@ -47,7 +47,7 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd, return CURL_SOCKOPT_OK; } -CURLcode test(char *URL) +static CURLcode test_lib1522(char *URL) { static char g_Data[40 * 1024]; /* POST 40KB */ diff --git a/tests/libtest/lib1523.c b/tests/libtest/lib1523.c index e26db4d1ef..4003e9faf4 100644 --- a/tests/libtest/lib1523.c +++ b/tests/libtest/lib1523.c @@ -55,7 +55,7 @@ static CURLcode run(CURL *hnd, long limit, long time) return curl_easy_perform(hnd); } -CURLcode test(char *URL) +static CURLcode test_lib1523(char *URL) { CURLcode ret; CURL *hnd; diff --git a/tests/libtest/lib1525.c b/tests/libtest/lib1525.c index 7802293a5c..e015f3c11b 100644 --- a/tests/libtest/lib1525.c +++ b/tests/libtest/lib1525.c @@ -45,7 +45,7 @@ static size_t t1525_read_cb(char *ptr, size_t size, size_t nmemb, void *stream) return strlen(t1525_testdata); } -CURLcode test(char *URL) +static CURLcode test_lib1525(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_FAILED_INIT; diff --git a/tests/libtest/lib1526.c b/tests/libtest/lib1526.c index 487b2818fd..492eeb103c 100644 --- a/tests/libtest/lib1526.c +++ b/tests/libtest/lib1526.c @@ -44,7 +44,7 @@ static size_t t1526_read_cb(char *ptr, size_t size, size_t nmemb, void *stream) return strlen(t1526_testdata); } -CURLcode test(char *URL) +static CURLcode test_lib1526(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_FAILED_INIT; diff --git a/tests/libtest/lib1527.c b/tests/libtest/lib1527.c index cc7151058a..4f710e9932 100644 --- a/tests/libtest/lib1527.c +++ b/tests/libtest/lib1527.c @@ -44,7 +44,7 @@ static size_t t1527_read_cb(char *ptr, size_t size, size_t nmemb, void *stream) return strlen(t1527_testdata); } -CURLcode test(char *URL) +static CURLcode test_lib1527(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_FAILED_INIT; diff --git a/tests/libtest/lib1528.c b/tests/libtest/lib1528.c index 7cc21c7b09..1962749065 100644 --- a/tests/libtest/lib1528.c +++ b/tests/libtest/lib1528.c @@ -21,12 +21,11 @@ * 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; diff --git a/tests/libtest/lib1529.c b/tests/libtest/lib1529.c index fb11ab1652..bcb56da0e9 100644 --- a/tests/libtest/lib1529.c +++ b/tests/libtest/lib1529.c @@ -21,12 +21,11 @@ * 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; diff --git a/tests/libtest/lib1530.c b/tests/libtest/lib1530.c index bb725eea66..0c922eaf7f 100644 --- a/tests/libtest/lib1530.c +++ b/tests/libtest/lib1530.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "memdebug.h" @@ -37,7 +36,7 @@ static curl_socket_t opensocket(void *clientp, return CURL_SOCKET_BAD; } -CURLcode test(char *URL) +static CURLcode test_lib1530(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_FAILED_INIT; diff --git a/tests/libtest/lib1531.c b/tests/libtest/lib1531.c index a33b9c4093..e3096d1504 100644 --- a/tests/libtest/lib1531.c +++ b/tests/libtest/lib1531.c @@ -28,7 +28,7 @@ #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; diff --git a/tests/libtest/lib1532.c b/tests/libtest/lib1532.c index c9fd4e66bc..34e27a5a9a 100644 --- a/tests/libtest/lib1532.c +++ b/tests/libtest/lib1532.c @@ -27,7 +27,7 @@ /* Test CURLINFO_RESPONSE_CODE */ -CURLcode test(char *URL) +static CURLcode test_lib1532(char *URL) { CURL *curl; long httpcode; diff --git a/tests/libtest/lib1533.c b/tests/libtest/lib1533.c index 620405f04c..9dc869d79f 100644 --- a/tests/libtest/lib1533.c +++ b/tests/libtest/lib1533.c @@ -123,7 +123,7 @@ static CURLcode perform_and_check_connections(CURL *curl, } -CURLcode test(char *URL) +static CURLcode test_lib1533(char *URL) { struct cb_data data; CURL *curl = NULL; diff --git a/tests/libtest/lib1534.c b/tests/libtest/lib1534.c index 467691c032..e0dbee1022 100644 --- a/tests/libtest/lib1534.c +++ b/tests/libtest/lib1534.c @@ -27,7 +27,7 @@ /* Test CURLINFO_FILETIME */ -CURLcode test(char *URL) +static CURLcode test_lib1534(char *URL) { CURL *curl, *dupe = NULL; long filetime; @@ -110,7 +110,6 @@ CURLcode test(char *URL) goto test_cleanup; } - /* Test that a filetime is properly initialized on curl_easy_reset. */ diff --git a/tests/libtest/lib1535.c b/tests/libtest/lib1535.c index f999427fd6..b142882dbd 100644 --- a/tests/libtest/lib1535.c +++ b/tests/libtest/lib1535.c @@ -27,7 +27,7 @@ /* Test CURLINFO_PROTOCOL */ -CURLcode test(char *URL) +static CURLcode test_lib1535(char *URL) { CURL *curl, *dupe = NULL; long protocol; @@ -113,7 +113,6 @@ CURLcode test(char *URL) goto test_cleanup; } - /* Test that a protocol is properly initialized on curl_easy_reset. */ diff --git a/tests/libtest/lib1536.c b/tests/libtest/lib1536.c index fea7e1acf6..23ed716ac2 100644 --- a/tests/libtest/lib1536.c +++ b/tests/libtest/lib1536.c @@ -27,7 +27,7 @@ /* Test CURLINFO_SCHEME */ -CURLcode test(char *URL) +static CURLcode test_lib1536(char *URL) { CURL *curl, *dupe = NULL; char *scheme; @@ -109,7 +109,6 @@ CURLcode test(char *URL) goto test_cleanup; } - /* Test that a scheme is properly initialized on curl_easy_reset. */ diff --git a/tests/libtest/lib1537.c b/tests/libtest/lib1537.c index 88f99bc60e..547f9ef7f2 100644 --- a/tests/libtest/lib1537.c +++ b/tests/libtest/lib1537.c @@ -25,7 +25,7 @@ #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}; diff --git a/tests/libtest/lib1538.c b/tests/libtest/lib1538.c index e5dcec1f49..e00bf94375 100644 --- a/tests/libtest/lib1538.c +++ b/tests/libtest/lib1538.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1538(char *URL) { CURLcode res = CURLE_OK; CURLcode easyret; diff --git a/tests/libtest/lib1540.c b/tests/libtest/lib1540.c index 35e905c1d9..ac3271334f 100644 --- a/tests/libtest/lib1540.c +++ b/tests/libtest/lib1540.c @@ -83,7 +83,7 @@ static size_t t1540_write_cb(char *ptr, size_t size, size_t nmemb, void *userp) return CURL_WRITEFUNC_PAUSE; } -CURLcode test(char *URL) +static CURLcode test_lib1540(char *URL) { CURL *curls = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1541.c b/tests/libtest/lib1541.c index a228da2867..762b581454 100644 --- a/tests/libtest/lib1541.c +++ b/tests/libtest/lib1541.c @@ -110,7 +110,7 @@ static size_t t1541_write_cb(char *ptr, size_t size, size_t nmemb, void *userp) return size * nmemb; } -CURLcode test(char *URL) +static CURLcode test_lib1541(char *URL) { CURL *curls = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1542.c b/tests/libtest/lib1542.c index 5a8926585d..32ee236d95 100644 --- a/tests/libtest/lib1542.c +++ b/tests/libtest/lib1542.c @@ -36,7 +36,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1542(char *URL) { CURL *easy = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1545.c b/tests/libtest/lib1545.c index d2709987e7..b485ab3f9d 100644 --- a/tests/libtest/lib1545.c +++ b/tests/libtest/lib1545.c @@ -23,7 +23,7 @@ ***************************************************************************/ #include "test.h" -CURLcode test(char *URL) +static CURLcode test_lib1545(char *URL) { CURL *eh = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1550.c b/tests/libtest/lib1550.c index ddc0c16ab5..994623d71a 100644 --- a/tests/libtest/lib1550.c +++ b/tests/libtest/lib1550.c @@ -27,7 +27,7 @@ #include -CURLcode test(char *URL) +static CURLcode test_lib1550(char *URL) { CURLM *handle; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1551.c b/tests/libtest/lib1551.c index 77834655ad..253eb2626c 100644 --- a/tests/libtest/lib1551.c +++ b/tests/libtest/lib1551.c @@ -27,7 +27,7 @@ #include -CURLcode test(char *URL) +static CURLcode test_lib1551(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1552.c b/tests/libtest/lib1552.c index eef9703886..86fccf270e 100644 --- a/tests/libtest/lib1552.c +++ b/tests/libtest/lib1552.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1552(char *URL) { CURL *curls = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib1553.c b/tests/libtest/lib1553.c index e20f18831f..409835ac41 100644 --- a/tests/libtest/lib1553.c +++ b/tests/libtest/lib1553.c @@ -41,7 +41,7 @@ static int t1553_xferinfo(void *p, return 1; /* fail as fast as we can */ } -CURLcode test(char *URL) +static CURLcode test_lib1553(char *URL) { CURL *curls = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib1554.c b/tests/libtest/lib1554.c index b33d03d9c0..825c52971d 100644 --- a/tests/libtest/lib1554.c +++ b/tests/libtest/lib1554.c @@ -55,7 +55,7 @@ static void t1554_test_unlock(CURL *handle, curl_lock_data data, void *useptr) } /* test function */ -CURLcode test(char *URL) +static CURLcode test_lib1554(char *URL) { CURLcode res = CURLE_OK; CURLSH *share = NULL; diff --git a/tests/libtest/lib1555.c b/tests/libtest/lib1555.c index f66b89c89e..02db62e5b5 100644 --- a/tests/libtest/lib1555.c +++ b/tests/libtest/lib1555.c @@ -53,7 +53,7 @@ static int progressCallback(void *arg, return 1; } -CURLcode test(char *URL) +static CURLcode test_lib1555(char *URL) { CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1556.c b/tests/libtest/lib1556.c index 6bbf353e1e..ff7e1ea778 100644 --- a/tests/libtest/lib1556.c +++ b/tests/libtest/lib1556.c @@ -44,7 +44,7 @@ static size_t header(char *ptr, size_t size, size_t nmemb, void *stream) return nmemb * size; } -CURLcode test(char *URL) +static CURLcode test_lib1556(char *URL) { CURLcode code; CURL *curl = NULL; diff --git a/tests/libtest/lib1557.c b/tests/libtest/lib1557.c index 6f0b99ac50..9df49fd94f 100644 --- a/tests/libtest/lib1557.c +++ b/tests/libtest/lib1557.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1557(char *URL) { CURLM *curlm = NULL; CURL *curl1 = NULL; diff --git a/tests/libtest/lib1558.c b/tests/libtest/lib1558.c index 9bb18caf8e..8fa38abd0d 100644 --- a/tests/libtest/lib1558.c +++ b/tests/libtest/lib1558.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1558(char *URL) { CURLcode res = CURLE_OK; CURL *curl = NULL; diff --git a/tests/libtest/lib1559.c b/tests/libtest/lib1559.c index 19448afd8f..71d430f00f 100644 --- a/tests/libtest/lib1559.c +++ b/tests/libtest/lib1559.c @@ -27,9 +27,10 @@ #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; diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index af75b89ea8..f436cc15b5 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -39,12 +39,6 @@ #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) { @@ -53,6 +47,12 @@ static int checkparts(CURLU *u, const char *in, const char *wanted, 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"}, @@ -1839,7 +1839,7 @@ static int get_nothing(void) 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); } @@ -2018,7 +2018,7 @@ err: return 1; } -CURLcode test(char *URL) +static CURLcode test_lib1560(char *URL) { (void)URL; /* not used */ diff --git a/tests/libtest/lib1564.c b/tests/libtest/lib1564.c index 08a76d74f7..822bca54cc 100644 --- a/tests/libtest/lib1564.c +++ b/tests/libtest/lib1564.c @@ -29,7 +29,7 @@ #define WAKEUP_NUM 10 -CURLcode test(char *URL) +static CURLcode test_lib1564(char *URL) { CURLM *multi = NULL; int numfds; diff --git a/tests/libtest/lib1565.c b/tests/libtest/lib1565.c index 992a3dead5..b03b17dec0 100644 --- a/tests/libtest/lib1565.c +++ b/tests/libtest/lib1565.c @@ -40,7 +40,7 @@ static int pending_num = 0; 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) { @@ -55,7 +55,7 @@ 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); @@ -88,7 +88,7 @@ test_cleanup: return NULL; } -CURLcode test(char *URL) +static CURLcode test_lib1565(char *URL) { int still_running; int num; @@ -108,7 +108,7 @@ CURLcode test(char *URL) multi_init(testmulti); - url = URL; + t1565_url = URL; result = pthread_create(&tid, NULL, t1565_run_thread, NULL); if(!result) @@ -202,7 +202,7 @@ test_cleanup: } #else /* without pthread, this test doesn't work */ -CURLcode test(char *URL) +static CURLcode test_lib1565(char *URL) { (void)URL; return CURLE_OK; diff --git a/tests/libtest/lib1567.c b/tests/libtest/lib1567.c index d1de1637a0..e519cd167d 100644 --- a/tests/libtest/lib1567.c +++ b/tests/libtest/lib1567.c @@ -27,7 +27,7 @@ #include -CURLcode test(char *URL) +static CURLcode test_lib1567(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1568.c b/tests/libtest/lib1568.c index 383d517a47..b9c873cf44 100644 --- a/tests/libtest/lib1568.c +++ b/tests/libtest/lib1568.c @@ -26,7 +26,7 @@ #include "testtrace.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1568(char *URL) { CURLcode ret; CURL *hnd; diff --git a/tests/libtest/lib1569.c b/tests/libtest/lib1569.c index 767d881682..3671afbad6 100644 --- a/tests/libtest/lib1569.c +++ b/tests/libtest/lib1569.c @@ -26,7 +26,7 @@ #include "testtrace.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1569(char *URL) { CURLcode res = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib1571.c b/tests/libtest/lib1571.c index faf178a6fb..77a89f79fc 100644 --- a/tests/libtest/lib1571.c +++ b/tests/libtest/lib1571.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1571(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib1576.c b/tests/libtest/lib1576.c index df34a9a205..de87a25dc9 100644 --- a/tests/libtest/lib1576.c +++ b/tests/libtest/lib1576.c @@ -47,7 +47,7 @@ static int t1576_seek_callback(void *ptr, curl_off_t offset, int origin) return CURL_SEEKFUNC_OK; } -CURLcode test(char *URL) +static CURLcode test_lib1576(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib1591.c b/tests/libtest/lib1591.c index ae341aae59..bdbe26dd97 100644 --- a/tests/libtest/lib1591.c +++ b/tests/libtest/lib1591.c @@ -74,7 +74,7 @@ static int t1591_trailers_callback(struct curl_slist **list, void *userdata) } } -CURLcode test(char *URL) +static CURLcode test_lib1591(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_FAILED_INIT; @@ -86,7 +86,6 @@ CURLcode test(char *URL) return TEST_ERR_MAJOR_BAD; } - curl = curl_easy_init(); if(!curl) { curl_mfprintf(stderr, "curl_easy_init() failed\n"); diff --git a/tests/libtest/lib1592.c b/tests/libtest/lib1592.c index efb4254070..3940233983 100644 --- a/tests/libtest/lib1592.c +++ b/tests/libtest/lib1592.c @@ -41,7 +41,7 @@ #include -CURLcode test(char *URL) +static CURLcode test_lib1592(char *URL) { int stillRunning; CURLM *multiHandle = NULL; diff --git a/tests/libtest/lib1593.c b/tests/libtest/lib1593.c index f5239fda4b..e723fed620 100644 --- a/tests/libtest/lib1593.c +++ b/tests/libtest/lib1593.c @@ -28,7 +28,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1593(char *URL) { struct curl_slist *header = NULL; long unmet; diff --git a/tests/libtest/lib1594.c b/tests/libtest/lib1594.c index 8b469e6105..152a585569 100644 --- a/tests/libtest/lib1594.c +++ b/tests/libtest/lib1594.c @@ -28,7 +28,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1594(char *URL) { struct curl_slist *header = NULL; curl_off_t retry; diff --git a/tests/libtest/lib1597.c b/tests/libtest/lib1597.c index f183d3e428..02779887d3 100644 --- a/tests/libtest/lib1597.c +++ b/tests/libtest/lib1597.c @@ -33,7 +33,7 @@ struct pair { CURLcode *exp; }; -CURLcode test(char *URL) +static CURLcode test_lib1597(char *URL) { CURL *curl = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1598.c b/tests/libtest/lib1598.c index aba94129c9..d636fa4d34 100644 --- a/tests/libtest/lib1598.c +++ b/tests/libtest/lib1598.c @@ -52,7 +52,7 @@ static int t1598_trailers_callback(struct curl_slist **list, void *userdata) } } -CURLcode test(char *URL) +static CURLcode test_lib1598(char *URL) { static const char *post_data = "xxx=yyy&aaa=bbbbb"; @@ -66,7 +66,6 @@ CURLcode test(char *URL) return TEST_ERR_MAJOR_BAD; } - curl = curl_easy_init(); if(!curl) { curl_mfprintf(stderr, "curl_easy_init() failed\n"); diff --git a/tests/libtest/lib1662.c b/tests/libtest/lib1662.c index 6d70de4035..ba389e0b95 100644 --- a/tests/libtest/lib1662.c +++ b/tests/libtest/lib1662.c @@ -46,7 +46,7 @@ static size_t t1662_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; /* no more data left to deliver */ } -CURLcode test(char *URL) +static CURLcode test_lib1662(char *URL) { CURLcode res = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib1900.c b/tests/libtest/lib1900.c index 1b26e7b986..6a1d6343fd 100644 --- a/tests/libtest/lib1900.c +++ b/tests/libtest/lib1900.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1900(char *URL) { CURLcode res = CURLE_OK; CURL *hnd = NULL; diff --git a/tests/libtest/lib1901.c b/tests/libtest/lib1901.c index 0ae6bc5ded..5aee9d3cf7 100644 --- a/tests/libtest/lib1901.c +++ b/tests/libtest/lib1901.c @@ -49,7 +49,7 @@ static size_t t1901_read_cb(char *ptr, size_t size, size_t nmemb, void *stream) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib1901(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1903.c b/tests/libtest/lib1903.c index 0ffbb14adc..edd2a09619 100644 --- a/tests/libtest/lib1903.c +++ b/tests/libtest/lib1903.c @@ -28,7 +28,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1903(char *URL) { CURLcode res = CURLE_OK; CURL *ch = NULL; diff --git a/tests/libtest/lib1905.c b/tests/libtest/lib1905.c index df35de18b2..e7fbc366d0 100644 --- a/tests/libtest/lib1905.c +++ b/tests/libtest/lib1905.c @@ -28,7 +28,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1905(char *URL) { CURLSH *sh = NULL; CURL *ch = NULL; diff --git a/tests/libtest/lib1906.c b/tests/libtest/lib1906.c index 61996e2595..e49d9bf304 100644 --- a/tests/libtest/lib1906.c +++ b/tests/libtest/lib1906.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1906(char *URL) { CURLcode res = CURLE_OK; char *url_after = NULL; diff --git a/tests/libtest/lib1907.c b/tests/libtest/lib1907.c index 2cda08e02c..f1d33c6ca6 100644 --- a/tests/libtest/lib1907.c +++ b/tests/libtest/lib1907.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1907(char *URL) { char *url_after; CURL *curl; diff --git a/tests/libtest/lib1908.c b/tests/libtest/lib1908.c index 3c7187c5bc..e5f743adea 100644 --- a/tests/libtest/lib1908.c +++ b/tests/libtest/lib1908.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1908(char *URL) { CURLcode ret = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib1910.c b/tests/libtest/lib1910.c index 9d3f1b3ab0..c22244b6be 100644 --- a/tests/libtest/lib1910.c +++ b/tests/libtest/lib1910.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1910(char *URL) { CURLcode ret = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib1911.c b/tests/libtest/lib1911.c index 3621040ec8..f6c3926be5 100644 --- a/tests/libtest/lib1911.c +++ b/tests/libtest/lib1911.c @@ -31,7 +31,7 @@ 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]; diff --git a/tests/libtest/lib1912.c b/tests/libtest/lib1912.c index 7aa2bb9ade..70edc95a7a 100644 --- a/tests/libtest/lib1912.c +++ b/tests/libtest/lib1912.c @@ -31,7 +31,7 @@ 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; diff --git a/tests/libtest/lib1913.c b/tests/libtest/lib1913.c index 8468420057..637f667d65 100644 --- a/tests/libtest/lib1913.c +++ b/tests/libtest/lib1913.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1913(char *URL) { CURLcode ret = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib1915.c b/tests/libtest/lib1915.c index 4fd0354059..ec38eeabca 100644 --- a/tests/libtest/lib1915.c +++ b/tests/libtest/lib1915.c @@ -97,7 +97,7 @@ static CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *e, * Read/write HSTS cache entries via callback. */ -CURLcode test(char *URL) +static CURLcode test_lib1915(char *URL) { CURLcode res = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib1916.c b/tests/libtest/lib1916.c index ca9bdea34b..c15db63315 100644 --- a/tests/libtest/lib1916.c +++ b/tests/libtest/lib1916.c @@ -26,7 +26,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1916(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1918.c b/tests/libtest/lib1918.c index 359c64e472..e50ac8ed01 100644 --- a/tests/libtest/lib1918.c +++ b/tests/libtest/lib1918.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1918(char *URL) { const struct curl_easyoption *o; (void)URL; diff --git a/tests/libtest/lib1919.c b/tests/libtest/lib1919.c index 68ce7a194b..faf172af37 100644 --- a/tests/libtest/lib1919.c +++ b/tests/libtest/lib1919.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1919(char *URL) { CURLcode res = CURLE_OK; CURL *curl; diff --git a/tests/libtest/lib1933.c b/tests/libtest/lib1933.c index e5d2af5bf6..6cb4509d7c 100644 --- a/tests/libtest/lib1933.c +++ b/tests/libtest/lib1933.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1933(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1934.c b/tests/libtest/lib1934.c index 92c442af46..7f10aa505c 100644 --- a/tests/libtest/lib1934.c +++ b/tests/libtest/lib1934.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1934(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1935.c b/tests/libtest/lib1935.c index 7efdeac219..b515ed205e 100644 --- a/tests/libtest/lib1935.c +++ b/tests/libtest/lib1935.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1935(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1936.c b/tests/libtest/lib1936.c index 83124840b6..327fa9f2be 100644 --- a/tests/libtest/lib1936.c +++ b/tests/libtest/lib1936.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1936(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1937.c b/tests/libtest/lib1937.c index 1d1e093da7..acfb5eb4e9 100644 --- a/tests/libtest/lib1937.c +++ b/tests/libtest/lib1937.c @@ -21,12 +21,11 @@ * 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; diff --git a/tests/libtest/lib1938.c b/tests/libtest/lib1938.c index 7084d95c03..a5e9e7f73a 100644 --- a/tests/libtest/lib1938.c +++ b/tests/libtest/lib1938.c @@ -21,12 +21,11 @@ * 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; diff --git a/tests/libtest/lib1939.c b/tests/libtest/lib1939.c index 680b5c2363..260da18110 100644 --- a/tests/libtest/lib1939.c +++ b/tests/libtest/lib1939.c @@ -21,12 +21,11 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1939(char *URL) { CURLM *multi; CURL *easy; diff --git a/tests/libtest/lib1940.c b/tests/libtest/lib1940.c index a7b8f5b168..03cdc9d546 100644 --- a/tests/libtest/lib1940.c +++ b/tests/libtest/lib1940.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "memdebug.h" @@ -78,7 +77,7 @@ static void t1940_showem(CURL *easy, int header_request, unsigned int type) } } -CURLcode test(char *URL) +static CURLcode test_lib1940(char *URL) { CURL *easy = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1945.c b/tests/libtest/lib1945.c index 8bb87a28d7..ff2e670cf9 100644 --- a/tests/libtest/lib1945.c +++ b/tests/libtest/lib1945.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "memdebug.h" @@ -46,7 +45,8 @@ static size_t t1945_write_cb(char *data, size_t n, size_t l, void *userp) (void)userp; return n*l; } -CURLcode test(char *URL) + +static CURLcode test_lib1945(char *URL) { CURL *easy; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1947.c b/tests/libtest/lib1947.c index 9d9559a142..5dc305343e 100644 --- a/tests/libtest/lib1947.c +++ b/tests/libtest/lib1947.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "memdebug.h" @@ -33,7 +32,8 @@ static size_t t1947_write_cb(char *data, size_t n, size_t l, void *userp) (void)userp; return n*l; } -CURLcode test(char *URL) + +static CURLcode test_lib1947(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1948.c b/tests/libtest/lib1948.c index 766b1ecd55..10e762d8d0 100644 --- a/tests/libtest/lib1948.c +++ b/tests/libtest/lib1948.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" typedef struct @@ -41,7 +40,7 @@ static size_t put_callback(char *ptr, size_t size, size_t nmemb, void *stream) return tocopy; } -CURLcode test(char *URL) +static CURLcode test_lib1948(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1955.c b/tests/libtest/lib1955.c index ff496f7a62..aef6015ccd 100644 --- a/tests/libtest/lib1955.c +++ b/tests/libtest/lib1955.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1955(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1956.c b/tests/libtest/lib1956.c index 9140278584..c1063fefe1 100644 --- a/tests/libtest/lib1956.c +++ b/tests/libtest/lib1956.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1956(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1957.c b/tests/libtest/lib1957.c index 37e3032266..c6ca327de5 100644 --- a/tests/libtest/lib1957.c +++ b/tests/libtest/lib1957.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1957(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1958.c b/tests/libtest/lib1958.c index a276b734ef..8073e3e85e 100644 --- a/tests/libtest/lib1958.c +++ b/tests/libtest/lib1958.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1958(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1959.c b/tests/libtest/lib1959.c index cddefbb095..f5db0e5c65 100644 --- a/tests/libtest/lib1959.c +++ b/tests/libtest/lib1959.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1959(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1960.c b/tests/libtest/lib1960.c index 509515e3cd..7b6a72df25 100644 --- a/tests/libtest/lib1960.c +++ b/tests/libtest/lib1960.c @@ -75,7 +75,7 @@ static int sockopt_cb(void *clientp, /* Expected args: URL IP PORT */ -CURLcode test(char *URL) +static CURLcode test_lib1960(char *URL) { CURL *curl = NULL; CURLcode res = TEST_ERR_MAJOR_BAD; @@ -147,7 +147,7 @@ test_cleanup: return res; } #else -CURLcode test(char *URL) +static CURLcode test_lib1960(char *URL) { (void)URL; curl_mprintf("lacks inet_pton\n"); diff --git a/tests/libtest/lib1964.c b/tests/libtest/lib1964.c index ab8cbd750f..f0adaf0b96 100644 --- a/tests/libtest/lib1964.c +++ b/tests/libtest/lib1964.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1964(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib1970.c b/tests/libtest/lib1970.c index 3131f9d303..f7834958aa 100644 --- a/tests/libtest/lib1970.c +++ b/tests/libtest/lib1970.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1970(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1971.c b/tests/libtest/lib1971.c index 4bbdc207ae..6bbac57581 100644 --- a/tests/libtest/lib1971.c +++ b/tests/libtest/lib1971.c @@ -34,7 +34,7 @@ static size_t t1971_read_cb(char *ptr, size_t size, size_t nitems, void *userp) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib1971(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1972.c b/tests/libtest/lib1972.c index d711e9b3a5..65a581d611 100644 --- a/tests/libtest/lib1972.c +++ b/tests/libtest/lib1972.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1972(char *URL) { CURL *curl; curl_mime *mime = NULL; diff --git a/tests/libtest/lib1973.c b/tests/libtest/lib1973.c index d4b5155c47..b2a4a7f7ed 100644 --- a/tests/libtest/lib1973.c +++ b/tests/libtest/lib1973.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1973(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1974.c b/tests/libtest/lib1974.c index 0cf9626103..75a92a2915 100644 --- a/tests/libtest/lib1974.c +++ b/tests/libtest/lib1974.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1974(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1975.c b/tests/libtest/lib1975.c index ade53bc477..f7dc16e170 100644 --- a/tests/libtest/lib1975.c +++ b/tests/libtest/lib1975.c @@ -34,7 +34,7 @@ static size_t t1975_read_cb(char *ptr, size_t size, size_t nitems, void *userp) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib1975(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1977.c b/tests/libtest/lib1977.c index 5f030f493e..3c5fc7eada 100644 --- a/tests/libtest/lib1977.c +++ b/tests/libtest/lib1977.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1977(char *URL) { CURLcode res = CURLE_OK; CURLU *curlu = curl_url(); diff --git a/tests/libtest/lib1978.c b/tests/libtest/lib1978.c index 2647019b89..7fdd11e262 100644 --- a/tests/libtest/lib1978.c +++ b/tests/libtest/lib1978.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib1978(char *URL) { CURL *curl; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/libauthretry.c b/tests/libtest/lib2023.c similarity index 89% rename from tests/libtest/libauthretry.c rename to tests/libtest/lib2023.c index 6481844699..2ad7f694db 100644 --- a/tests/libtest/libauthretry.c +++ b/tests/libtest/lib2023.c @@ -42,7 +42,7 @@ static CURLcode send_request(CURL *curl, const char *url, int seq, 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); @@ -82,7 +82,7 @@ static long parse_auth_name(const char *arg) return CURLAUTH_NONE; } -CURLcode test(char *url) +static CURLcode test_lib2023(char *URL) /* libauthretry */ { CURLcode res; CURL *curl = NULL; @@ -110,11 +110,11 @@ CURLcode test(char *url) 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; @@ -128,15 +128,15 @@ CURLcode test(char *url) 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; diff --git a/tests/libtest/libntlmconnect.c b/tests/libtest/lib2032.c similarity index 92% rename from tests/libtest/libntlmconnect.c rename to tests/libtest/lib2032.c index 4586a51896..61c191afaf 100644 --- a/tests/libtest/libntlmconnect.c +++ b/tests/libtest/lib2032.c @@ -53,8 +53,8 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data) 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; } @@ -73,7 +73,7 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data) /* 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; } @@ -81,21 +81,21 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data) 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(); @@ -132,11 +132,11 @@ CURLcode test(char *url) 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); @@ -159,7 +159,7 @@ CURLcode test(char *url) 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(); diff --git a/tests/libtest/libprereq.c b/tests/libtest/lib2082.c similarity index 98% rename from tests/libtest/libprereq.c rename to tests/libtest/lib2082.c index 76164199e3..cb4af87ca6 100644 --- a/tests/libtest/libprereq.c +++ b/tests/libtest/lib2082.c @@ -51,7 +51,7 @@ static int prereq_callback(void *clientp, return prereq_cb->prereq_retcode; } -CURLcode test(char *URL) +static CURLcode test_lib2082(char *URL) /* libprereq */ { PRCS prereq_cb; CURLcode ret = CURLE_OK; diff --git a/tests/libtest/lib2301.c b/tests/libtest/lib2301.c index 8603f31414..da3f0e5331 100644 --- a/tests/libtest/lib2301.c +++ b/tests/libtest/lib2301.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #ifndef CURL_DISABLE_WEBSOCKETS @@ -119,9 +118,11 @@ static size_t t2301_write_cb(char *b, size_t size, size_t nitems, void *p) 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; @@ -148,8 +149,7 @@ CURLcode test(char *URL) } curl_global_cleanup(); return res; -} - -#else /* no WebSockets */ -NO_SUPPORT_BUILT_IN +#else + NO_SUPPORT_BUILT_IN #endif +} diff --git a/tests/libtest/lib2302.c b/tests/libtest/lib2302.c index 010e3b0911..9e302fdb8f 100644 --- a/tests/libtest/lib2302.c +++ b/tests/libtest/lib2302.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #ifndef CURL_DISABLE_WEBSOCKETS @@ -77,7 +76,6 @@ static size_t add_data(struct ws_data *wd, const char *buf, size_t blen, return blen; } - static size_t t2302_write_cb(char *buffer, size_t size, size_t nitems, void *p) { struct ws_data *ws_data = p; @@ -92,9 +90,11 @@ static size_t t2302_write_cb(char *buffer, size_t size, size_t nitems, void *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; @@ -124,8 +124,7 @@ CURLcode test(char *URL) } curl_global_cleanup(); return res; -} - #else -NO_SUPPORT_BUILT_IN + NO_SUPPORT_BUILT_IN #endif +} diff --git a/tests/libtest/lib2304.c b/tests/libtest/lib2304.c index 9c2828ca84..f3091ee1a3 100644 --- a/tests/libtest/lib2304.c +++ b/tests/libtest/lib2304.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #ifndef CURL_DISABLE_WEBSOCKETS @@ -109,9 +108,11 @@ static void t2304_websocket(CURL *curl) } 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; @@ -135,8 +136,7 @@ CURLcode test(char *URL) } curl_global_cleanup(); return res; -} - #else -NO_SUPPORT_BUILT_IN + NO_SUPPORT_BUILT_IN #endif +} diff --git a/tests/libtest/lib2306.c b/tests/libtest/lib2306.c index cde7519331..6dcd982924 100644 --- a/tests/libtest/lib2306.c +++ b/tests/libtest/lib2306.c @@ -21,15 +21,10 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "testtrace.h" -#include - -#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; @@ -45,7 +40,7 @@ CURLcode test(char *URL) 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: diff --git a/tests/libtest/lib2308.c b/tests/libtest/lib2308.c index 68f1357d3f..b91feef3a5 100644 --- a/tests/libtest/lib2308.c +++ b/tests/libtest/lib2308.c @@ -21,12 +21,9 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "testtrace.h" -#include - static size_t cb_curl(char *buffer, size_t size, size_t nmemb, void *userp) { (void)buffer; @@ -36,7 +33,7 @@ static size_t cb_curl(char *buffer, size_t size, size_t nmemb, void *userp) return CURL_WRITEFUNC_ERROR; } -CURLcode test(char *URL) +static CURLcode test_lib2308(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib2309.c b/tests/libtest/lib2309.c index 23519c29c6..8858961569 100644 --- a/tests/libtest/lib2309.c +++ b/tests/libtest/lib2309.c @@ -21,12 +21,9 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "testtrace.h" -#include - static size_t cb_ignore(char *buffer, size_t size, size_t nmemb, void *userp) { (void)buffer; @@ -36,7 +33,7 @@ static size_t cb_ignore(char *buffer, size_t size, size_t nmemb, void *userp) return CURL_WRITEFUNC_ERROR; } -CURLcode test(char *URL) +static CURLcode test_lib2309(char *URL) { CURL *curl; CURL *curldupe; diff --git a/tests/libtest/lib2402.c b/tests/libtest/lib2402.c index 808b966290..be761793b8 100644 --- a/tests/libtest/lib2402.c +++ b/tests/libtest/lib2402.c @@ -27,13 +27,13 @@ #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; @@ -59,14 +59,14 @@ CURLcode test(char *URL) 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 */ @@ -86,7 +86,7 @@ CURLcode test(char *URL) 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]); @@ -124,7 +124,7 @@ test_cleanup: /* 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]); } diff --git a/tests/libtest/lib2404.c b/tests/libtest/lib2404.c index 5876f76675..2737a267ba 100644 --- a/tests/libtest/lib2404.c +++ b/tests/libtest/lib2404.c @@ -27,13 +27,13 @@ #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; @@ -59,14 +59,14 @@ CURLcode test(char *URL) 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 */ @@ -83,12 +83,12 @@ CURLcode test(char *URL) 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]); @@ -126,7 +126,7 @@ test_cleanup: /* 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]); } diff --git a/tests/libtest/lib2405.c b/tests/libtest/lib2405.c index 3d6919e298..c2a8ccd41b 100644 --- a/tests/libtest/lib2405.c +++ b/tests/libtest/lib2405.c @@ -43,8 +43,7 @@ #include "warnless.h" #include "memdebug.h" - - /* ---------------------------------------------------------------- */ +/* ---------------------------------------------------------------- */ #define test_check(expected_fds) \ if(res != CURLE_OK) { \ @@ -63,7 +62,7 @@ test_check(expected_fds); \ } while(0) - /* ---------------------------------------------------------------- */ +/* ---------------------------------------------------------------- */ enum { TEST_USE_HTTP1 = 0, @@ -370,7 +369,7 @@ test_cleanup: return res; } -CURLcode test(char *URL) +static CURLcode test_lib2405(char *URL) { CURLcode res = CURLE_OK; unsigned int fd_count = 0; diff --git a/tests/libtest/lib2502.c b/tests/libtest/lib2502.c index 99cb8ed37a..2047e4753f 100644 --- a/tests/libtest/lib2502.c +++ b/tests/libtest/lib2502.c @@ -28,13 +28,13 @@ #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; @@ -60,14 +60,14 @@ CURLcode test(char *URL) 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 */ @@ -90,7 +90,7 @@ CURLcode test(char *URL) 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]); @@ -128,7 +128,7 @@ test_cleanup: /* 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]); } diff --git a/tests/libtest/lib2700.c b/tests/libtest/lib2700.c index ecec6809c9..53f271a17f 100644 --- a/tests/libtest/lib2700.c +++ b/tests/libtest/lib2700.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "testtrace.h" #include "memdebug.h" @@ -207,9 +206,11 @@ static CURLcode recv_frame(CURL *curl, bool *stop) 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; @@ -247,8 +248,7 @@ test_cleanup: curl_easy_cleanup(curl); curl_global_cleanup(); return res; -} - #else -NO_SUPPORT_BUILT_IN + NO_SUPPORT_BUILT_IN #endif +} diff --git a/tests/libtest/lib3010.c b/tests/libtest/lib3010.c index dbeb3223d1..6bc6678c0c 100644 --- a/tests/libtest/lib3010.c +++ b/tests/libtest/lib3010.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3010(char *URL) { CURLcode ret = CURLE_OK; CURL *curl = NULL; diff --git a/tests/libtest/lib3025.c b/tests/libtest/lib3025.c index 41929500bc..37f1d9e860 100644 --- a/tests/libtest/lib3025.c +++ b/tests/libtest/lib3025.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3025(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib3026.c b/tests/libtest/lib3026.c index 28580e9956..a5b442936d 100644 --- a/tests/libtest/lib3026.c +++ b/tests/libtest/lib3026.c @@ -45,7 +45,7 @@ static unsigned int WINAPI t3026_run_thread(void *ptr) 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; @@ -115,7 +115,7 @@ static void *t3026_run_thread(void *ptr) return NULL; } -CURLcode test(char *URL) +static CURLcode test_lib3026(char *URL) { CURLcode results[NUM_THREADS]; pthread_t tids[NUM_THREADS]; @@ -160,7 +160,7 @@ cleanup: } #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; diff --git a/tests/libtest/lib3027.c b/tests/libtest/lib3027.c index 4ddee1b6b2..f13e35b645 100644 --- a/tests/libtest/lib3027.c +++ b/tests/libtest/lib3027.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3027(char *URL) { CURLcode ret = CURLE_OK; CURL *hnd; diff --git a/tests/libtest/lib3100.c b/tests/libtest/lib3100.c index 7a1037b6e3..77aee5b151 100644 --- a/tests/libtest/lib3100.c +++ b/tests/libtest/lib3100.c @@ -24,7 +24,7 @@ #include "test.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3100(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib3101.c b/tests/libtest/lib3101.c index 13e977313d..a7d8abf4cb 100644 --- a/tests/libtest/lib3101.c +++ b/tests/libtest/lib3101.c @@ -24,7 +24,7 @@ #include "test.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3101(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib3102.c b/tests/libtest/lib3102.c index df95bcd6ee..1adbbeed70 100644 --- a/tests/libtest/lib3102.c +++ b/tests/libtest/lib3102.c @@ -89,7 +89,7 @@ static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream) return size * nmemb; } -CURLcode test(char *URL) +static CURLcode test_lib3102(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib3103.c b/tests/libtest/lib3103.c index cad9de7ae3..2ed9acafc7 100644 --- a/tests/libtest/lib3103.c +++ b/tests/libtest/lib3103.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3103(char *URL) { CURLcode res = CURLE_OK; CURLSH *share; diff --git a/tests/libtest/lib3104.c b/tests/libtest/lib3104.c index da92be5d47..0dbd8ef9e5 100644 --- a/tests/libtest/lib3104.c +++ b/tests/libtest/lib3104.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3104(char *URL) { CURLcode res = CURLE_OK; CURLSH *share; diff --git a/tests/libtest/lib3105.c b/tests/libtest/lib3105.c index c8a1a78f06..0252cd9da2 100644 --- a/tests/libtest/lib3105.c +++ b/tests/libtest/lib3105.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3105(char *URL) { CURL *curls = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib3207.c b/tests/libtest/lib3207.c index 294c8e6240..bc144ae06a 100644 --- a/tests/libtest/lib3207.c +++ b/tests/libtest/lib3207.c @@ -42,7 +42,7 @@ struct Ctx { const char *URL; CURLSH *share; CURLcode result; - int thread_id; + size_t thread_id; struct curl_slist *contents; }; @@ -144,10 +144,10 @@ static void t3207_test_unlock(CURL *handle, curl_lock_data data, void *useptr) 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); @@ -155,10 +155,10 @@ static void execute(CURLSH *share, struct Ctx *ctx) 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]); @@ -166,7 +166,7 @@ static void execute(CURLSH *share, struct Ctx *ctx) } 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]); } } @@ -175,7 +175,7 @@ static void execute(CURLSH *share, struct Ctx *ctx) 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]); @@ -184,10 +184,10 @@ static void execute(CURLSH *share, struct Ctx *ctx) #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]; @@ -199,7 +199,7 @@ CURLcode test(char *URL) 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; @@ -209,7 +209,7 @@ CURLcode test(char *URL) 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; } diff --git a/tests/libtest/lib3208.c b/tests/libtest/lib3208.c index 846e8fcf9b..8be16c8080 100644 --- a/tests/libtest/lib3208.c +++ b/tests/libtest/lib3208.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib3208(char *URL) { CURL *curl = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c index 425d1ef16f..70e6e3f811 100644 --- a/tests/libtest/lib500.c +++ b/tests/libtest/lib500.c @@ -52,7 +52,7 @@ static void setupcallbacks(CURL *curl) testcounter = 0; } -CURLcode test(char *URL) +static CURLcode test_lib500(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c index c1aecdc56c..36f0434e68 100644 --- a/tests/libtest/lib501.c +++ b/tests/libtest/lib501.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib501(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib502.c b/tests/libtest/lib502.c index 0a0208294d..108a885f21 100644 --- a/tests/libtest/lib502.c +++ b/tests/libtest/lib502.c @@ -31,7 +31,7 @@ * Get a single URL without select(). */ -CURLcode test(char *URL) +static CURLcode test_lib502(char *URL) { CURL *c = NULL; CURLM *m = NULL; diff --git a/tests/libtest/lib503.c b/tests/libtest/lib503.c index 4356f5aad4..7c6e06ba0f 100644 --- a/tests/libtest/lib503.c +++ b/tests/libtest/lib503.c @@ -35,7 +35,7 @@ * auth info. */ -CURLcode test(char *URL) +static CURLcode test_lib503(char *URL) { CURL *c = NULL; CURLM *m = NULL; diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c index 989fa4dcf7..cd14a9b019 100644 --- a/tests/libtest/lib504.c +++ b/tests/libtest/lib504.c @@ -34,7 +34,7 @@ * 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; diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index 5c3799a230..3c4a710c00 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.c @@ -36,7 +36,7 @@ * 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; diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 89a5ccb5ab..51c8ff09c5 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -152,7 +152,7 @@ static void *t506_test_fire(void *ptr) 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"); @@ -163,7 +163,7 @@ static void *t506_test_fire(void *ptr) } /* test function */ -CURLcode test(char *URL) +static CURLcode test_lib506(char *URL) { CURLcode res; CURLSHcode scode = CURLSHE_OK; @@ -364,7 +364,7 @@ test_cleanup: 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(); diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c index 53b554d194..58322b4352 100644 --- a/tests/libtest/lib507.c +++ b/tests/libtest/lib507.c @@ -27,7 +27,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib507(char *URL) { CURL *curls = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c index 968125c28d..0e11dae26f 100644 --- a/tests/libtest/lib508.c +++ b/tests/libtest/lib508.c @@ -47,7 +47,7 @@ static size_t t508_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) 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"; diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c index 3b2a932077..a508ac07ad 100644 --- a/tests/libtest/lib509.c +++ b/tests/libtest/lib509.c @@ -69,7 +69,7 @@ static void custom_free(void *ptr) } -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}; diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index 0869b04abf..7c84bc5bab 100644 --- a/tests/libtest/lib510.c +++ b/tests/libtest/lib510.c @@ -60,7 +60,7 @@ static size_t t510_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; /* no more data left to deliver */ } -CURLcode test(char *URL) +static CURLcode test_lib510(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib511.c b/tests/libtest/lib511.c index baa704a746..e92cb4cb36 100644 --- a/tests/libtest/lib511.c +++ b/tests/libtest/lib511.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib511(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib512.c b/tests/libtest/lib512.c index 02e0d487c3..c2df035059 100644 --- a/tests/libtest/lib512.c +++ b/tests/libtest/lib512.c @@ -28,7 +28,7 @@ /* 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; diff --git a/tests/libtest/lib513.c b/tests/libtest/lib513.c index c0153f0247..a5b1212dfa 100644 --- a/tests/libtest/lib513.c +++ b/tests/libtest/lib513.c @@ -34,7 +34,7 @@ static size_t t513_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return CURL_READFUNC_ABORT; } -CURLcode test(char *URL) +static CURLcode test_lib513(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib514.c b/tests/libtest/lib514.c index b0dadf21af..ebc3ae67d8 100644 --- a/tests/libtest/lib514.c +++ b/tests/libtest/lib514.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib514(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index 4aa7245ac9..c7a1954d3d 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib515(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib516.c b/tests/libtest/lib516.c index 60eb4e4c70..48f1dba519 100644 --- a/tests/libtest/lib516.c +++ b/tests/libtest/lib516.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib516(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c index 32175d00ee..6a0a559259 100644 --- a/tests/libtest/lib517.c +++ b/tests/libtest/lib517.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib517(char *URL) { struct dcheck { const char *input; @@ -173,7 +173,7 @@ CURLcode test(char *URL) 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++; } } diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c index f9df1b4b4f..f31786ce6c 100644 --- a/tests/libtest/lib518.c +++ b/tests/libtest/lib518.c @@ -402,7 +402,7 @@ static int t518_test_rlimit(int keep_open) 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"); @@ -426,7 +426,7 @@ static int t518_test_rlimit(int keep_open) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib518(char *URL) { CURLcode res; CURL *curl; @@ -478,7 +478,7 @@ test_cleanup: #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)"); diff --git a/tests/libtest/lib519.c b/tests/libtest/lib519.c index 2f92f73864..baae719ae6 100644 --- a/tests/libtest/lib519.c +++ b/tests/libtest/lib519.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib519(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib520.c b/tests/libtest/lib520.c index 8155201967..5d76e0df1e 100644 --- a/tests/libtest/lib520.c +++ b/tests/libtest/lib520.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib520(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib521.c b/tests/libtest/lib521.c index cc1863d148..156f156dac 100644 --- a/tests/libtest/lib521.c +++ b/tests/libtest/lib521.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib521(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib523.c b/tests/libtest/lib523.c index f130d7abae..6ef2ce0818 100644 --- a/tests/libtest/lib523.c +++ b/tests/libtest/lib523.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib523(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib524.c b/tests/libtest/lib524.c index 830c0d7776..e727985e23 100644 --- a/tests/libtest/lib524.c +++ b/tests/libtest/lib524.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib524(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c index eaf78411b1..a34a197c11 100644 --- a/tests/libtest/lib525.c +++ b/tests/libtest/lib525.c @@ -29,7 +29,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib525(char *URL) { CURLcode res = CURLE_OK; CURL *curl = NULL; @@ -49,7 +49,7 @@ CURLcode test(char *URL) 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; } @@ -63,7 +63,7 @@ CURLcode test(char *URL) 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; diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c index d8ce329467..c30070fc84 100644 --- a/tests/libtest/lib526.c +++ b/tests/libtest/lib526.c @@ -48,24 +48,24 @@ #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); @@ -99,8 +99,8 @@ CURLcode test(char *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]); @@ -142,7 +142,7 @@ test_cleanup: 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]); } @@ -156,7 +156,7 @@ test_cleanup: 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); @@ -166,7 +166,7 @@ test_cleanup: 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(); diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index 83216f5b3d..331edf3640 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -190,7 +190,7 @@ static int t530_checkForCompletion(CURLM *curl, int *success) } else { curl_mfprintf(stderr, "Got an unexpected message from curl: %i\n", - message->msg); + message->msg); result = 1; *success = 0; } @@ -240,7 +240,7 @@ static int socket_action(CURLM *curl, curl_socket_t s, int evBitmask, 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; } @@ -376,7 +376,7 @@ test_cleanup: 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 diff --git a/tests/libtest/lib533.c b/tests/libtest/lib533.c index 5ac43cd6bb..c22dca3c54 100644 --- a/tests/libtest/lib533.c +++ b/tests/libtest/lib533.c @@ -31,7 +31,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib533(char *URL) { CURLcode res = CURLE_OK; CURL *curl = NULL; diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c index ce1df9c0dc..c5d9bc21d0 100644 --- a/tests/libtest/lib536.c +++ b/tests/libtest/lib536.c @@ -33,11 +33,11 @@ static void proxystat(CURL *curl) 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; diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c index 9bf0a7eb52..dd2fa2ac10 100644 --- a/tests/libtest/lib537.c +++ b/tests/libtest/lib537.c @@ -440,7 +440,7 @@ static int t537_test_rlimit(int keep_open) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib537(char *URL) { CURLcode res; CURL *curl; @@ -492,7 +492,7 @@ test_cleanup: #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)"); diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c index ace839d03c..b966e0c022 100644 --- a/tests/libtest/lib539.c +++ b/tests/libtest/lib539.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib539(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c index 1568eee534..91ff68c1ff 100644 --- a/tests/libtest/lib540.c +++ b/tests/libtest/lib540.c @@ -42,10 +42,7 @@ #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) @@ -166,13 +163,13 @@ static CURLcode loop(int num, CURLM *cm, const char *url, const char *userpwd, 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; @@ -191,15 +188,15 @@ static CURLcode loop(int num, CURLM *cm, const char *url, const char *userpwd, 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(); @@ -241,7 +238,7 @@ test_cleanup: /* 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]); } diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c index 1215206634..4a78c92ab3 100644 --- a/tests/libtest/lib541.c +++ b/tests/libtest/lib541.c @@ -33,7 +33,7 @@ * 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; @@ -49,7 +49,7 @@ CURLcode test(char *URL) 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 */ } @@ -63,7 +63,7 @@ CURLcode test(char *URL) 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; diff --git a/tests/libtest/lib542.c b/tests/libtest/lib542.c index f48c26995e..d8f4f35057 100644 --- a/tests/libtest/lib542.c +++ b/tests/libtest/lib542.c @@ -33,7 +33,7 @@ * FTP get with NOBODY but no HEADER */ -CURLcode test(char *URL) +static CURLcode test_lib542(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c index 8f8d4fd32a..e568bfc2b8 100644 --- a/tests/libtest/lib543.c +++ b/tests/libtest/lib543.c @@ -27,7 +27,7 @@ #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, diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c index b12e3483e6..60fb63d7c6 100644 --- a/tests/libtest/lib544.c +++ b/tests/libtest/lib544.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib544(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c index c24619db57..e57fa3172d 100644 --- a/tests/libtest/lib547.c +++ b/tests/libtest/lib547.c @@ -63,7 +63,7 @@ static curlioerr t547_ioctl_callback(CURL *handle, int cmd, void *clientp) return CURLIOE_OK; } -CURLcode test(char *URL) +static CURLcode test_lib547(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib549.c b/tests/libtest/lib549.c index eb5f4e313d..a0ffa139b9 100644 --- a/tests/libtest/lib549.c +++ b/tests/libtest/lib549.c @@ -30,7 +30,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib549(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index f6216da1f8..3db4e77c95 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -158,7 +158,7 @@ static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp) return CURLIOE_UNKNOWNCMD; } -CURLcode test(char *URL) +static CURLcode test_lib552(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c index 111da12125..af9e903b09 100644 --- a/tests/libtest/lib553.c +++ b/tests/libtest/lib553.c @@ -55,7 +55,7 @@ static size_t myreadfunc(char *ptr, size_t size, size_t nmemb, void *stream) #define NUM_HEADERS 8 #define SIZE_HEADERS 5000 -CURLcode test(char *URL) +static CURLcode test_lib553(char *URL) { static char testbuf[SIZE_HEADERS + 100]; diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index f5df319ec0..c9d62e0d55 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -192,7 +192,7 @@ test_cleanup: return res; } -CURLcode test(char *URL) +static CURLcode test_lib554(char *URL) { CURLcode res; diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c index 70cbc90360..9ab7cc9d2c 100644 --- a/tests/libtest/lib555.c +++ b/tests/libtest/lib555.c @@ -68,7 +68,7 @@ static curlioerr t555_ioctl_callback(CURL *handle, int cmd, void *clientp) return CURLIOE_OK; } -CURLcode test(char *URL) +static CURLcode test_lib555(char *URL) { CURLcode res = CURLE_OK; CURL *curl = NULL; diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index e3daabd4a7..2aacf55756 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -26,7 +26,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib556(char *URL) { CURLcode res; CURL *curl; @@ -85,7 +85,7 @@ again: 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; } diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c index 6eaa733e21..aa6edbda27 100644 --- a/tests/libtest/lib557.c +++ b/tests/libtest/lib557.c @@ -148,8 +148,8 @@ static int test_unsigned_short_formatting(void) (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); @@ -226,7 +226,7 @@ static int test_signed_short_formatting(void) 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++; } @@ -373,10 +373,10 @@ static int test_unsigned_int_formatting(void) (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++; } @@ -604,7 +604,7 @@ static int test_signed_int_formatting(void) 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++; } @@ -750,10 +750,10 @@ static int test_unsigned_long_formatting(void) (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++; } @@ -981,7 +981,7 @@ static int test_signed_long_formatting(void) 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++; } @@ -1096,7 +1096,7 @@ static int test_curl_off_t_formatting(void) 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++; } @@ -1115,7 +1115,7 @@ static int _string_check(int linenumber, char *buf, const char *buf2) 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; @@ -1128,7 +1128,7 @@ static int _strlen_check(int linenumber, char *buf, size_t len) 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; @@ -1541,7 +1541,7 @@ static int test_return_codes(void) return 0; } -CURLcode test(char *URL) +static CURLcode test_lib557(char *URL) { int errors = 0; (void)URL; /* not used */ @@ -1555,29 +1555,17 @@ CURLcode test(char *URL) #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) diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c index 3f1724a1e3..9b7ef56dfb 100644 --- a/tests/libtest/lib558.c +++ b/tests/libtest/lib558.c @@ -25,7 +25,7 @@ #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}; diff --git a/tests/libtest/lib559.c b/tests/libtest/lib559.c index 621b90e611..cfd2c914b2 100644 --- a/tests/libtest/lib559.c +++ b/tests/libtest/lib559.c @@ -26,7 +26,7 @@ #include "testtrace.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib559(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib560.c b/tests/libtest/lib560.c index 6d392e6a4f..bc4f537218 100644 --- a/tests/libtest/lib560.c +++ b/tests/libtest/lib560.c @@ -37,7 +37,7 @@ * 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; diff --git a/tests/libtest/lib562.c b/tests/libtest/lib562.c index fa9c75bac6..5c6671fe12 100644 --- a/tests/libtest/lib562.c +++ b/tests/libtest/lib562.c @@ -37,7 +37,7 @@ */ -CURLcode test(char *URL) +static CURLcode test_lib562(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib564.c b/tests/libtest/lib564.c index d1c819182e..6ff749f44a 100644 --- a/tests/libtest/lib564.c +++ b/tests/libtest/lib564.c @@ -29,7 +29,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib564(char *URL) { CURLcode res = CURLE_OK; CURL *curl = NULL; diff --git a/tests/libtest/lib566.c b/tests/libtest/lib566.c index 3ed609f67f..cf4ed0db3e 100644 --- a/tests/libtest/lib566.c +++ b/tests/libtest/lib566.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib566(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c index 9c36cfa420..c6b8a3319c 100644 --- a/tests/libtest/lib567.c +++ b/tests/libtest/lib567.c @@ -28,7 +28,7 @@ /* * Test a simple OPTIONS request with a custom header */ -CURLcode test(char *URL) +static CURLcode test_lib567(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c index 76935e01b1..59d37ec84e 100644 --- a/tests/libtest/lib568.c +++ b/tests/libtest/lib568.c @@ -36,7 +36,7 @@ /* * Test the Client->Server ANNOUNCE functionality (PUT style) */ -CURLcode test(char *URL) +static CURLcode test_lib568(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c index 6ee9c15d36..aacaa38328 100644 --- a/tests/libtest/lib569.c +++ b/tests/libtest/lib569.c @@ -29,7 +29,7 @@ /* * Test Session ID capture */ -CURLcode test(char *URL) +static CURLcode test_lib569(char *URL) { CURLcode res; CURL *curl; @@ -68,7 +68,7 @@ CURLcode test(char *URL) 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; } diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c index 8c7831e5a0..30f2c40db5 100644 --- a/tests/libtest/lib570.c +++ b/tests/libtest/lib570.c @@ -26,7 +26,7 @@ #include "testutil.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib570(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c index d0025486b1..392bb69888 100644 --- a/tests/libtest/lib571.c +++ b/tests/libtest/lib571.c @@ -85,7 +85,7 @@ static size_t rtp_write(char *ptr, size_t size, size_t nmemb, void *stream) 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; */ } } @@ -97,7 +97,7 @@ static size_t rtp_write(char *ptr, size_t size, size_t nmemb, void *stream) return size * nmemb; } -CURLcode test(char *URL) +static CURLcode test_lib571(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c index 8f5d2f1d46..9df4be847a 100644 --- a/tests/libtest/lib572.c +++ b/tests/libtest/lib572.c @@ -36,7 +36,7 @@ /* * Test GET_PARAMETER: PUT, HEARTBEAT, and POST */ -CURLcode test(char *URL) +static CURLcode test_lib572(char *URL) { CURLcode res; CURL *curl; @@ -59,7 +59,6 @@ CURLcode test(char *URL) return TEST_ERR_MAJOR_BAD; } - test_setopt(curl, CURLOPT_HEADERDATA, stdout); test_setopt(curl, CURLOPT_WRITEDATA, stdout); test_setopt(curl, CURLOPT_VERBOSE, 1L); diff --git a/tests/libtest/lib573.c b/tests/libtest/lib573.c index bcd0e90bdb..2e3b40fc00 100644 --- a/tests/libtest/lib573.c +++ b/tests/libtest/lib573.c @@ -32,7 +32,7 @@ * Get a single URL without select(). */ -CURLcode test(char *URL) +static CURLcode test_lib573(char *URL) { CURL *c = NULL; CURLM *m = NULL; @@ -96,7 +96,7 @@ CURLcode test(char *URL) 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; } diff --git a/tests/libtest/lib574.c b/tests/libtest/lib574.c index 696668fc6e..4c78214548 100644 --- a/tests/libtest/lib574.c +++ b/tests/libtest/lib574.c @@ -30,11 +30,11 @@ static int new_fnmatch(void *ptr, { (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; diff --git a/tests/libtest/lib575.c b/tests/libtest/lib575.c index d02e64aaee..7db472b5fc 100644 --- a/tests/libtest/lib575.c +++ b/tests/libtest/lib575.c @@ -35,7 +35,7 @@ * 3. with multi interface */ -CURLcode test(char *URL) +static CURLcode test_lib575(char *URL) { CURL *handle = NULL; CURL *duphandle = NULL; diff --git a/tests/libtest/lib576.c b/tests/libtest/lib576.c index a78e7b8ab3..e0765415b0 100644 --- a/tests/libtest/lib576.c +++ b/tests/libtest/lib576.c @@ -73,7 +73,8 @@ static long chunk_bgn(const void *f, void *ptr, int remains) 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"); @@ -96,7 +97,7 @@ static long chunk_end(void *ptr) return CURL_CHUNK_END_FUNC_OK; } -CURLcode test(char *URL) +static CURLcode test_lib576(char *URL) { CURL *handle = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c index 9fd6aaaea3..5b987febf1 100644 --- a/tests/libtest/lib578.c +++ b/tests/libtest/lib578.c @@ -50,7 +50,7 @@ static int t578_progress_callback(void *clientp, double dltotal, double dlnow, return 0; } -CURLcode test(char *URL) +static CURLcode test_lib578(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index e6f8945e42..c1d8f2fd12 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -37,7 +37,7 @@ static void progress_final_report(void) { 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 @@ -100,7 +100,7 @@ static size_t t579_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; /* no more data left to deliver */ } -CURLcode test(char *URL) +static CURLcode test_lib579(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index bb1fb5e611..676ad69f4c 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.c @@ -157,7 +157,7 @@ static int t582_checkForCompletion(CURLM *curl, int *success) } else { curl_mfprintf(stderr, "Got an unexpected message from curl: %i\n", - (int)message->msg); + (int)message->msg); result = 1; *success = 0; } @@ -207,7 +207,7 @@ static void notifyCurl(CURLM *curl, curl_socket_t s, int evBitmask, 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)); } } @@ -225,7 +225,7 @@ static void t582_checkFdSet(CURLM *curl, struct t582_Sockets *sockets, } } -CURLcode test(char *URL) +static CURLcode test_lib582(char *URL) { CURLcode res = CURLE_OK; CURL *curl = NULL; @@ -250,7 +250,7 @@ CURLcode test(char *URL) 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; } @@ -264,7 +264,7 @@ CURLcode test(char *URL) 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; diff --git a/tests/libtest/lib583.c b/tests/libtest/lib583.c index 8ddcaa3172..8e41e298e3 100644 --- a/tests/libtest/lib583.c +++ b/tests/libtest/lib583.c @@ -32,7 +32,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib583(char *URL) { int stillRunning; CURLM *multiHandle = NULL; @@ -73,7 +73,7 @@ CURLcode test(char *URL) 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 diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index 1cb3cf0ab9..2bf21ba0b9 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -119,7 +119,7 @@ static void *t586_test_fire(void *ptr) 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"); @@ -129,7 +129,7 @@ static void *t586_test_fire(void *ptr) } /* test function */ -CURLcode test(char *URL) +static CURLcode test_lib586(char *URL) { CURLcode res = CURLE_OK; CURLSHcode scode = CURLSHE_OK; @@ -237,7 +237,7 @@ test_cleanup: 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(); diff --git a/tests/libtest/lib589.c b/tests/libtest/lib589.c index a58f704106..94eb911b5f 100644 --- a/tests/libtest/lib589.c +++ b/tests/libtest/lib589.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib589(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib590.c b/tests/libtest/lib590.c index caa50ffce3..b9f0377fbf 100644 --- a/tests/libtest/lib590.c +++ b/tests/libtest/lib590.c @@ -38,7 +38,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib590(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib591.c b/tests/libtest/lib591.c index 1f75770920..11e82632d3 100644 --- a/tests/libtest/lib591.c +++ b/tests/libtest/lib591.c @@ -33,7 +33,7 @@ #include "warnless.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib591(char *URL) { CURL *easy = NULL; CURLM *multi = NULL; @@ -48,7 +48,7 @@ CURLcode test(char *URL) 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; } diff --git a/tests/libtest/lib597.c b/tests/libtest/lib597.c index d040f9a781..33e290ca3c 100644 --- a/tests/libtest/lib597.c +++ b/tests/libtest/lib597.c @@ -38,7 +38,7 @@ * with function curl_multi_info_read(). */ -CURLcode test(char *URL) +static CURLcode test_lib597(char *URL) { CURL *easy = NULL; CURLM *multi = NULL; diff --git a/tests/libtest/lib598.c b/tests/libtest/lib598.c index 96d6662769..2cf5fa37d7 100644 --- a/tests/libtest/lib598.c +++ b/tests/libtest/lib598.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib598(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib599.c b/tests/libtest/lib599.c index 9525dbbfe4..c22e925b17 100644 --- a/tests/libtest/lib599.c +++ b/tests/libtest/lib599.c @@ -41,7 +41,7 @@ static int t599_progress_callback(void *clientp, double dltotal, return 0; } -CURLcode test(char *URL) +static CURLcode test_lib599(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib643.c b/tests/libtest/lib643.c index a3e8a714a9..6428f99822 100644 --- a/tests/libtest/lib643.c +++ b/tests/libtest/lib643.c @@ -247,7 +247,7 @@ static CURLcode t643_cyclic_add(void) return CURLE_OK; } -CURLcode test(char *URL) +static CURLcode test_lib643(char *URL) { CURLcode res; diff --git a/tests/libtest/lib650.c b/tests/libtest/lib650.c index 4fa1571be1..856670ffd4 100644 --- a/tests/libtest/lib650.c +++ b/tests/libtest/lib650.c @@ -39,8 +39,7 @@ static size_t count_chars(void *userp, const char *buf, size_t len) return len; } - -CURLcode test(char *URL) +static CURLcode test_lib650(char *URL) { CURL *curl = NULL; CURLcode res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib651.c b/tests/libtest/lib651.c index 84e8d89fe8..6b5f9d5e4f 100644 --- a/tests/libtest/lib651.c +++ b/tests/libtest/lib651.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib651(char *URL) { static char testbuf[17000]; /* more than 16K */ diff --git a/tests/libtest/lib652.c b/tests/libtest/lib652.c index e01fbee54b..c3f11f147f 100644 --- a/tests/libtest/lib652.c +++ b/tests/libtest/lib652.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib652(char *URL) { static char testbuf[17000]; /* more than 16K */ diff --git a/tests/libtest/lib653.c b/tests/libtest/lib653.c index a1be0df160..bbc3c4478c 100644 --- a/tests/libtest/lib653.c +++ b/tests/libtest/lib653.c @@ -27,8 +27,7 @@ #include "warnless.h" #include "memdebug.h" - -CURLcode test(char *URL) +static CURLcode test_lib653(char *URL) { CURL *curls = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib654.c b/tests/libtest/lib654.c index 72236c249d..69223643bd 100644 --- a/tests/libtest/lib654.c +++ b/tests/libtest/lib654.c @@ -59,7 +59,7 @@ static size_t t654_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; /* no more data left to deliver */ } -CURLcode test(char *URL) +static CURLcode test_lib654(char *URL) { static const char testdata[] = "dummy\n"; @@ -151,7 +151,7 @@ CURLcode test(char *URL) 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; } diff --git a/tests/libtest/lib655.c b/tests/libtest/lib655.c index 238837fe96..0915da3dd3 100644 --- a/tests/libtest/lib655.c +++ b/tests/libtest/lib655.c @@ -58,7 +58,7 @@ static int resolver_alloc_cb_pass(void *resolver_state, void *reserved, return 0; } -CURLcode test(char *URL) +static CURLcode test_lib655(char *URL) { CURL *curl; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib658.c b/tests/libtest/lib658.c index 6254d528c5..001db95888 100644 --- a/tests/libtest/lib658.c +++ b/tests/libtest/lib658.c @@ -31,7 +31,7 @@ * Get a single URL without select(). */ -CURLcode test(char *URL) +static CURLcode test_lib658(char *URL) { CURL *handle = NULL; CURLcode res = CURLE_OK; @@ -51,7 +51,7 @@ CURLcode test(char *URL) 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; } diff --git a/tests/libtest/lib659.c b/tests/libtest/lib659.c index c14173db43..4b721d8ff4 100644 --- a/tests/libtest/lib659.c +++ b/tests/libtest/lib659.c @@ -31,7 +31,7 @@ * Get a single URL without select(). */ -CURLcode test(char *URL) +static CURLcode test_lib659(char *URL) { CURL *handle = NULL; CURLcode res = CURLE_OK; diff --git a/tests/libtest/lib661.c b/tests/libtest/lib661.c index 170237671a..5c8d839988 100644 --- a/tests/libtest/lib661.c +++ b/tests/libtest/lib661.c @@ -24,7 +24,7 @@ #include "test.h" #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib661(char *URL) { CURLcode res; CURL *curl = NULL; @@ -154,7 +154,6 @@ CURLcode test(char *URL) test_setopt(curl, CURLOPT_QUOTE, slist); res = curl_easy_perform(curl); - test_cleanup: if(res) diff --git a/tests/libtest/lib666.c b/tests/libtest/lib666.c index d27825cae3..5696181e1d 100644 --- a/tests/libtest/lib666.c +++ b/tests/libtest/lib666.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib666(char *URL) { static char testbuf[17000]; /* more than 16K */ diff --git a/tests/libtest/lib667.c b/tests/libtest/lib667.c index 2febda615d..999f703909 100644 --- a/tests/libtest/lib667.c +++ b/tests/libtest/lib667.c @@ -51,7 +51,7 @@ static size_t t667_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return 0; /* no more data left to deliver */ } -CURLcode test(char *URL) +static CURLcode test_lib667(char *URL) { static const char testdata[] = "dummy"; diff --git a/tests/libtest/lib668.c b/tests/libtest/lib668.c index 7f2b299f2f..cdf09f618a 100644 --- a/tests/libtest/lib668.c +++ b/tests/libtest/lib668.c @@ -46,7 +46,7 @@ static size_t t668_read_cb(char *ptr, size_t size, size_t nmemb, void *userp) return len; } -CURLcode test(char *URL) +static CURLcode test_lib668(char *URL) { static const char testdata[] = "dummy"; diff --git a/tests/libtest/lib670.c b/tests/libtest/lib670.c index 051142a488..981a4e92f9 100644 --- a/tests/libtest/lib670.c +++ b/tests/libtest/lib670.c @@ -87,7 +87,7 @@ static int t670_xferinfo(void *clientp, return 0; } -CURLcode test(char *URL) +static CURLcode test_lib670(char *URL) { static const char testname[] = "field"; diff --git a/tests/libtest/lib674.c b/tests/libtest/lib674.c index 2a979a223c..be737b2ebc 100644 --- a/tests/libtest/lib674.c +++ b/tests/libtest/lib674.c @@ -31,7 +31,7 @@ * Get a single URL without select(). */ -CURLcode test(char *URL) +static CURLcode test_lib674(char *URL) { CURL *handle = NULL; CURL *handle2; @@ -52,13 +52,12 @@ CURLcode test(char *URL) 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); diff --git a/tests/libtest/lib676.c b/tests/libtest/lib676.c index ec2b23576e..f740b576a0 100644 --- a/tests/libtest/lib676.c +++ b/tests/libtest/lib676.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib676(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib677.c b/tests/libtest/lib677.c index 34ecf2ba7e..a2e739f584 100644 --- a/tests/libtest/lib677.c +++ b/tests/libtest/lib677.c @@ -27,7 +27,7 @@ #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]; @@ -89,7 +89,7 @@ CURLcode test(char *URL) } 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; } @@ -110,7 +110,7 @@ CURLcode test(char *URL) } 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; } diff --git a/tests/libtest/lib678.c b/tests/libtest/lib678.c index c5646502c3..98e982f1ef 100644 --- a/tests/libtest/lib678.c +++ b/tests/libtest/lib678.c @@ -97,7 +97,7 @@ static CURLcode test_cert_blob(const char *url, const char *cafile) return code; } -CURLcode test(char *URL) +static CURLcode test_lib678(char *URL) { CURLcode res = CURLE_OK; curl_global_init(CURL_GLOBAL_DEFAULT); diff --git a/tests/libtest/lib694.c b/tests/libtest/lib694.c index 81c0fcc957..fd1b18b52e 100644 --- a/tests/libtest/lib694.c +++ b/tests/libtest/lib694.c @@ -25,7 +25,7 @@ #include "memdebug.h" -CURLcode test(char *URL) +static CURLcode test_lib694(char *URL) { CURLcode res; CURL *curl; diff --git a/tests/libtest/lib695.c b/tests/libtest/lib695.c index d38c5e436d..7769fc11e7 100644 --- a/tests/libtest/lib695.c +++ b/tests/libtest/lib695.c @@ -25,7 +25,6 @@ #include "memdebug.h" - /* write callback that does nothing */ static size_t write_it(char *ptr, size_t size, size_t nmemb, void *userdata) { @@ -34,7 +33,7 @@ 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; @@ -78,7 +77,7 @@ CURLcode test(char *URL) /* 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); @@ -92,7 +91,7 @@ CURLcode test(char *URL) if(res != CURLE_OK) curl_mfprintf(stderr, "curl_mime_subparts() failed: %sn", - curl_easy_strerror(res)); + curl_easy_strerror(res)); else { mime1 = NULL; @@ -102,7 +101,7 @@ CURLcode test(char *URL) /* 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)); } } diff --git a/tests/libtest/lib751.c b/tests/libtest/lib751.c index ab2f923b95..ae370721c1 100644 --- a/tests/libtest/lib751.c +++ b/tests/libtest/lib751.c @@ -27,13 +27,11 @@ #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; diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index d083c39025..95e38c4c02 100755 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -325,7 +325,7 @@ static bool bad_long(CURLcode res, int check) 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; diff --git a/tests/libtest/test.h b/tests/libtest/test.h index 9d57f7a51c..369e9c6f04 100644 --- a/tests/libtest/test.h +++ b/tests/libtest/test.h @@ -29,9 +29,6 @@ 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 @@ -79,11 +76,6 @@ extern int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc, 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; @@ -139,11 +131,11 @@ 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) \ @@ -160,11 +152,11 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -181,14 +173,14 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -205,14 +197,14 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -229,14 +221,14 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -253,14 +245,14 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -278,20 +270,20 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -311,15 +303,15 @@ extern int unitfail; #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) @@ -338,20 +330,20 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -371,15 +363,15 @@ extern int unitfail; #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) @@ -398,14 +390,14 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -422,15 +414,15 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -451,14 +443,14 @@ extern int unitfail; 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() \ @@ -475,14 +467,14 @@ extern int unitfail; /* ---------------------------------------------------------------- */ -#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) \ @@ -500,37 +492,20 @@ extern int unitfail; #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 diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c index 36942124d2..53c2651c6b 100644 --- a/tests/libtest/testtrace.c +++ b/tests/libtest/testtrace.c @@ -21,7 +21,6 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ - #include "test.h" #include "testutil.h" #include "testtrace.h" diff --git a/tests/mk-bundle.pl b/tests/mk-bundle.pl deleted file mode 100755 index ff4c7ad1ae..0000000000 --- a/tests/mk-bundle.pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/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 [] - -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 <
) { - 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 <