]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: always make bundles, adapt build and tests
authorViktor Szakats <commit@vsz.me>
Wed, 11 Jun 2025 09:31:14 +0000 (11:31 +0200)
committerViktor Szakats <commit@vsz.me>
Sat, 14 Jun 2025 19:08:23 +0000 (21:08 +0200)
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_<testname>`
  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

386 files changed:
.github/workflows/http3-linux.yml
.github/workflows/linux-old.yml
.github/workflows/linux.yml
.github/workflows/macos.yml
.github/workflows/non-native.yml
.github/workflows/windows.yml
CMakeLists.txt
appveyor.sh
configure.ac
docs/INSTALL-CMAKE.md
docs/cmdline-opts/CMakeLists.txt
docs/cmdline-opts/Makefile.am
docs/cmdline-opts/Makefile.inc
docs/examples/CMakeLists.txt
docs/examples/Makefile.am
docs/examples/Makefile.inc
docs/libcurl/CMakeLists.txt
docs/libcurl/Makefile.am
docs/libcurl/Makefile.inc
docs/libcurl/opts/CMakeLists.txt
docs/libcurl/opts/Makefile.am
docs/libcurl/opts/Makefile.inc
docs/tests/TEST-SUITE.md
lib/CMakeLists.txt
lib/Makefile.am
lib/Makefile.inc
lib/Makefile.soname
scripts/mk-unity.pl
src/CMakeLists.txt
src/Makefile.am
src/Makefile.inc
src/tool_setup.h
src/tool_xattr.c
src/tool_xattr.h
tests/Makefile.am
tests/certs/CMakeLists.txt
tests/certs/Makefile.am
tests/certs/Makefile.inc
tests/data/test1306
tests/data/test1621
tests/data/test2023
tests/data/test2024
tests/data/test2025
tests/data/test2026
tests/data/test2027
tests/data/test2028
tests/data/test2029
tests/data/test2030
tests/data/test2031
tests/data/test2032
tests/data/test2082
tests/data/test2083
tests/data/test2084
tests/data/test2085
tests/data/test2086
tests/globalconfig.pm
tests/http/clients/CMakeLists.txt
tests/http/clients/Makefile.am
tests/http/clients/Makefile.inc
tests/libtest/.gitignore
tests/libtest/CMakeLists.txt
tests/libtest/Makefile.am
tests/libtest/Makefile.inc
tests/libtest/first.c
tests/libtest/first.h
tests/libtest/lib1156.c
tests/libtest/lib1301.c
tests/libtest/lib1308.c
tests/libtest/lib1485.c
tests/libtest/lib1500.c
tests/libtest/lib1501.c
tests/libtest/lib1502.c
tests/libtest/lib1506.c
tests/libtest/lib1507.c
tests/libtest/lib1508.c
tests/libtest/lib1509.c
tests/libtest/lib1510.c
tests/libtest/lib1511.c
tests/libtest/lib1512.c
tests/libtest/lib1513.c
tests/libtest/lib1514.c
tests/libtest/lib1515.c
tests/libtest/lib1517.c
tests/libtest/lib1518.c
tests/libtest/lib1520.c
tests/libtest/lib1522.c
tests/libtest/lib1523.c
tests/libtest/lib1525.c
tests/libtest/lib1526.c
tests/libtest/lib1527.c
tests/libtest/lib1528.c
tests/libtest/lib1529.c
tests/libtest/lib1530.c
tests/libtest/lib1531.c
tests/libtest/lib1532.c
tests/libtest/lib1533.c
tests/libtest/lib1534.c
tests/libtest/lib1535.c
tests/libtest/lib1536.c
tests/libtest/lib1537.c
tests/libtest/lib1538.c
tests/libtest/lib1540.c
tests/libtest/lib1541.c
tests/libtest/lib1542.c
tests/libtest/lib1545.c
tests/libtest/lib1550.c
tests/libtest/lib1551.c
tests/libtest/lib1552.c
tests/libtest/lib1553.c
tests/libtest/lib1554.c
tests/libtest/lib1555.c
tests/libtest/lib1556.c
tests/libtest/lib1557.c
tests/libtest/lib1558.c
tests/libtest/lib1559.c
tests/libtest/lib1560.c
tests/libtest/lib1564.c
tests/libtest/lib1565.c
tests/libtest/lib1567.c
tests/libtest/lib1568.c
tests/libtest/lib1569.c
tests/libtest/lib1571.c
tests/libtest/lib1576.c
tests/libtest/lib1591.c
tests/libtest/lib1592.c
tests/libtest/lib1593.c
tests/libtest/lib1594.c
tests/libtest/lib1597.c
tests/libtest/lib1598.c
tests/libtest/lib1662.c
tests/libtest/lib1900.c
tests/libtest/lib1901.c
tests/libtest/lib1903.c
tests/libtest/lib1905.c
tests/libtest/lib1906.c
tests/libtest/lib1907.c
tests/libtest/lib1908.c
tests/libtest/lib1910.c
tests/libtest/lib1911.c
tests/libtest/lib1912.c
tests/libtest/lib1913.c
tests/libtest/lib1915.c
tests/libtest/lib1916.c
tests/libtest/lib1918.c
tests/libtest/lib1919.c
tests/libtest/lib1933.c
tests/libtest/lib1934.c
tests/libtest/lib1935.c
tests/libtest/lib1936.c
tests/libtest/lib1937.c
tests/libtest/lib1938.c
tests/libtest/lib1939.c
tests/libtest/lib1940.c
tests/libtest/lib1945.c
tests/libtest/lib1947.c
tests/libtest/lib1948.c
tests/libtest/lib1955.c
tests/libtest/lib1956.c
tests/libtest/lib1957.c
tests/libtest/lib1958.c
tests/libtest/lib1959.c
tests/libtest/lib1960.c
tests/libtest/lib1964.c
tests/libtest/lib1970.c
tests/libtest/lib1971.c
tests/libtest/lib1972.c
tests/libtest/lib1973.c
tests/libtest/lib1974.c
tests/libtest/lib1975.c
tests/libtest/lib1977.c
tests/libtest/lib1978.c
tests/libtest/lib2023.c [moved from tests/libtest/libauthretry.c with 89% similarity]
tests/libtest/lib2032.c [moved from tests/libtest/libntlmconnect.c with 92% similarity]
tests/libtest/lib2082.c [moved from tests/libtest/libprereq.c with 98% similarity]
tests/libtest/lib2301.c
tests/libtest/lib2302.c
tests/libtest/lib2304.c
tests/libtest/lib2306.c
tests/libtest/lib2308.c
tests/libtest/lib2309.c
tests/libtest/lib2402.c
tests/libtest/lib2404.c
tests/libtest/lib2405.c
tests/libtest/lib2502.c
tests/libtest/lib2700.c
tests/libtest/lib3010.c
tests/libtest/lib3025.c
tests/libtest/lib3026.c
tests/libtest/lib3027.c
tests/libtest/lib3100.c
tests/libtest/lib3101.c
tests/libtest/lib3102.c
tests/libtest/lib3103.c
tests/libtest/lib3104.c
tests/libtest/lib3105.c
tests/libtest/lib3207.c
tests/libtest/lib3208.c
tests/libtest/lib500.c
tests/libtest/lib501.c
tests/libtest/lib502.c
tests/libtest/lib503.c
tests/libtest/lib504.c
tests/libtest/lib505.c
tests/libtest/lib506.c
tests/libtest/lib507.c
tests/libtest/lib508.c
tests/libtest/lib509.c
tests/libtest/lib510.c
tests/libtest/lib511.c
tests/libtest/lib512.c
tests/libtest/lib513.c
tests/libtest/lib514.c
tests/libtest/lib515.c
tests/libtest/lib516.c
tests/libtest/lib517.c
tests/libtest/lib518.c
tests/libtest/lib519.c
tests/libtest/lib520.c
tests/libtest/lib521.c
tests/libtest/lib523.c
tests/libtest/lib524.c
tests/libtest/lib525.c
tests/libtest/lib526.c
tests/libtest/lib530.c
tests/libtest/lib533.c
tests/libtest/lib536.c
tests/libtest/lib537.c
tests/libtest/lib539.c
tests/libtest/lib540.c
tests/libtest/lib541.c
tests/libtest/lib542.c
tests/libtest/lib543.c
tests/libtest/lib544.c
tests/libtest/lib547.c
tests/libtest/lib549.c
tests/libtest/lib552.c
tests/libtest/lib553.c
tests/libtest/lib554.c
tests/libtest/lib555.c
tests/libtest/lib556.c
tests/libtest/lib557.c
tests/libtest/lib558.c
tests/libtest/lib559.c
tests/libtest/lib560.c
tests/libtest/lib562.c
tests/libtest/lib564.c
tests/libtest/lib566.c
tests/libtest/lib567.c
tests/libtest/lib568.c
tests/libtest/lib569.c
tests/libtest/lib570.c
tests/libtest/lib571.c
tests/libtest/lib572.c
tests/libtest/lib573.c
tests/libtest/lib574.c
tests/libtest/lib575.c
tests/libtest/lib576.c
tests/libtest/lib578.c
tests/libtest/lib579.c
tests/libtest/lib582.c
tests/libtest/lib583.c
tests/libtest/lib586.c
tests/libtest/lib589.c
tests/libtest/lib590.c
tests/libtest/lib591.c
tests/libtest/lib597.c
tests/libtest/lib598.c
tests/libtest/lib599.c
tests/libtest/lib643.c
tests/libtest/lib650.c
tests/libtest/lib651.c
tests/libtest/lib652.c
tests/libtest/lib653.c
tests/libtest/lib654.c
tests/libtest/lib655.c
tests/libtest/lib658.c
tests/libtest/lib659.c
tests/libtest/lib661.c
tests/libtest/lib666.c
tests/libtest/lib667.c
tests/libtest/lib668.c
tests/libtest/lib670.c
tests/libtest/lib674.c
tests/libtest/lib676.c
tests/libtest/lib677.c
tests/libtest/lib678.c
tests/libtest/lib694.c
tests/libtest/lib695.c
tests/libtest/lib751.c
tests/libtest/mk-lib1521.pl
tests/libtest/test.h
tests/libtest/testtrace.c
tests/mk-bundle.pl [deleted file]
tests/runner.pm
tests/runtests.pl
tests/server/.gitignore
tests/server/CMakeLists.txt
tests/server/Makefile.am
tests/server/Makefile.inc
tests/server/dnsd.c
tests/server/first.c
tests/server/first.h
tests/server/getpart.c
tests/server/getpart.h
tests/server/mk-bundle.pl [deleted file]
tests/server/mqttd.c
tests/server/resolve.c
tests/server/rtspd.c
tests/server/server_setup.h [deleted file]
tests/server/server_sockaddr.h [deleted file]
tests/server/sockfilt.c
tests/server/socksd.c
tests/server/sws.c
tests/server/tftp.h [deleted file]
tests/server/tftpd.c
tests/server/util.c
tests/server/util.h
tests/serverhelp.pm
tests/tunit/.gitignore
tests/tunit/CMakeLists.txt
tests/tunit/Makefile.am
tests/tunit/Makefile.inc
tests/tunit/tool1394.c
tests/tunit/tool1604.c
tests/tunit/tool1621.c
tests/unit/.gitignore
tests/unit/CMakeLists.txt
tests/unit/Makefile.am
tests/unit/Makefile.inc
tests/unit/README.md
tests/unit/curlcheck.h
tests/unit/unit1300.c
tests/unit/unit1302.c
tests/unit/unit1303.c
tests/unit/unit1304.c
tests/unit/unit1305.c
tests/unit/unit1307.c
tests/unit/unit1309.c
tests/unit/unit1323.c
tests/unit/unit1330.c
tests/unit/unit1395.c
tests/unit/unit1396.c
tests/unit/unit1397.c
tests/unit/unit1398.c
tests/unit/unit1399.c
tests/unit/unit1600.c
tests/unit/unit1601.c
tests/unit/unit1602.c
tests/unit/unit1603.c
tests/unit/unit1605.c
tests/unit/unit1606.c
tests/unit/unit1607.c
tests/unit/unit1608.c
tests/unit/unit1609.c
tests/unit/unit1610.c
tests/unit/unit1611.c
tests/unit/unit1612.c
tests/unit/unit1614.c
tests/unit/unit1615.c
tests/unit/unit1616.c
tests/unit/unit1620.c
tests/unit/unit1650.c
tests/unit/unit1651.c
tests/unit/unit1652.c
tests/unit/unit1653.c
tests/unit/unit1654.c
tests/unit/unit1655.c
tests/unit/unit1656.c
tests/unit/unit1657.c
tests/unit/unit1658.c
tests/unit/unit1660.c
tests/unit/unit1661.c
tests/unit/unit1663.c
tests/unit/unit1664.c
tests/unit/unit1979.c
tests/unit/unit1980.c
tests/unit/unit2600.c
tests/unit/unit2601.c
tests/unit/unit2602.c
tests/unit/unit2603.c
tests/unit/unit2604.c
tests/unit/unit3200.c
tests/unit/unit3205.c
tests/unit/unit3211.c
tests/unit/unit3212.c
tests/unit/unit3213.c

index e34340df3b4a6ee75f761301f3fe63aaf523b95d..3b881d4d2adc3c0eadc03326d278bfd12baa4f39 100644 (file)
@@ -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
index bc33b4a0d4ff840a8ec3c08c9d93f5b63c12fa2b..f1c4ebbc10d9d870ccc93cf5c9230cbf45d78e01 100644 (file)
@@ -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
 
index b0c8315c21f313151d32b43b20ed311585af712d..a8bea98b1d6860aaf4a27d78ae96d55361c89559 100644 (file)
@@ -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
index b0dbdba71437627b7b458e8f8086857866e32d98..88ebd647ded15fbe3df0a29395907ecdb234b9d9 100644 (file)
@@ -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)" \
index 89def2b28b55111ca6203c2a319dcd605bef28bb..dba8e3ffca4b44bf15018fa26f85ec80c90c2dbe 100644 (file)
@@ -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" \
index 871501ad2349ec365eded6ba857bd2c01ba19389..c7c597e344c9309137a20327a7e23624bdcaadd1 100644 (file)
@@ -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" \
index 1b7db248434796ff6fad76d0194580a2a3d8ef0e..2d9291009c72e362feccb779ce84b60dec294614 100644 (file)
@@ -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")
index 9deac61e0bc4018b01bbe799bcb3499e51874fe0..72ecba7bd23666a5c50ffade8e2d111e809085af 100644 (file)
@@ -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 \
index aae5bb9c528b0be65d63d3fca2a3fdc0e2153f87..3926cf3c4acd7fdba902a1bea19c4c3aff293991 100644 (file)
@@ -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
index f896e481c2cf67954c60114f04c4f634e3146210..35451075dc6fb3bd8a49a773149c1ec7577921a8 100644 (file)
@@ -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`
index 4a32f2d9d96e0d4b0b8369850a1557d8a3b24556..2e139069671d290d5122dca69768ee80263c10e8 100644 (file)
@@ -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")
 
index b087e3852542a935444e6caca6446a1d5b30f0e1..e016be286cf235cd3072fa9adc69b3e55c20f4c6 100644 (file)
@@ -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
index 82e64daa88b00619760675f21b831b1471e6ef0b..6e7f0aafa65280a543dd1e2da8f840e4744db837 100644 (file)
@@ -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 \
index ff7cf9b6cf0af2d4c249aa8fe79f00cde4e9aa5b..e27ed47ac17d92f2e4e2fc5facda5edd28f2d18f 100644 (file)
@@ -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()
index 042922f1c4e21af0bfe6874de982cd52d0c9a9bb..6abbe956cbd69409b6f7a10f91aee6850c7162f4 100644 (file)
@@ -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)
index 8c0ceee6deb81f18388807a266e6a56b0314933d..57e320c96ed908bb8e5e28fd0f8373b42ce06aeb 100644 (file)
@@ -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 = \
index 56992da0deccf5ab7ee05ce3d939f7e876a8c70c..2102dd8ee3b56b6f359dd79979c7ee0565060b65 100644 (file)
@@ -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")
 
index d6e43149262266d02be2cb51536ceba04c5cf483..7b84ef44f84b7a3c11c36b122b043914cd460726 100644 (file)
@@ -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)
index c0d1d716f15152c8fadb2d0d58801d7c3b9f5eb5..83357cf42b34e6a41b5f8ab1d0f7e9052674e787 100644 (file)
@@ -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 \
index f7632c49d5d206b0548904eba8983f53685aaa94..c3e2c2cc6b65af3d45cd7cc0e798f4a3403b9538 100644 (file)
@@ -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")
 
index be877c52ef907bcc53a8c890e882d1167c6c8b17..cf33491367a40f7c1ddba94044558dbc4f3fc8bd 100644 (file)
@@ -25,6 +25,7 @@
 AUTOMAKE_OPTIONS = foreign no-dependencies
 
 if BUILD_DOCS
+# Get man_MANS variable
 include Makefile.inc
 
 CURLPAGES = $(man_MANS:.3=.md)
index 794f47b9f3fbbe385ec2c425f0246cd302341f40..d62d369a6692dbe38b814c6cfe5879fe911bb2c1 100644 (file)
@@ -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                       \
index e6fce14f0a10becba95379f2fb1aa480a05ed064..1e387898f722a4477885d0107eec9c609ebd43d7 100644 (file)
@@ -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_<tool>`, e.g. `test_lib1598` or
   `test_unit1305`. For servers `main` becomes `main_sws` for the `sws` server,
index 8cc5844227a0432c9ba1c089512abbb0d678b5f5..54eaf6e6d42a26008c706000655c6badd2b8e81f 100644 (file)
@@ -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")
 
index 463b72ed8e458c4dc1122f000e9635e4c3e1d93b..8306607e40d150c42abdf66d67abf1da83c1a2ff 100644 (file)
@@ -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
 
index 0b1ad1ac76fbfd09d1b1fd0ecf7d51565b8ccbc7..fd2546b1d70f0e335413a32d4ca10167afd371a9 100644 (file)
@@ -21,6 +21,7 @@
 # SPDX-License-Identifier: curl
 #
 ###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
 
 LIB_CURLX_CFILES = \
   curlx/base64.c   \
index eee661b7504eaffbb992949f3cb9e6b6d5888387..22c04e24c7fd780e4fa9d8b332cbb1534278e345 100644 (file)
@@ -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
index 4ad86d1c77441b033644fb817c509de03da9d3bd..c1878b12169f6e30e37f86bc1db14caf4ee8d85c 100755 (executable)
 #
 ###########################################################################
 
-# Helper script for "unity"-like support in autotools, to generate the umbrella
-# C source that includes the individual source files. Reads Makefile.inc and
-# accepts the variable name containing all the source files to include. Also
-# allow a list of exceptions that are to be excluded from the generated file.
+# Helper script for "unity"-like support in autotools and to bundle up tests
+# for both autotools and cmake. It generates the umbrella C source that
+# includes the individual source files and tests.
 
 use strict;
 use warnings;
 
 if(!@ARGV) {
-    die "Usage: $0 [<c-sources>] [--exclude <exclude-c-sources>]\n";
+    die "Usage: $0 [--test <tests>] [--include <include-c-sources>] [--exclude <exclude-c-sources>] [--srcdir <srcdir>] [--embed]\n";
 }
 
-my $srcdir = shift @ARGV;
-
 # Specific sources to exclude or add as an extra source file
 my @src;
 my %exclude;
+my %include;
 my $in_exclude = 0;
+my $in_include = 0;
+my $srcdir = "";
+my $in_srcdir = 0;
+my $any_test = 0;
+my $embed = 0;
 foreach my $src (@ARGV) {
-    if($in_exclude) {
-        $exclude{$src} = 1;
+    if($src eq "--test") {
+        $in_exclude = 0;
+        $in_include = 0;
     }
     elsif($src eq "--exclude") {
         $in_exclude = 1;
+        $in_include = 0;
+    }
+    elsif($src eq "--include") {
+        $in_exclude = 0;
+        $in_include = 1;
+    }
+    elsif($src eq "--embed") {
+        $embed = 1;
+    }
+    elsif($src eq "--srcdir") {
+        $in_srcdir = 1;
+    }
+    elsif($in_srcdir) {
+        $srcdir = $src;
+        $in_srcdir = 0;
+    }
+    elsif($in_exclude) {
+        $exclude{$src} = 1;
+    }
+    elsif($in_include) {
+        $include{$src} = 1;
+        push @src, $src;
     }
     else {
         push @src, $src;
+        $any_test = 1;
     }
 }
 
-print <<HEADER
-/* !checksrc! disable COPYRIGHT all */
-HEADER
-    ;
+print "/* !checksrc! disable COPYRIGHT all */\n\n";
+if($any_test) {
+    print "#include \"first.h\"\n\n";
+}
+
+my $tlist = "";
 
 foreach my $src (@src) {
-    if($src =~ /\.c$/g && !exists $exclude{$src}) {
-        if(-e "$srcdir/$src") {
-            print "#include \"$srcdir/$src\"\n";
+    if($src =~ /([a-z0-9]+)\.c$/ && !exists $exclude{$src}) {
+        my $name = $1;
+        my $fn = $src;
+        if($srcdir ne "" && (exists $include{$src} || $embed) && -e "$srcdir/$fn") {
+            $fn = $srcdir . "/" . $fn;
+        }
+        if($embed) {
+            my $content = do { local $/; open my $fh, '<', $fn or die $!; <$fh> };
+            print $content;
         }
         else {
-            print "#include \"$src\"\n";
+            print "#include \"$fn\"\n";
+        }
+        if(not exists $include{$src}) {  # register test entry function
+            $tlist .= "  {\"$name\", test_$name},\n";
         }
     }
 }
+
+if($any_test) {
+    print "\nstatic const struct entry_s s_entries[] = {\n$tlist};\n";
+    print "\n#include \"first.c\"\n";
+}
index 9cae87b01dbd1b75f14d30f0da7c1b2fb5c52bb4..0d095b942937afb54840bb0e6a5ba5bb55027685 100644 (file)
@@ -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")
 
index 2df95a0f94297199a032457c4034ee3575080488..0195c0b773051be3b01f1c16e57028ef88e6ca76 100644 (file)
@@ -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 =
index dd7ffc3575531081e95d33a63ad4d600f0f90906..c83154474ac2d3db020840657bfe474c436eb7a4 100644 (file)
@@ -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 :
index b198d89dee1c6aecd5a4ea9352e16d4c4fd17990..d1d5ad9d79e258eeb971f33bbab7c7535db93ac3 100644 (file)
@@ -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
index c0c1b2a99d9f431cb60f95e7d257d64649556854..ee35d4d464415e5dcfa792b0067da515938541ed 100644 (file)
@@ -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;
index 2ffffd275f6b9c615194ef59689d45368d66c842..31301b3b06161d19480d33db621c0b6407ff6b52 100644 (file)
 #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
index 3315090e2c9664b637ab8d25f38d5acef0f902c3..ed7c55e62e801bb7fe83c5f376b28c141b43fdb1 100644 (file)
@@ -62,7 +62,6 @@ EXTRA_DIST =        \
  http2-server.pl    \
  http3-server.pl    \
  memanalyze.pl      \
- mk-bundle.pl       \
  negtelnetserver.py \
  nghttpx.conf       \
  pathhelp.pm        \
index 2bc8e5ce07109bfe3d3fcdd3973d89afa21f690c..399483a738f25f9563bdfa33b786eb9551110a82 100644 (file)
@@ -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")
 
index 78303c2526badd2ea40e202a4b158cc9b5e0a428..c9e1e38c3de00ef33e3f81f041bbda423143286e 100644 (file)
@@ -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 \
index cc9514c20681af3c1ffa20d2103b3e96782f908d..2131172f4c8398d7d1c426aeecaecd2e6e4b9e17 100644 (file)
@@ -21,6 +21,8 @@
 # SPDX-License-Identifier: curl
 #
 ###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
+
 CERTCONFIG_CA = \
   test-ca.cnf \
   test-ca.prm
index 6588fe7fcde6bf7cadb548fd89c57e14319e95b5..5512c3f5fefe85d9823a0f86a45dede258fb3d6a 100644 (file)
@@ -22,9 +22,6 @@ internal hash create/add/destroy testing
 <tool>
 unit1305
 </tool>
-<command>
-%TESTNUMBER
-</command>
 </client>
 
 </testcase>
index 4a6ad5e9b0e794510b8fd1480d724380c5a70446..a93c07f02ffe709dafcc05f35fea440102b03402 100644 (file)
@@ -14,8 +14,6 @@ none
 </server>
 <features>
 unittest
-https
-pop3s
 </features>
 <name>
 unit tests for stripcredentials from URL
index 759e6828038b4a2bef05d445a5c2260893a7eb91..57998df96e247a966116ce7c648faaa837836b83 100644 (file)
@@ -106,7 +106,7 @@ Finally, this is the real page!
 http
 </server>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 915f76919b0c93968a7858174568b8d46d5e546d..376552f3fed8b7f8189cda71c4768cff417bbc8e 100644 (file)
@@ -120,7 +120,7 @@ http
 crypto
 </features>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 4794d3c0e9c443bd2ae414376338bf9aadb360cb..f9bfa93aac0d77fab90d833b535bddc8ceabd441 100644 (file)
@@ -203,7 +203,7 @@ SSL
 http
 </server>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 96e2ad4963412800b79701a158bb45f852fd12af..75fee9b2c21d5322298672558e9a84a4bef50dc4 100644 (file)
@@ -156,7 +156,7 @@ http
 crypto
 </features>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 45baa64bc03554cecfa3b70c47a87cd349c59073..f1348300777a6b73b958087f73510186001a7dc7 100644 (file)
@@ -179,7 +179,7 @@ http
 crypto
 </features>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 0ad03db587d09e6694f60a03127553620fdcfbc5..ad37813c860bb25a504240109baebc7b72e6f54a 100644 (file)
@@ -239,7 +239,7 @@ SSL
 http
 </server>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 616fec179d30f58cdf0891001f9915c7f205f352..8bdae5278733a084d58a8fe487838b13db97d0e3 100644 (file)
@@ -176,7 +176,7 @@ SSL
 http
 </server>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 8931ca749d41be177f802108776e5afc8a7aa605..f423adc84e503f4256a2c3310502de67e9d025c7 100644 (file)
@@ -228,7 +228,7 @@ SSL
 http
 </server>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index 20dd874131fee972a844967f2612f839992dd35b..b464b0b7a2f89fb52c7da37b7f4f7af625d2cf42 100644 (file)
@@ -242,7 +242,7 @@ SSL
 http
 </server>
 <tool>
-libauthretry
+lib2023
 </tool>
 
 <name>
index d3d199c14c1c6122906aa01bc1c06ccbf1d847c4..ba32820d6f20e354d21406937fd49e904afbabf8 100644 (file)
@@ -75,7 +75,7 @@ SSL
 http
 </server>
 <tool>
-libntlmconnect
+lib2032
 </tool>
 
 <name>
index 4c37772d5e6e3719eca72941a6956536327e3f44..1d548ef96da4472697058555f74d599ef2f25990 100644 (file)
@@ -27,7 +27,7 @@ http
 Pre-request callback for HTTP
 </name>
 <tool>
-libprereq
+lib2082
 </tool>
 
 <command>
index 9256151a862c5581d46c348ae0a3900bb5f903ba..0604d20c8f46d296cd751a0202bdfefb06f09aac 100644 (file)
@@ -21,7 +21,7 @@ ftp
 Pre-request callback for FTP
 </name>
 <tool>
-libprereq
+lib2082
 </tool>
 
 <command>
index ced7086c4b331dda1e43808447fb6a016a050fa0..00cbd67ccfa9a56678ed1e341d98af2fc40b964a 100644 (file)
@@ -27,7 +27,7 @@ http
 Pre-request callback for HTTP with callback terminating transfer
 </name>
 <tool>
-libprereq
+lib2082
 </tool>
 
 <command>
index 665a756c0e2dfb47791bfe02e561510a3cf5b79c..f229818a2d62df553237f01d2e4a40be253065ef 100644 (file)
@@ -35,7 +35,7 @@ http
 Pre-request callback for HTTP with location following
 </name>
 <tool>
-libprereq
+lib2082
 </tool>
 
 <command>
index c0dd97c55e5c1dce0408347e7e5fd4d958e07b89..2dcafa75df30862df3f2253be2bf4fafc4a2309b 100644 (file)
@@ -32,7 +32,7 @@ http-ipv6
 Pre-request callback for HTTP IPv6
 </name>
 <tool>
-libprereq
+lib2082
 </tool>
 
 <command>
index 5f7f413637d7a4cdd305c66ee2d334e80dde95e2..7aabd9d48def52546d5328ccf1978cb83fc50532 100644 (file)
@@ -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;
index f8a6a5face4bf8352585445453eeff2b06120bac..7e4590ccff44f3a49d1fc91322dce986de28fcd4 100644 (file)
@@ -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()
index d1acb95da1e67dc2bd9e46183377bd16b8c56e26..86a834e2754c8141ff50f335ff8b0cf430e3757e 100644 (file)
@@ -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)
index d0494a39040cf215ab991788b6e04e25493ae385..f11d42944c3bed3f443125143e2c9b263e6c70eb 100644 (file)
@@ -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 \
index 3c841934263dd6d24e998b4350ba75ca1db878a8..c78bdfd7661a7a9ff2c1943263096ba541fb59c8 100644 (file)
@@ -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
index e90337995286df525baa7810df77fcb760718d28..eb9188a52119a4efaa1d44ed6795bde1b60b9195 100644 (file)
@@ -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}")
index 07980f85261ef4f5b9c3bbe37a0f6adb6889c4c1..2d5329c7f4a95fdeec279ae3de2dac662fbbcbc5 100644 (file)
@@ -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
index 23570924515c56d799a15327acea62e0df84e08d..41c9441d11d4a465f5fd0aa621e1bfe96629c0e8 100644 (file)
 # 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
index a90c2d7f1e5e916c49c1fca9b5e55b437d2d354b..3a201fb6dea7dd12f4b8013f5866e669e89a300b 100644 (file)
@@ -21,9 +21,6 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "test.h"
-#include "first.h"
-
 #ifdef HAVE_LOCALE_H
 #  include <locale.h> /* 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
index acf00a3a896f70c7ad341116c8ab2e9738781804..514861671690c930ecd685ec19ccb4b06c44de93 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#define CURL_DISABLE_DEPRECATION 1
-#include "curl_setup.h"
-#include <curl/curl.h>
+#include "test.h"
 
-typedef CURLcode (*test_func_t)(char *);
+typedef CURLcode (*entry_func_t)(char *);
 
-#ifdef CURLTESTS_BUNDLED
-struct onetest {
+struct entry_s {
   const char *name;
-  test_func_t ptr;
+  entry_func_t ptr;
 };
-#endif
 
 #endif /* HEADER_LIBTEST_FIRST_H */
index 1db7c7d8679c6bc75ec11446e42cfe5018526319..5abd9016d843282d530dd23d38030260a6a79fc1 100644 (file)
@@ -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;
index 0a6080e7110e1790af396dfa2a6bca4b2352c7a0..81baaeecb1f7e195c714931194bb3d2baeed5f37 100644 (file)
@@ -23,7 +23,7 @@
  ***************************************************************************/
 #include "curlcheck.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1301(char *URL)
 {
   int rc;
   (void)URL;
index 0c70f3d6bcb5aeff127cae6a3baac29a8b261163..44620e13883893141052fab55870fd1edc3371c3 100644 (file)
@@ -23,8 +23,6 @@
  ***************************************************************************/
 #include "curlcheck.h"
 
-#include <curl/curl.h>
-
 static size_t print_httppost_callback(void *arg, const char *buf, size_t len)
 {
   fwrite(buf, len, 1, stdout);
@@ -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;
index c980dfb75c4f5ce13b54d1296b43c98f8c7e3c23..9a8e7a297a6f3c09ee93d60e4a68c02475bb4646 100644 (file)
@@ -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;
index f72b2dd720538f7d196e1be9738264d371031241..dc9e662399ec57879195f8f0a8eab5d19ad5c268 100644 (file)
@@ -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;
index 0644b837480348fd6e701667c32931b877ef04c0..0afbda1cf5caf053809df6af3d0bb3d81173fa65 100644 (file)
 #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;
index b118fd7786d7fda38a8c6bac3cb45c2f41b76f65..38783802f20868cb77d60c61ab12fbdf076a77c8 100644 (file)
@@ -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;
index 0a4507a211ad2f40651bc2d0936c6ec74877f15a..f63156dc9a2c6a1c08135e46feb89997e7c5371a 100644 (file)
 #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]);
   }
index f2f25f057a18c8214b2f0fb0c391cd2ff5d23258..edbce6ca2b8aba719932d032ff567311f5a4e623 100644 (file)
@@ -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;
index 5e8547bb8ac08096cf24af5d21f4afc865b6b64c..488242b56f7f41f47d49fd51d5e407b14cb8676c 100644 (file)
@@ -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;
index a289da56dcfbedb8cca1e2fa895047ce79c64e3a..ba74b2f59ed7e637f2505ddedf687b29c41c351d 100644 (file)
@@ -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;
index ec4c0baba36197842e957c1b7edf7356c0b58a0a..14d75fec07b21130f68c290d492d6c227250eea4 100644 (file)
 #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;
index abc1356e5b54860c511f82079a0359c702745663..0402421fa69350499b7e62320a066b6f3626cc93 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1511(char *URL)
 {
   long unmet;
   CURL *curl = NULL;
index 763694837d13d99e9061d46d5025a6b26e55bbdf..8bde4c94549068715dbce9776384e18cab493be1 100644 (file)
 
 #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;
index 9da57d967d552a17149672ea43c363c9cf65715f..2ca54ec12b24b3834f83abe407718bd35f3d7a1c 100644 (file)
@@ -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;
index 612fad8f4e9a2844c946c21e4d60a18a0efc08f0..68cf38417116a02f70be383f05339d7bae70afa2 100644 (file)
@@ -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;
index fda322e6043591e16648225b0e6b42bf849e60b4..7d98cfe61c7ca0010a8bda62309c6dc97e46374f 100644 (file)
@@ -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;
index 7d9e39dc1d4fb0b78526954d7fbafc4fb6cdd491..214a76928b03a8a6d649f109fd22e4a0d6f57136 100644 (file)
@@ -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";
index 7d8f593382ad3d03d86d7b2613a4c2ff98c28bf1..59a67d5bcae3382ed7ccebfa187a411e57284222 100644 (file)
@@ -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;
index 9eb28402281d53d3fee8b30542bb68f21bb5e800..68b1ca8914886454209f2379d1a90e01ca563820 100644 (file)
@@ -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;
index 6d3b8d5ea9ea3e27bb6cd74b93c0a45c8630d60e..5fe4283abc966b9f9498e6de49383db650b9f722 100644 (file)
@@ -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 */
 
index e26db4d1ef0b724e6925dab7e5301686f78e6094..4003e9faf4951f153024caaafd3f688b19ef4889 100644 (file)
@@ -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;
index 7802293a5cc046ae0cb4a1037fb6e3f293b3aec0..e015f3c11b12b040da77749ca78e629bba34c94c 100644 (file)
@@ -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;
index 487b2818fdbff441a897dc849360f0ce64de148b..492eeb103cbf03abe75af15fa512d00a50a3475c 100644 (file)
@@ -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;
index cc7151058acd21cacd79b3105a851890835f2996..4f710e9932311bfc2de6ef9d9892c245df834443 100644 (file)
@@ -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;
index 7cc21c7b0929f0ff9953f661928506afd804300e..1962749065b9e52192223e418fecf57ea9edbfde 100644 (file)
  * 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;
index fb11ab16526f7ea312293576e0ff5a4902311024..bcb56da0e975213a78212ec8fdd0451a1cc5967d 100644 (file)
  * 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;
index bb725eea66a2e8a3e98cdc1cb1958e5cc8f1f381..0c922eaf7fc4fd2a82c022c826a2bf031f4dfd61 100644 (file)
@@ -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;
index a33b9c4093b71569a3f9349cdc3d72fd945cbe0c..e3096d1504b16d5249e149c49e5459529d2dbe06 100644 (file)
@@ -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;
index c9fd4e66bc5869a40bb4410bd79ca133d8ff2a77..34e27a5a9adaf286b43cea83b36e755ff65aa4c9 100644 (file)
@@ -27,7 +27,7 @@
 
 /* Test CURLINFO_RESPONSE_CODE */
 
-CURLcode test(char *URL)
+static CURLcode test_lib1532(char *URL)
 {
   CURL *curl;
   long httpcode;
index 620405f04c64abd0cab53dfa660f8f52f2b452a8..9dc869d79fdb235ccb3eed569e82dead5ca50861 100644 (file)
@@ -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;
index 467691c032e97788615be01c3390fd568e71ac9b..e0dbee1022f63a8a3c538cb22f66359ab8b1c1c8 100644 (file)
@@ -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.
   */
 
index f999427fd621858087b3dc7e0248b9046afe2a87..b142882dbd4a70d216e3c1ce4f439fbe34b41339 100644 (file)
@@ -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.
   */
 
index fea7e1acf6ac03bf7a905faff2ceafc6664f544e..23ed716ac22caca8f59f71bd55c7cf933f97562f 100644 (file)
@@ -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.
   */
 
index 88f99bc60ebd4e51ed622e7adbef0ec42d0a6937..547f9ef7f2fa14afbe8b913f467c09312d94f20e 100644 (file)
@@ -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};
index e5dcec1f49b861c0df2f98a19f1a1855f46cf0b0..e00bf943755177dd26b1688db67a00f44db0e360 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1538(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURLcode easyret;
index 35e905c1d9a042950a0673428650e6d3526c1255..ac3271334f9adc1405b6435f7812289a756fa445 100644 (file)
@@ -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;
index a228da28671eecb657be712cd1e284fa18cce759..762b58145418680408a6cc3100ff15b68a78813a 100644 (file)
@@ -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;
index 5a8926585d8e6f8a0fdd093c4684f83687decef7..32ee236d95cf21182dc00ed632b3b2e8d6a66c9c 100644 (file)
@@ -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;
index d2709987e749e304eb8bc5bd4f6874e20ec00184..b485ab3f9dfda9c2d6ce3ee20d55e35a74ab3016 100644 (file)
@@ -23,7 +23,7 @@
  ***************************************************************************/
 #include "test.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1545(char *URL)
 {
   CURL *eh = NULL;
   CURLcode res = CURLE_OK;
index ddc0c16ab5a8602ceface8770d2f280afb21017f..994623d71a43099e7ddc44c834d6f477fdce32c6 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <curl/multi.h>
 
-CURLcode test(char *URL)
+static CURLcode test_lib1550(char *URL)
 {
   CURLM *handle;
   CURLcode res = CURLE_OK;
index 77834655adea5eeea37da884a30fdd14c5ca9b27..253eb2626c69f600710a2c68cc28c2c772f9dc62 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <curl/multi.h>
 
-CURLcode test(char *URL)
+static CURLcode test_lib1551(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index eef97038869a58266d7e9a0f123070643a3bfd9b..86fccf270e08256a71167e59e6b238afa0e0eed3 100644 (file)
@@ -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;
index e20f18831ff7773cd406366009ab58dcd463c01d..409835ac41bc312b0fc58cd24e20f451f8e08435 100644 (file)
@@ -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;
index b33d03d9c0b12d597c2ee626f9bcf4d322d7f6cd..825c52971d5c3db9ca9651ac3a69fe0a16dc12a8 100644 (file)
@@ -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;
index f66b89c89ee03f326d584f3f319e1ace8e44a262..02db62e5b56db5f5d504696941a1d75e1e2dd873 100644 (file)
@@ -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;
 
index 6bbf353e1ea41b5043a6093bb6825986a044eb21..ff7e1ea77824b8c3fa6e8526a1e62fdc8fbe43b4 100644 (file)
@@ -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;
index 6f0b99ac50daefc59df2f9552dc5800b1ecfb03d..9df49fd94fcafc742461f59519e212c5cb6ed5d0 100644 (file)
@@ -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;
index 9bb18caf8e432a683826c3b2d0221d4b9fb2bfce..8fa38abd0dfe412181af3f12fe5ea3d8dfaace77 100644 (file)
@@ -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;
index 19448afd8f320e27afa66574f6b57e8d3d3fb2d1..71d430f00f1f089b10bd05a38496c11b7b56b8ae 100644 (file)
 #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;
index af75b89ea818d54fa4ee3c010913bf4261dd6f33..f436cc15b59f704d1012e53da52bc1774be0d92d 100644 (file)
 #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 */
 
index 08a76d74f7a069a64924ea82c4a6ca5b6a542346..822bca54cc6ea85fa6da6db63a5a26a7952cd7fb 100644 (file)
@@ -29,7 +29,7 @@
 
 #define WAKEUP_NUM 10
 
-CURLcode test(char *URL)
+static CURLcode test_lib1564(char *URL)
 {
   CURLM *multi = NULL;
   int numfds;
index 992a3dead5cf17f280cfa9cbdfa4f14164013ffa..b03b17dec05d96d2e41066d78eee16c1eb2ba27a 100644 (file)
@@ -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;
index d1de1637a0ab07c9f2f3d8bdbd14bdca4e489df1..e519cd167de4d96fe424d16805fe3f68a1618cc2 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <curl/multi.h>
 
-CURLcode test(char *URL)
+static CURLcode test_lib1567(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_OK;
index 383d517a47501648219b327c80f47df40d9fccdb..b9c873cf440c76ba33a119d136642f38f0ca4bf8 100644 (file)
@@ -26,7 +26,7 @@
 #include "testtrace.h"
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1568(char *URL)
 {
   CURLcode ret;
   CURL *hnd;
index 767d8816822bd326503be1bd6d7a3c7f6907102f..3671afbad68901062a229cd78f6919736894a232 100644 (file)
@@ -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;
index faf178a6fbbe299304e1253e26302a94a48d57a9..77a89f79fcb1256060ed3161e2959e9589b4ad60 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1571(char *URL)
 {
   CURLcode res;
   CURL *curl;
index df34a9a205aa8274acfcb56e6110cdb82199b156..de87a25dc97d198c3cd52677f602818f7418d1ed 100644 (file)
@@ -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;
index ae341aae59842bb091483bc18317e19eccc94d9c..bdbe26dd97caeaaf0c54cc259074aa6218723b77 100644 (file)
@@ -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");
index efb42540702ced553c145396a2ef3995cea590de..3940233983d6ed4de1da350437cfd6a619b97f5a 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <sys/stat.h>
 
-CURLcode test(char *URL)
+static CURLcode test_lib1592(char *URL)
 {
   int stillRunning;
   CURLM *multiHandle = NULL;
index f5239fda4b7a84b6371eef223d3ef632e2c2817c..e723fed620b5ec899a192f4de11f5ca3adb7b9d1 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1593(char *URL)
 {
   struct curl_slist *header = NULL;
   long unmet;
index 8b469e6105c0c110a060156dfe5806e7ab06b92c..152a585569132f5a6b0a1f959cd8b105c3e20366 100644 (file)
@@ -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;
index f183d3e4288ab55e694522aa42aef28a645dfa33..02779887d3833d3c366bffada7e15994e406a397 100644 (file)
@@ -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;
index aba94129c9eefc347b837b9cb00381d8ee0cbf4e..d636fa4d34b4a2838b81ffe26211bc92f3ebdcfc 100644 (file)
@@ -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");
index 6d70de403587dcf45689bb19ed0e733653eba30a..ba389e0b95017d03dc074ab4db54d7b7e3e0e7ca 100644 (file)
@@ -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;
index 1b26e7b9867842fa66e44148d83c0199d5ce3c35..6a1d6343fd617cd0e42a0a145267a3a8dfb71355 100644 (file)
@@ -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;
index 0ae6bc5ded1a371ef19e4e12464eb0e6f26759fc..5aee9d3cf73b07faaf4f25cc44fec83bcd2e68c8 100644 (file)
@@ -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;
index 0ffbb14adc2de3cdbb3b716d33cae5f001fbf5ea..edd2a096197671bd383c8c3b3aeddf7dc8974b02 100644 (file)
@@ -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;
index df35de18b2033052f5502736563036454833b480..e7fbc366d0b32cf624f14c39300536944508b054 100644 (file)
@@ -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;
index 61996e2595190968b5b0b09c68a66958a376b575..e49d9bf304013eed5a13564fdc924202dad4b724 100644 (file)
@@ -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;
index 2cda08e02cf630dc25c7141da04d5d9910e562d2..f1d33c6ca69173196c287c5e42f347aa33b98157 100644 (file)
@@ -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;
index 3c7187c5bc0884469583c65c25c681a917bdca5c..e5f743adea0cdeb25a9c22b033fc1516498d1734 100644 (file)
@@ -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;
index 9d3f1b3ab0ed6dff3939882a138071579b5e67c7..c22244b6be43ed747e31c7252d0ef6663e35dde0 100644 (file)
@@ -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;
index 3621040ec8edc7a6a4857ab1427d5b8be7f2ee98..f6c3926be5fb8f2b3c23bed29a7a55dada90abf0 100644 (file)
@@ -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];
 
index 7aa2bb9adeaacce82f6ca52c20f709bd142ec930..70edc95a7afca51b0b13215a0221495fda429b9e 100644 (file)
@@ -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;
index 84684200574f4d78e91b1e4a296eb0e548151cea..637f667d656e57f039ff68952760f4f306569f42 100644 (file)
@@ -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;
index 4fd0354059b01f5165ad6f14043a3de36576f2ae..ec38eeabca366394a54fd72b396a17b5706f7ed1 100644 (file)
@@ -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;
index ca9bdea34b6508092c2377da4433d154f97b7a7d..c15db6331560124b801f166ef2548dc2809af03e 100644 (file)
@@ -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;
index 359c64e472785ed7aa403b7b2d42b5cdac714d2f..e50ac8ed015cb0ee2109ce10f81e4991f209e62d 100644 (file)
@@ -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;
index 68ce7a194bcc808baf6f8526a0b60852e4fb79c0..faf172af37a943863fd483d1774c560dd2bcf09c 100644 (file)
@@ -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;
index e5d2af5bf615912527455193b698671b94642d7f..6cb4509d7cef103c6c6200b4c149ea53a49a774e 100644 (file)
@@ -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;
index 92c442af468749d15d3244559105215692dcee82..7f10aa505cb0d8de4f7523e4234f163335de722e 100644 (file)
@@ -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;
index 7efdeac219e86d1bd16aaf1614f191a71a32172a..b515ed205e31acfffe228848059bf7ff1ef1a055 100644 (file)
@@ -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;
index 83124840b66c3655adf799c62109dd9a4a4a3bb1..327fa9f2be04376200d94a4a8a0a3d771d3e1233 100644 (file)
@@ -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;
index 1d1e093da7208e81dbd658549e850a8924e0c9e9..acfb5eb4e918058c2ea6d8d6b5560a6d6c79e219 100644 (file)
  * 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;
index 7084d95c032766266fd674558790cdd08c88e701..a5e9e7f73a40479a978886866fa4469f210fec4c 100644 (file)
  * 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;
index 680b5c236345fa22557a4c138ea380de842b7027..260da18110ae606ae93b9d18f589fe39f5323756 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-
 #include "test.h"
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1939(char *URL)
 {
   CURLM *multi;
   CURL *easy;
index a7b8f5b168802571752ed800656301fef0f93eaa..03cdc9d546c00abad947603e7d66ef87782c428e 100644 (file)
@@ -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;
index 8bb87a28d73a2612953c51d23d01d13ad0a251e3..ff2e670cf9b106b7157001b6cff58b73825b8179 100644 (file)
@@ -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;
index 9d9559a1424620d03d8981bf5ad0cf46b2e0f3bc..5dc305343ec01fc12b3fd3df0deb9897305c7799 100644 (file)
@@ -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;
index 766b1ecd5592e77a23547722cc6cb9675609fc80..10e762d8d06c98809b17e04691dacba501a1e268 100644 (file)
@@ -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;
index ff496f7a6229f4d3fd9607e6ccda1186da88d767..aef6015ccdad7e4a219d192a74f1125c12159932 100644 (file)
@@ -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;
index 9140278584857fbb399942ffc92ffbbece21120f..c1063fefe194b9da504d6bcd16ce57439858a3af 100644 (file)
@@ -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;
index 37e3032266300537628d5bec319d69457f3d7400..c6ca327de5c81c34fcb6e9b1f31d39d5dc1a2865 100644 (file)
@@ -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;
index a276b734ef4f7483c283a3eaa34fcaa5c3556d0e..8073e3e85e3cbf24c21dc808fec2d4d6b648d184 100644 (file)
@@ -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;
index cddefbb095052919eeabcf787e2b3a5dec5f8182..f5db0e5c65e090f10cbd361f105df9c4a3d594b1 100644 (file)
@@ -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;
index 509515e3cdbdce28a07e5b4b709e1e4fd0b01b93..7b6a72df259d208f91fd391787968acc245f813b 100644 (file)
@@ -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");
index ab8cbd750ff6fc2291dac082a6add6d41712e122..f0adaf0b96d49f46e9c4f22795329adc8e71200a 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1964(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 3131f9d303c10e88553bfab4220c452218156c6b..f7834958aadae782194279a45cdc4e097bed1e6c 100644 (file)
@@ -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;
index 4bbdc207aefa07b77c6060752e5941a6bc9bdef4..6bbac5758178aedec63880f5ea7f9ee40c8729c7 100644 (file)
@@ -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;
index d711e9b3a5ee56a33a55ee5754df75fefc5bdd19..65a581d611ed5f7a7406ac5ea920f605b529c09f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib1972(char *URL)
 {
   CURL *curl;
   curl_mime *mime = NULL;
index d4b5155c477662d0b272213162f4f11dc0843d26..b2a4a7f7ed5a66fe4fc2002d6d69fd993445f163 100644 (file)
@@ -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;
index 0cf96261034edb2731adf0def8342f1ff949ae60..75a92a291587c71f6933509241f20fbc03440827 100644 (file)
@@ -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;
index ade53bc47752ce99ee533ccc36763ff167c0c458..f7dc16e170e701ece3465260f2643b8b7226e092 100644 (file)
@@ -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;
index 5f030f493e00516b8c319cb6d52f056cb1e0fb26..3c5fc7eadaecc4a878384b281a120075ca141996 100644 (file)
@@ -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();
index 2647019b89ab1d19a5325142843f359d488da81d..7fdd11e262650d5f2a4240e91d48d7711a34e5ac 100644 (file)
@@ -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;
similarity index 89%
rename from tests/libtest/libauthretry.c
rename to tests/libtest/lib2023.c
index 6481844699bdd89a5a686ebf60e6a5abf884bd8e..2ad7f694db1b326f26f31bc10ef72e9cdf73306c 100644 (file)
@@ -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;
 
similarity index 92%
rename from tests/libtest/libntlmconnect.c
rename to tests/libtest/lib2032.c
index 4586a51896b9e3c607d39c6329ae57d5ea6d8312..61c191afaf370f2d0b4c85ae18d3be7015df7569 100644 (file)
@@ -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();
 
similarity index 98%
rename from tests/libtest/libprereq.c
rename to tests/libtest/lib2082.c
index 76164199e36a9b38640283de56465b7c2b29ad12..cb4af87ca6b3b51dadb8b4f413301fd0322305f1 100644 (file)
@@ -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;
index 8603f314141799223ed9a006346833c8dcd6906b..da3f0e53317c02c6d1e34d04c6c229a1b13a7e37 100644 (file)
@@ -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
+}
index 010e3b09116ffb89a4f0aa8dc659d419638e88e7..9e302fdb8fb9f7d73526caa5905209f4854b1503 100644 (file)
@@ -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
+}
index 9c2828ca84ed6a4028721fc1498fcf0e4aff084b..f3091ee1a3be0188f8b7961e163329946de8e5ff 100644 (file)
@@ -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
+}
index cde75193315892531ed28d5198abec50f41d1f55..6dcd982924c36b5ef7bb7296c5985cdafadabd72 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-
 #include "test.h"
 #include "testtrace.h"
 
-#include <curl/curl.h>
-
-#define URL2 libtest_arg2
-
-CURLcode test(char *URL)
+static CURLcode test_lib2306(char *URL)
 {
   /* first a fine GET response, then a bad one */
   CURL *cl;
@@ -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:
index 68f1357d3f8b49c09c3c1ed476c91dbf2c7bec9a..b91feef3a5653cac8dc56d17105a1170656ed981 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-
 #include "test.h"
 #include "testtrace.h"
 
-#include <curl/curl.h>
-
 static size_t cb_curl(char *buffer, size_t size, size_t nmemb, void *userp)
 {
   (void)buffer;
@@ -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;
index 23519c29c645c848ca446a0f0371d965fd5feb05..885896156945388c15b8492e84e7eb7a4b07d5c7 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-
 #include "test.h"
 #include "testtrace.h"
 
-#include <curl/curl.h>
-
 static size_t cb_ignore(char *buffer, size_t size, size_t nmemb, void *userp)
 {
   (void)buffer;
@@ -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;
index 808b96629019bc3c407c02c26786f40edcc1b325..be761793b82a5f784b702eb6995a7575c346df29 100644 (file)
 #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]);
   }
index 5876f766757a07f2f1f0e7b991b078bddd70386e..2737a267ba7ecbd637b94577eee4312b294b10e1 100644 (file)
 #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]);
   }
index 3d6919e298eca388b92ce4662d4f474831028dc3..c2a8ccd41b7cf08086b3a2bbbb0c12d811539561 100644 (file)
@@ -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;
index 99cb8ed37a19f2ccbc87629720820bbf75f90eee..2047e4753f6ebc46f9f7fb9207f0160b76111b75 100644 (file)
 #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]);
   }
index ecec6809c9f6b4d3d70f3f57ee8edd0301d128dc..53f271a17f64ccd78f7328431030f60f81c0227e 100644 (file)
@@ -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
+}
index dbeb3223d196b055e7c8c767bc13249e273f343b..6bc6678c0c32d556efb91734a5657da7afb27dfc 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib3010(char *URL)
 {
   CURLcode ret = CURLE_OK;
   CURL *curl = NULL;
index 41929500bca95a90506377c2e98c3fb5648a0dee..37f1d9e86074896fd0f139a7a3fd5d121d9d3a39 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib3025(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 28580e995679db4b2c29da6d73822c1a5e85bdd1..a5b442936dd34803468af50a326e39625542548c 100644 (file)
@@ -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;
index 4ddee1b6b29f155f5000bf1e43a69c625c473c5b..f13e35b6451cbff816a2ec02f49192b741e6fa6b 100644 (file)
@@ -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;
index 7a1037b6e385e8bfc9fd7c473b40ff9ce00dcfce..77aee5b151f057021c80554344f487bc483210ab 100644 (file)
@@ -24,7 +24,7 @@
 #include "test.h"
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib3100(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 13e977313de70cdee1720a165cc184b690a3db2a..a7d8abf4cb4e264bfaa398774c0fdfbcda062bdb 100644 (file)
@@ -24,7 +24,7 @@
 #include "test.h"
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib3101(char *URL)
 {
   CURLcode res;
   CURL *curl;
index df95bcd6ee263453c2c3a4b28a567567098c7636..1adbbeed70a36c72bd3215b06372c856401ea9e4 100644 (file)
@@ -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;
index cad9de7ae38351cb656c740959e001344959a958..2ed9acafc74967f2c0cdc4f99a8147dae09f4929 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib3103(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURLSH *share;
index da92be5d47af96ab46f9f13fa3454163bad4a40d..0dbd8ef9e53d2dfd56a7fcf80b73b25754e6f48c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib3104(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURLSH *share;
index c8a1a78f069554e3008504c303f6dbc682bc8049..0252cd9da29b6e24d9c923e15c2fa6eb037de9e3 100644 (file)
@@ -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;
index 294c8e62406021d505fc2ac62bf5ed0cd9784565..bc144ae06ab5c2e9bd97f082a7f5430d2547302e 100644 (file)
@@ -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;
     }
index 846e8fcf9b3fb622ff70db2b0f35b55f9c76dbde..8be16c8080fccb9c70e92d132cc2096a08e61166 100644 (file)
@@ -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;
index 425d1ef16f674bdec1090b337ff4c7707af9396e..70e6e3f811c3efc77ce7f3795b16cdcd40dacf8e 100644 (file)
@@ -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;
index c1aecdc56c199f4e9cc3d9c9d10e53629b30b9eb..36f0434e68ad41aca70a4008201dc5b5b64058c9 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib501(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 0a0208294d347c0ad965f2f17db276e8d04eca31..108a885f21d3c6e4c0569e2532e6d1a370ad440e 100644 (file)
@@ -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;
index 4356f5aad48202d4d04b812f9e5e299b9d9c085f..7c6e06ba0fcde1e852e31245c95fcbb57f672f0b 100644 (file)
@@ -35,7 +35,7 @@
  * auth info.
  */
 
-CURLcode test(char *URL)
+static CURLcode test_lib503(char *URL)
 {
   CURL *c = NULL;
   CURLM *m = NULL;
index 989fa4dcf7a5e6f7e1424be0992301adaae9c9fc..cd14a9b019e322b01b1f6777b9c2221a3663914f 100644 (file)
@@ -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;
index 5c3799a230eec6575362eec4023a7118aed26aca..3c4a710c00efc5c3f754171c529d3fb908cbbb60 100644 (file)
@@ -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;
index 89a5ccb5abf60a21dea1eff32f472eeae483d6ad..51c8ff09c5d5222d9e271bae368b0fbcea5e1113 100644 (file)
@@ -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();
index 53b554d19453f3e6465afe08e2da7e8772f658b5..58322b435202c724a2c4fe83ef33ce698cb251fa 100644 (file)
@@ -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;
index 968125c28d7a392204050fdde109561f28dfd1c3..0e11dae26fa78c65495155638eebe2da3eba9be2 100644 (file)
@@ -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";
index 3b2a93207770deecda70ce0fb4b87c29860eb471..a508ac07ad5972caca6b2de99e1a41f90f5a1086 100644 (file)
@@ -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};
index 0869b04abf1358436d2fc7628c38f293da7cf4d8..7c84bc5bab6284bfb87001f4c2c8f8ad27efed84 100644 (file)
@@ -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;
index baa704a746a48284b7b61ed9fa7d29b6d5e72f8c..e92cb4cb3615ee009bdc8f1215808eb028c9a7c5 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib511(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 02e0d487c3e1e7e28131c6e6045b7547d52af3ec..c2df03505904b57f06eada1e11a5cb6252b0645f 100644 (file)
@@ -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;
index c0153f0247adfee24dc9d7a5c3674933f61f7955..a5b1212dfa46e065e8d518c9147c0d59bb82dc89 100644 (file)
@@ -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;
index b0dadf21af62de116bbb37bf6973eada43f04f42..ebc3ae67d8ec67cb3a9867a48aacb6d21832ab31 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib514(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 4aa7245ac925d713b9f1ff72f586fc2da6ca52f7..c7a1954d3d23bbe181e0e038bc727255fbaad8e3 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib515(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 60eb4e4c70dfee4acb32bf05ac7a54ff7d105ecf..48f1dba519606780ae640153f54b0ee68af87ed4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib516(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 32175d00eebeca60682941a7f36ba622b50c429c..6a0a559259a12857f1a4b414ec1e91e30398589d 100644 (file)
@@ -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++;
     }
   }
index f9df1b4b4f398db3647f0c2513a74fb1d6230d74..f31786ce6ca6d8300f597f2239d30eefcce84660 100644 (file)
@@ -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)");
index 2f92f73864f6e894d4ed92fa935c60fb88a6eb33..baae719ae6c31b6aacb22cf51f62e8d4e1d11e31 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib519(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 81552019676762f1c1831cb29f552114a98a7521..5d76e0df1e3b90ee9f574bf8ba8fe3d2b670d2dd 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib520(char *URL)
 {
   CURLcode res;
   CURL *curl;
index cc1863d148d6b9c5452c2c461be695316876b704..156f156dacde26cf472ebbf0d2e72cd06af970f5 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib521(char *URL)
 {
   CURLcode res;
   CURL *curl;
index f130d7abaebbcab5405905d0a964270929e670c4..6ef2ce081864b122a31f27fa5468a8b7874a5c2d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib523(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 830c0d7776be432e5acbe6ca2a49e9763103114a..e727985e23cd75fdf8ed6d764651d9b76fa0ca04 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib524(char *URL)
 {
   CURLcode res;
   CURL *curl;
index eaf78411b1d7999072427ccfd7d04056ef9cf7f0..a34a197c111cdabedb5f152c59ba1cbc4033bd2e 100644 (file)
@@ -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;
index d8ce329467d1b2a972611ec61733b57a81d57a19..c30070fc846cee9d5ae6883417b60fe3c8022a1b 100644 (file)
 #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();
index 83216f5b3dd86dc95f8e9fd222b8597ad7122ee4..331edf36401549179cfde7e7001ce1b508225632 100644 (file)
@@ -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
index 5ac43cd6bb4d0920205dc63f4fca4eef08214587..c22dca3c54946a0ef8da8ccc8c72320b889afa6b 100644 (file)
@@ -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;
index ce1df9c0dc5e6f82b699c27c765fa29cc48c137f..c5d9bc21d00f7917fb03b2299ee9d17687833c6f 100644 (file)
@@ -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;
index 9bf0a7eb5298fb6e3921c922ce75374e9e50f749..dd2fa2ac10c80a4634e0d30bc49314816cf3f541 100644 (file)
@@ -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)");
index ace839d03cafb120ca5428601f54078a84fedd31..b966e0c0225c829aec0e4580e37d9fa1e9efc2c6 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib539(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 1568eee534e27d25868c9801fde0c398f95466ce..91ff68c1ff2333380e867393e1914aabb3d58b78 100644 (file)
 #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]);
   }
index 1215206634c5884a62894595948be845b9fc620b..4a78c92ab3601c24b0470bcac435671a12e4869e 100644 (file)
@@ -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;
index f48c26995ee8be4495da2c357d8f03d0b149dc91..d8f4f35057fd27019f259134c1c4727b430cffcd 100644 (file)
@@ -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;
index 8f8d4fd32a64adae3119c3d6b57ff93960a72620..e568bfc2b86969b3f1f7eb3a76efdd21d4d2ce82 100644 (file)
@@ -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,
index b12e3483e6097665ba64c32b1d5bcf8ebf800fb2..60fb63d7c6f83cc6ff48f2d87558e9bf2ed45ad4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib544(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index c24619db5795b461cc165b9e349b17d29caea41b..e57fa3172d1ccae3ddca23d0c2e492680ebc9dcd 100644 (file)
@@ -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;
index eb5f4e313d4b0e2bf860693b53877dcb43251b12..a0ffa139b923000e772338bc62b6e00fc5520364 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib549(char *URL)
 {
   CURLcode res;
   CURL *curl;
index f6216da1f8b614e03700e5db93b50050c7f21bfa..3db4e77c95276828526cf1589f6e5e26c6a56d11 100644 (file)
@@ -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;
index 111da121259f5ee08af10ec5f3ef73f5f3ebb49a..af9e903b09c131b07b3ede22f1dfd147a18a3037 100644 (file)
@@ -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];
 
index f5df319ec01252024427c0909343ac22376db261..c9d62e0d55ce150b4ab2ad9aa418e8938141b614 100644 (file)
@@ -192,7 +192,7 @@ test_cleanup:
   return res;
 }
 
-CURLcode test(char *URL)
+static CURLcode test_lib554(char *URL)
 {
   CURLcode res;
 
index 70cbc903601233d6e485a9d285107f3e7b5f32c5..9ab7cc9d2c84c7e31b4932cd40daf78c94b1077f 100644 (file)
@@ -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;
index e3daabd4a7b908591c41561c6a12fd8daa6dd7b9..2aacf5575640d73abc1444863759fb96134f6ec1 100644 (file)
@@ -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;
         }
index 6eaa733e21a3858f992c82669bdce5ae7f3df9e7..aa6edbda275618fca9aa347017caeb797f2e1f77 100644 (file)
@@ -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)
index 3f1724a1e332dd368dac1b44d229e2151c9e4e23..9b7ef56dfbc023dba029ec9028450ca878fac1ce 100644 (file)
@@ -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};
index 621b90e611195d66faf091fe04b5c943410a3a20..cfd2c914b24d4a09019632e3c597636129570edc 100644 (file)
@@ -26,7 +26,7 @@
 #include "testtrace.h"
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib559(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 6d392e6a4f9f7d3226a2c1ff520aff3f1704f3ac..bc4f53721821238f1e4179ecf68c69388db820e2 100644 (file)
@@ -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;
index fa9c75bac6454725c75f3691c6f8efa097b9ea5e..5c6671fe12c36e446bbc49c4eecf2f09e73b9b19 100644 (file)
@@ -37,7 +37,7 @@
 
  */
 
-CURLcode test(char *URL)
+static CURLcode test_lib562(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index d1c819182e2676f1131d1d1799327a4d5d4d8c70..6ff749f44a7ae7963420f14a71e22ad6538ed2ed 100644 (file)
@@ -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;
index 3ed609f67f152401b816c056adc5ed49dfcc2129..cf4ed0db3e47bbb5b6cbeb253b50553398f37cb3 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib566(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 9c36cfa420fed40b1e8f274a6abbf28ba3ce5280..c6b8a3319cdc1f10915b8620f95e3256ad25d673 100644 (file)
@@ -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;
index 76935e01b1b2ce5feac85e49c497fc73286361a5..59d37ec84eaadf5841fb4a12a03ddef5caa2ca4c 100644 (file)
@@ -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;
index 6ee9c15d36ed751bb788ee23289d19349a8b97a4..aacaa383282ccc386837f78d35812dd4a485a130 100644 (file)
@@ -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;
   }
index 8c7831e5a0734fc1e8dde6d7bdd082f1a98887fd..30f2c40db5fab0ac829b32c698dd59426f09cb45 100644 (file)
@@ -26,7 +26,7 @@
 #include "testutil.h"
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib570(char *URL)
 {
   CURLcode res;
   CURL *curl;
index d0025486b1766d2923ee9df44b9ee594812967bb..392bb698888bff7b134d3f2c404301e0cae03c80 100644 (file)
@@ -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;
index 8f5d2f1d46930eb053dda69c9d33b651a29ab23a..9df4be847a510cb080270fc1434a50dfb100eb3e 100644 (file)
@@ -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);
index bcd0e90bdb00412a5ca4cdbbba47fe20daf562cb..2e3b40fc0008c637a26cf4919d9257a10c63b17e 100644 (file)
@@ -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;
   }
 
index 696668fc6ee080bb71c544f8f055fd5d038d483f..4c78214548f967a5789e759224cf48b55a01e524 100644 (file)
@@ -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;
index d02e64aaee8b10d2492071cd2b615ddbe4045a33..7db472b5fce93702e61853febda56e8dcc95762b 100644 (file)
@@ -35,7 +35,7 @@
  * 3. with multi interface
  */
 
-CURLcode test(char *URL)
+static CURLcode test_lib575(char *URL)
 {
   CURL *handle = NULL;
   CURL *duphandle = NULL;
index a78e7b8ab311fe494694eed8d73336924e569139..e0765415b092fe633aea5973a82dd162359e99cd 100644 (file)
@@ -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;
index 9fd6aaaea3fe350faf0c6960e026eb6b5a6973ab..5b987febf1ce6bd9311b5377eea1855df809e211 100644 (file)
@@ -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;
index e6f8945e4206e706fd8a8fcf4a33bd5e2b860fb6..c1d8f2fd1201c078ed9165b98343945a3e4fc46a 100644 (file)
@@ -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;
index bb1fb5e6114f68c2778049b010d7f3f930ff2da6..676ad69f4c9278681be5084f123a24c3eb556412 100644 (file)
@@ -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;
index 8ddcaa317213add3ae6f031cf14394a9c11228fa..8e41e298e3caca99625919be2e272f4aff30b2b6 100644 (file)
@@ -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
index 1cb3cf0ab91e2ac5d609f8c437191246d35e81f7..2bf21ba0b95fcc1aead33aa15799f217f8bb7d33 100644 (file)
@@ -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();
index a58f7041064106d43dc462532100bf43317f272c..94eb911b5ff3d9958d3cc8b76e302e8bd0562b19 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib589(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index caa50ffce3f7eb3ee56f190342669baed5c10c03..b9f0377fbf0b4cef919d5f9665e75da86996042e 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib590(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 1f75770920a897aef2d4fc8de60c74b7c4b4f6dc..11e82632d3478651d5afab85fa1306932c714528 100644 (file)
@@ -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;
   }
index d040f9a7813518a6ea05c79246f657c9bacc1c72..33e290ca3c1fae1d74ccb6a8912b60e0d2c291ab 100644 (file)
@@ -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;
index 96d6662769c442881fe6652286b0b2a9528fb464..2cf5fa37d7938162b5e8fddf80abca74b3e52729 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib598(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 9525dbbfe40ac80f12d7853ed6602327c3487a98..c22e925b1745df8e7f0be401975f19564ce3e1f9 100644 (file)
@@ -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;
index a3e8a714a97fa772578716eea80ef7e9d7a780ef..6428f99822efee76a61a3d5345f5ba47c2f40fec 100644 (file)
@@ -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;
 
index 4fa1571be1aa214507a78b5c79a3e67ba92b8d35..856670ffd44017b3af8f7662134fa598a171c3fe 100644 (file)
@@ -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;
index 84e8d89fe890a1ac90a7a667a21b365d81240c4c..6b5f9d5e4fda1b8fba5cd2e20f9655d1ed7d6015 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib651(char *URL)
 {
   static char testbuf[17000]; /* more than 16K */
 
index e01fbee54bfb2e7bdc1dae50b929f7e3c6884df6..c3f11f147fc0444d40c32920a9a640765b6e2121 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib652(char *URL)
 {
   static char testbuf[17000]; /* more than 16K */
 
index a1be0df1606a1f815bbc463b5ed81808dd1f435b..bbc3c4478c7e8167f9915d98637e4e0fa9815aff 100644 (file)
@@ -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;
index 72236c249d6aa77c8846ca2bfbfbd77ca8ce0675..69223643bd9186dcc0457b221043c8c83feec9ea 100644 (file)
@@ -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;
   }
index 238837fe96f33b0a6d1ba3df406dc2c30567663f..0915da3dd3424c82fa699f8326f2ceb2f60c20a9 100644 (file)
@@ -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;
index 6254d528c5154636950fe4fd4dd41294d2b54840..001db958882694e8035fd5d4b0629796d8858ed8 100644 (file)
@@ -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;
   }
 
index c14173db43ff013a4f768de9b17bf8aeafbf0798..4b721d8ff4de4e91f70819ae8eca97479fcc5560 100644 (file)
@@ -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;
index 170237671a8b8b4d51551a372a39b596ea85af04..5c8d839988f8597986c67818321b623c8ef64fee 100644 (file)
@@ -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)
index d27825cae385e93df765200a19c23c24d7e2a194..5696181e1d3112ea940b5d9b4ceabd7df8c62c3c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib666(char *URL)
 {
   static char testbuf[17000]; /* more than 16K */
 
index 2febda615d465b020ffb15e01af3ac0c9723544a..999f7039093f6c3396f9d87e0f5adee1f8290162 100644 (file)
@@ -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";
 
index 7f2b299f2f1cec1027bba28d8e9b28d3993497d1..cdf09f618a3d91e65b00f45cb504dd8d178fc96b 100644 (file)
@@ -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";
 
index 051142a48824eb6d1c2404fc1e3606b5a171b373..981a4e92f9e6997c5b2a106c2145fca28850c322 100644 (file)
@@ -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";
 
index 2a979a223cd4747a83af2a840da8605e8a8567e8..be737b2ebce37a79feb5247cd4d84998cebb5d2d 100644 (file)
@@ -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);
 
index ec2b23576ec8777af279899a1c3f3bf587503c96..f740b576a0d9f4363043a4156419db0169990f70 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib676(char *URL)
 {
   CURLcode res;
   CURL *curl;
index 34ecf2ba7ec2379d7888bb6e938db9fe45073af7..a2e739f5845af3a6a4a6c1ba9e8af5f492b92635 100644 (file)
@@ -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;
         }
index c5646502c3de8c80346313836eefddbfe709b75b..98e982f1ef071ccd6b7a0791415e06c4df645aaf 100644 (file)
@@ -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);
index 81c0fcc9571af2361df06fd2313cab42ca59a40a..fd1b18b52e7a9c9c9f9b645c3556d80b00cb91f0 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-CURLcode test(char *URL)
+static CURLcode test_lib694(char *URL)
 {
   CURLcode res;
   CURL *curl;
index d38c5e436d8884db16080b38a69c765839cc274f..7769fc11e7fe9e1e0ca7deeb227b4b6c3b24d62a 100644 (file)
@@ -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));
     }
   }
 
index ab2f923b959d6abdc67e5763df75f10a7b8f3035..ae370721c1c1b385d9774e252e9a81a6ef94506d 100644 (file)
 #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;
index d083c3902515a6c2527201447fd884e2cc80aa21..95e38c4c02aeedd194a446ca3b5e7a77c7346397 100755 (executable)
@@ -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;
index 9d57f7a51c66dc2a2cfa00972ec5019ccbcf4671..369e9c6f045b099a6308610971aa874ce8aee742 100644 (file)
@@ -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 <curl/curl.h>
@@ -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
index 36942124d28b94304421b498a450eceda74eeb23..53c2651c6b90fe7850eaf308b45362ee45081041 100644 (file)
@@ -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 (executable)
index ff4c7ad..0000000
+++ /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 [<directory>]
-
-use strict;
-use warnings;
-
-my $src_dir = @ARGV ? $ARGV[0] : ".";
-
-# Read list of tests
-open my $fh, "<", "$src_dir/Makefile.inc" or die "Cannot open '$src_dir/Makefile.inc': $!";
-
-print <<HEADER
-/* !checksrc! disable COPYRIGHT all */
-/* !checksrc! disable INCLUDEDUP all */
-/* !checksrc! disable UNUSEDIGNORE all */
-
-#define CURLTESTS_BUNDLED
-#define CURLTESTS_BUNDLED_TEST_H
-#include "first.h"
-HEADER
-    ;
-
-my $tlist = "";
-
-while(my $line = <$fh>) {
-    chomp $line;
-    if($line =~ /([a-z0-9]+)_SOURCES\ =\ ([a-z0-9]+)\.c/) {
-        my $name = $1;
-        my $src = "$2.c";
-
-        # Make common symbols unique across test sources
-        foreach my $symb ("test", "unit_setup", "unit_stop") {
-            print "#undef $symb\n";
-            print "#define $symb ${symb}_$name\n";
-        }
-
-        print "#include \"$src\"\n";
-        print "\n";
-        $tlist .= "  {\"$name\", test_$name},\n";
-    }
-}
-
-close $fh;
-
-print <<FOOTER
-static const struct onetest s_tests[] = {
-$tlist};
-
-#undef CURLTESTS_BUNDLED_TEST_H
-
-#include "first.c"
-FOOTER
-    ;
index 1f2ff73328bd1ea5fb112117fc31d806d7571572..324c49dcf7a2d10a40092da878e52db552aac717 100644 (file)
@@ -909,21 +909,15 @@ sub singletest_run {
         }
 
         if($tool =~ /^lib/) {
-            if($bundle) {
-                $tool = "libtests" . exe_ext('TOOL');
-            }
+            $tool = "libtests" . exe_ext('TOOL');
             $CMDLINE=$LIBDIR . $tool;
         }
         elsif($tool =~ /^tool/) {
-            if($bundle) {
-                $tool = "tunits" . exe_ext('TOOL')
-            }
+            $tool = "tunits" . exe_ext('TOOL');
             $CMDLINE=$TUNITDIR . $tool;
         }
         elsif($tool =~ /^unit/) {
-            if($bundle) {
-                $tool = "units" . exe_ext('TOOL')
-            }
+            $tool = "units" . exe_ext('TOOL');
             $CMDLINE=$UNITDIR . $tool;
         }
 
@@ -934,13 +928,11 @@ sub singletest_run {
 
         $CMDLINE=exerunner() . $CMDLINE;
 
-        if($bundle) {
-            if($gdbthis) {
-                $cmdargs =" $tool_name$cmdargs";
-            }
-            else {
-                $CMDLINE.=" $tool_name";
-            }
+        if($gdbthis) {
+            $cmdargs =" $tool_name$cmdargs";
+        }
+        else {
+            $CMDLINE.=" $tool_name";
         }
 
         $DBGCURL=$CMDLINE;
index f95b4416e4a000514dda5c8e8270a0fdf4269095..3f9f80fc2093fe3bce200283068fd401f9eced72 100755 (executable)
@@ -882,7 +882,6 @@ sub checksystemfeatures {
     logmsg sprintf("* Env: %s%s%s%s%s", $valgrind?"Valgrind ":"",
                    $run_duphandle?"test-duphandle ":"",
                    $run_event_based?"event-based ":"",
-                   $bundle?"bundle ":"",
                    $nghttpx_h3);
     logmsg sprintf("%s\n", $libtool?"Libtool ":"");
     logmsg ("* Seed: $randseed\n");
@@ -2503,15 +2502,6 @@ EOHELP
     shift @ARGV;
 }
 
-# Detect a test bundle build.
-# Do not look for 'tunits' and 'units' because not all configurations build them.
-if(-e $LIBDIR . "libtests" . exe_ext('TOOL') &&
-   -e $SRVDIR . "servers" . exe_ext('SRV')) {
-    # use test bundles
-    $bundle=1;
-    $ENV{'CURL_TEST_BUNDLES'} = 1;
-}
-
 delete $ENV{'DEBUGINFOD_URLS'} if($ENV{'DEBUGINFOD_URLS'} && $no_debuginfod);
 
 if(!$randseed) {
index 1dcd028f6d80a7b1c21b498cfa1ec9a3ac601982..8f6424697efdfe7ba684e8468d0dd807ace855e5 100644 (file)
@@ -2,14 +2,5 @@
 #
 # SPDX-License-Identifier: curl
 
-server_bundle.c
 servers
-buildinfo
-dnsd
-mqttd
-resolve
-rtspd
-sockfilt
-socksd
-sws
-tftpd
+servers.c
index 17bf633000486bd204dce9a22f816f44a0d9b085..8e86a8c9738007f14ca031f591a6a1135a28e2c6 100644 (file)
 #
 ###########################################################################
 
-# Get 'SERVERPROGS', '<target>_SOURCES' variables, 'MEMDEBUG', 'CURLX_SRCS', 'USEFUL', 'INET_PTON', 'UTIL', 'FIRSTFILES'
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, MEMDEBUG, CURLX_SRCS, TESTFILES variables
 curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 
+add_custom_command(
+  OUTPUT "${BUNDLE_SRC}"
+  COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES}
+    ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+  DEPENDS
+    "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES}
+  VERBATIM)
+
 if(ENABLE_SERVER_DEBUG AND ENABLE_CURLDEBUG)
   set_source_files_properties("../../lib/memdebug.c" PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
 endif()
 
-if(CURL_TEST_BUNDLES)
-  add_custom_command(
-    OUTPUT "server_bundle.c"
-    COMMAND ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/mk-bundle.pl" ${SERVERPROGS} > "server_bundle.c"
-    DEPENDS
-      "${CMAKE_CURRENT_SOURCE_DIR}/mk-bundle.pl" ${FIRSTFILES}
-      "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
-    VERBATIM)
-
-  set(SERVERPROGS "servers")
-  set(servers_SOURCES ${MEMDEBUG} ${CURLX_SRCS} ${USEFUL} ${INET_PTON} ${UTIL} "server_bundle.c")
+add_executable(servers EXCLUDE_FROM_ALL ${MEMDEBUG} ${CURLX_SRCS} ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps servers)
+target_include_directories(servers PRIVATE
+  "${PROJECT_BINARY_DIR}/lib"           # for "curl_config.h"
+  "${PROJECT_SOURCE_DIR}/lib"           # for "curl_setup.h"
+  "${PROJECT_SOURCE_DIR}/lib/curlx"     # for curlx
+  "${PROJECT_SOURCE_DIR}/src"           # for "tool_binmode.h", "tool_xattr.h"
+  "${PROJECT_SOURCE_DIR}/tests/server"  # for "first.h"
+)
+target_link_libraries(servers ${CURL_LIBS})
+if(ENABLE_SERVER_DEBUG)
+  set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
 endif()
-
-foreach(_target IN LISTS SERVERPROGS)
-  set(_target_name "${_target}")
-  add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
-  add_dependencies(testdeps ${_target_name})
-  target_include_directories(${_target_name} PRIVATE
-    "${PROJECT_BINARY_DIR}/lib"           # for "curl_config.h"
-    "${PROJECT_SOURCE_DIR}/lib"           # for "curl_setup.h"
-    "${PROJECT_SOURCE_DIR}/lib/curlx"     # for curlx
-    "${PROJECT_SOURCE_DIR}/src"           # for "tool_binmode.h", "tool_xattr.h"
-    "${PROJECT_SOURCE_DIR}/tests/server"  # for "first.h"
-  )
-  target_link_libraries(${_target_name} ${CURL_LIBS})
-  if(ENABLE_SERVER_DEBUG)
-    set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
-  endif()
-  set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL")
-  # Test servers simply are standalone programs that do not use libcurl
-  # library.  For convenience and to ease portability of these servers,
-  # some source code files from the libcurl subdirectory are also used
-  # to build the servers.  In order to achieve proper linkage of these
-  # files on Windows targets it is necessary to build the test servers
-  # with CURL_STATICLIB defined, independently of how libcurl is built.
-  if(WIN32)
-    set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
-  endif()
-  set_target_properties(${_target_name} PROPERTIES
-    OUTPUT_NAME "${_target}"
-    PROJECT_LABEL "Test server ${_target}")
-endforeach()
+set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL" "CURL_NO_OLDIES")
+# Test servers simply are standalone programs that do not use libcurl
+# library.  For convenience and to ease portability of these servers,
+# some source code files from the libcurl subdirectory are also used
+# to build the servers.  In order to achieve proper linkage of these
+# files on Windows targets it is necessary to build the test servers
+# with CURL_STATICLIB defined, independently of how libcurl is built.
+if(WIN32)
+  set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
+endif()
+set_target_properties(servers PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
index 8298119e881480c3a03168d73e7bb96fe0720aa5..06f64d5cb472eb64d0e5254fdcf1e4e9cd3f18f7 100644 (file)
@@ -40,11 +40,16 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_srcdir)/src            \
               -I$(top_srcdir)/tests/server
 
-# Prevent LIBS from being used for all link targets
-LIBS = $(BLANK_AT_MAKETIME)
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, MEMDEBUG, CURLX_SRCS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt .checksrc $(FIRSTFILES) $(UTILS) $(TESTFILES)
 
 CFLAGS += @CURL_CFLAG_EXTRAS@
 
+# Prevent LIBS from being used for all link targets
+LIBS = $(BLANK_AT_MAKETIME)
+
 if DOING_NATIVE_WINDOWS
 AM_CPPFLAGS += -DCURL_STATICLIB
 endif
@@ -57,32 +62,23 @@ AM_CPPFLAGS += -DCURLDEBUG
 endif
 endif
 
-AM_CPPFLAGS += -DWITHOUT_LIBCURL
-
-# Makefile.inc provides neat definitions
-include Makefile.inc
-
-EXTRA_DIST = CMakeLists.txt .checksrc mk-bundle.pl $(FIRSTFILES)
+AM_CPPFLAGS += -DWITHOUT_LIBCURL -DCURL_NO_OLDIES
 
-if USE_TEST_BUNDLES
-server_EXCLUDE =
+bundle_EXCLUDE =
 if ENABLE_SERVER_DEBUG
 if CURLDEBUG
-server_EXCLUDE += $(MEMDEBUG)
+bundle_EXCLUDE += $(MEMDEBUG)
 endif
 endif
-server_bundle.c: $(top_srcdir)/tests/server/mk-bundle.pl $(MEMDEBUG) $(CURLX_SRCS) $(USEFUL) $(INET_PTON) $(UTIL) $(FIRSTFILES)
-       @PERL@ $(top_srcdir)/tests/server/mk-bundle.pl $(MEMDEBUG) $(CURLX_SRCS) $(USEFUL) $(INET_PTON) $(UTIL) $(SERVERPROGS) --exclude $(server_EXCLUDE) > server_bundle.c
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(MEMDEBUG) $(CURLX_SRCS) $(TESTFILES)
+       @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(MEMDEBUG) $(CURLX_SRCS) --test $(TESTFILES) --exclude $(bundle_EXCLUDE) > $(BUNDLE_SRC)
 
-noinst_PROGRAMS = servers
-nodist_servers_SOURCES = server_bundle.c
-servers_SOURCES = $(server_EXCLUDE)
+noinst_PROGRAMS = $(BUNDLE)
+nodist_servers_SOURCES = $(BUNDLE_SRC)
+servers_SOURCES = $(bundle_EXCLUDE)
 servers_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
 servers_CFLAGS = $(AM_CFLAGS)
-CLEANFILES = server_bundle.c
-else
-noinst_PROGRAMS = $(SERVERPROGS)
-endif
+CLEANFILES = $(BUNDLE_SRC)
 
 CHECKSRC = $(CS_$(V))
 CS_0 = @echo "  RUN     " $@;
@@ -92,9 +88,12 @@ CS_ = $(CS_0)
 # ignore generated C files since they play by slightly different rules!
 checksrc:
        $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
-         -W$(srcdir)/server_bundle.c \
+         -W$(srcdir)/$(BUNDLE_SRC) \
          $(srcdir)/*.[ch])
 
 if NOT_CURL_CI
 all-local: checksrc
 endif
+
+clean-local:
+       rm -f $(BUNDLE)
index 1859f651d3c51335633ec9857ed5cba0ac10e4ce..8ca058df33110a561c0c665a266c63632760d85f 100644 (file)
 # SPDX-License-Identifier: curl
 #
 ###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
 
-SERVERPROGS = resolve rtspd sockfilt sws tftpd socksd mqttd dnsd
+BUNDLE = servers
+BUNDLE_SRC = servers.c
+
+# Files referenced from the bundle source
+FIRSTFILES = first.c first.h
+
+# Common files used by test programs
+UTILS = getpart.c getpart.h util.c util.h
 
 MEMDEBUG = \
   ../../lib/memdebug.c \
@@ -30,6 +38,7 @@ MEMDEBUG = \
 
 CURLX_SRCS = \
   ../../lib/curlx/base64.c \
+  ../../lib/curlx/inet_pton.c \
   ../../lib/curlx/multibyte.c \
   ../../lib/curlx/nonblock.c \
   ../../lib/curlx/strparse.c \
@@ -39,74 +48,13 @@ CURLX_SRCS = \
   ../../lib/curlx/warnless.c \
   ../../lib/curlx/winapi.c
 
-CURLX_HDRS = \
-  ../../lib/curlx/base64.h \
-  ../../lib/curlx/curlx.h \
-  ../../lib/curlx/multibyte.h \
-  ../../lib/curlx/nonblock.h \
-  ../../lib/curlx/timediff.h \
-  ../../lib/curlx/timeval.h \
-  ../../lib/curlx/version_win32.h \
-  ../../lib/curlx/warnless.h \
-  ../../lib/curlx/winapi.h
-
-UTIL = \
-  getpart.c \
-  getpart.h \
-  util.c \
-  util.h \
-  server_setup.h
-
-FIRSTFILES = \
-  first.c \
-  first.h
-
-INET_PTON = \
-  ../../lib/curlx/inet_pton.c
-
-resolve_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
-  resolve.c
-resolve_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-resolve_CFLAGS = $(AM_CFLAGS)
-
-rtspd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
-  server_sockaddr.h \
-  rtspd.c
-rtspd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-rtspd_CFLAGS = $(AM_CFLAGS)
-
-sockfilt_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) $(INET_PTON) \
-  server_sockaddr.h \
-  sockfilt.c
-sockfilt_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-sockfilt_CFLAGS = $(AM_CFLAGS)
-
-socksd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) $(INET_PTON) \
-  server_sockaddr.h \
-  socksd.c
-socksd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-socksd_CFLAGS = $(AM_CFLAGS)
-
-mqttd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
-  server_sockaddr.h \
-  mqttd.c
-mqttd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-mqttd_CFLAGS = $(AM_CFLAGS)
-
-sws_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) $(INET_PTON) \
-  server_sockaddr.h \
-  sws.c
-sws_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-sws_CFLAGS = $(AM_CFLAGS)
-
-tftpd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
-  server_sockaddr.h \
-  tftpd.c \
-  tftp.h
-tftpd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-tftpd_CFLAGS = $(AM_CFLAGS)
-
-dnsd_SOURCES = $(MEMDEBUG) $(CURLX_SRCS) $(CURLX_HDRS) $(UTIL) \
-  dnsd.c
-dnsd_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
-dnsd_CFLAGS = $(AM_CFLAGS)
+# All test servers
+TESTFILES = \
+  dnsd.c \
+  mqttd.c \
+  resolve.c \
+  rtspd.c \
+  sockfilt.c \
+  socksd.c \
+  sws.c \
+  tftpd.c
index a9598810c3f4926b7de745eac708852dd916d756..a77246dc8919255d7ea904e075aff16eacbddf40 100644 (file)
@@ -22,7 +22,7 @@
  *
  ***************************************************************************/
 
-#include "server_setup.h"
+#include "curl_setup.h"
 
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
@@ -54,7 +54,6 @@
 #include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
-#include "server_sockaddr.h"
 
 /* include memdebug.h last */
 #include <memdebug.h>
@@ -385,7 +384,7 @@ static int send_response(curl_socket_t sock,
   return 0;
 }
 
-int main(int argc, char **argv)
+static int test_dnsd(int argc, char **argv)
 {
   srvr_sockaddr_union_t me;
   ssize_t n = 0;
index a0d473be4519418d8e4842eaf0a2a87462701058..3931b58672d989aed244da8dde730aa84c0f820f 100644 (file)
  ***************************************************************************/
 #include <stdio.h>
 #include <string.h>
-#include "first.h"
 
 int main(int argc, char **argv)
 {
-  main_func_t main_func;
-  char *main_name;
+  entry_func_t entry_func;
+  char *entry_name;
 
   if(argc < 2) {
     fprintf(stderr, "Pass servername as first argument\n");
     return 1;
   }
 
-  main_name = argv[1];
-  main_func = NULL;
+  entry_name = argv[1];
+  entry_func = NULL;
   {
     size_t tmp;
-    for(tmp = 0; tmp < CURL_ARRAYSIZE(s_mains); ++tmp) {
-      if(strcmp(main_name, s_mains[tmp].name) == 0) {
-        main_func = s_mains[tmp].ptr;
+    for(tmp = 0; tmp < CURL_ARRAYSIZE(s_entries); ++tmp) {
+      if(strcmp(entry_name, s_entries[tmp].name) == 0) {
+        entry_func = s_entries[tmp].ptr;
         break;
       }
     }
   }
 
-  if(!main_func) {
-    fprintf(stderr, "Test '%s' not found.\n", main_name);
+  if(!entry_func) {
+    fprintf(stderr, "Test '%s' not found.\n", entry_name);
     return 99;
   }
 
   --argc;
   ++argv;
 
-  return main_func(argc, argv);
+  return entry_func(argc, argv);
 }
index 54863cdf38ee7c5b8af62e339b8007e61c979054..6b14c5ee7c5de969c76f76558ee64b67b3b53f80 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-typedef int (*main_func_t)(int, char **);
+typedef int (*entry_func_t)(int, char **);
 
-struct onemain {
+struct entry_s {
   const char *name;
-  main_func_t ptr;
+  entry_func_t ptr;
 };
 
 #endif /* HEADER_SERVER_FIRST_H */
index 3ee836140a74e59be81a1814a94e8459bbe880c5..3ef9aca9487349f657128e7381fc60b401e706ea 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 #include "getpart.h"
 #include <curlx.h> /* from the private lib dir */
@@ -64,7 +64,6 @@ curl_wcsdup_callback Curl_cwcsdup = NULL; /* not use in test code */
 #  pragma warning(pop)
 #endif
 
-
 /*
  * line_length()
  *
@@ -109,7 +108,6 @@ static size_t line_length(const char *buffer, int bytestocheck)
  *   GPE_END_OF_FILE
  *   GPE_OK
  */
-
 static int readline(char **buffer, size_t *bufsize, size_t *length,
                     FILE *stream)
 {
@@ -174,7 +172,6 @@ static int readline(char **buffer, size_t *bufsize, size_t *length,
  *   GPE_OUT_OF_MEMORY
  *   GPE_OK
  */
-
 static int appenddata(char  **dst_buf,   /* dest buffer */
                       size_t *dst_len,   /* dest buffer data length */
                       size_t *dst_alloc, /* dest buffer allocated size */
@@ -274,7 +271,6 @@ static int decodedata(char  **buf,   /* dest buffer */
  *   GPE_OUT_OF_MEMORY
  *   GPE_OK
  */
-
 int getpart(char **outbuf, size_t *outlen,
             const char *main, const char *sub, FILE *stream)
 {
index cd2417a8953ddbb43e1e8bf967c537c0e8137f07..636d75239ee71695b635e37c427476652fd281b5 100644 (file)
@@ -23,7 +23,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 #include "strdup.h"
 
diff --git a/tests/server/mk-bundle.pl b/tests/server/mk-bundle.pl
deleted file mode 100755 (executable)
index 1edb6f3..0000000
+++ /dev/null
@@ -1,87 +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.
-
-use strict;
-use warnings;
-
-if(!@ARGV) {
-    die "Usage: $0 [<inputs>] [--exclude <exclude-c-sources>]\n";
-}
-
-# Specific sources to exclude or add as an extra source file
-my @src;
-my %exclude;
-my $in_exclude = 0;
-foreach my $src (@ARGV) {
-    if($in_exclude) {
-        $exclude{$src} = 1;
-    }
-    elsif($src eq "--exclude") {
-        $in_exclude = 1;
-    }
-    else {
-        push @src, $src;
-    }
-}
-
-print <<HEADER
-/* !checksrc! disable COPYRIGHT all */
-
-#include "first.h"
-
-HEADER
-    ;
-
-my $tlist = "";
-
-foreach my $src (@src) {
-    if($src =~ /\.c$/) {
-        if(!exists $exclude{$src}) {
-            # Misc .c source to include
-            print "#include \"$src\"\n\n";
-        }
-    }
-    elsif($src !~ /\.h$/) {
-        # Make 'main' unique across server sources
-        print "#undef main\n";
-        print "#define main main_$src\n";
-        print "int main_$src(int argc, char **argv);\n";
-        print "#include \"$src.c\"\n";
-        print "#undef main\n";
-        print "\n";
-        $tlist .= "  {\"$src\", main_$src},\n";
-    }
-}
-
-print <<FOOTER
-static const struct onemain s_mains[] = {
-$tlist};
-
-#include "first.c"
-FOOTER
-    ;
index 6ec031c5c73c3559b5f95019094a7d11259e1e82..03cb4ef78225d0ba3c707603cae8331a8a2777e5 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 #include <stdlib.h>
 #include <string.h>
 #include "util.h"
@@ -55,7 +55,6 @@
 
 #include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
-#include "server_sockaddr.h"
 
 #include "tool_binmode.h"
 
@@ -882,7 +881,7 @@ static curl_socket_t mqttd_sockdaemon(curl_socket_t sock,
 }
 
 
-int main(int argc, char *argv[])
+static int test_mqttd(int argc, char *argv[])
 {
   curl_socket_t sock = CURL_SOCKET_BAD;
   curl_socket_t msgsock = CURL_SOCKET_BAD;
index b69c87c1fa8905937bd7acbc3645e7a4c2814409..8461552dce1f099831233ac2b68d79c2ebbb9bd1 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 /* Purpose
  *
@@ -49,7 +49,7 @@
 /* include memdebug.h last */
 #include <memdebug.h>
 
-int main(int argc, char *argv[])
+static int test_resolve(int argc, char *argv[])
 {
   int arg = 1;
   const char *host = NULL;
index fd99458922740ab0e3e7b0c8ff9e66b462ff5ce8..df7a02568cacb6cfa934d706a19dfe6c2b2b7e14 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 /*
  * curl's test suite Real Time Streaming Protocol (RTSP) server.
@@ -51,7 +51,6 @@
 #include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
-#include "server_sockaddr.h"
 
 /* include memdebug.h last */
 #include <memdebug.h>
@@ -1000,7 +999,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
 }
 
 
-int main(int argc, char *argv[])
+static int test_rtspd(int argc, char *argv[])
 {
   srvr_sockaddr_union_t me;
   curl_socket_t sock = CURL_SOCKET_BAD;
diff --git a/tests/server/server_setup.h b/tests/server/server_setup.h
deleted file mode 100644 (file)
index 8bdcc91..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef HEADER_CURL_SERVER_SETUP_H
-#define HEADER_CURL_SERVER_SETUP_H
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-
-#define CURL_NO_OLDIES
-
-#include "curl_setup.h" /* portability help from the lib directory */
-
-#endif /* HEADER_CURL_SERVER_SETUP_H */
diff --git a/tests/server/server_sockaddr.h b/tests/server/server_sockaddr.h
deleted file mode 100644 (file)
index fb46099..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef HEADER_CURL_SERVER_SOCKADDR_H
-#define HEADER_CURL_SERVER_SOCKADDR_H
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "server_setup.h"
-
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h> /* for sockaddr_un */
-#endif
-
-typedef union {
-  struct sockaddr      sa;
-  struct sockaddr_in   sa4;
-#ifdef USE_IPV6
-  struct sockaddr_in6  sa6;
-#endif
-#ifdef USE_UNIX_SOCKETS
-  struct sockaddr_un   sau;
-#endif
-} srvr_sockaddr_union_t;
-
-#endif /* HEADER_CURL_SERVER_SOCKADDR_H */
index 1e625eacb31efef8a15b0aa4002c59fa93c6a819..8b0d147f3fafda78a7bca833732d0a47568fe921 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 /* Purpose
  *
 #include <curlx.h> /* from the private lib dir */
 #include "inet_pton.h"
 #include "util.h"
-#include "server_sockaddr.h"
 #include "timediff.h"
+#include "warnless.h" /* for read() */
 
 #include "tool_binmode.h"
 
@@ -1373,7 +1373,7 @@ static curl_socket_t sockfilt_sockdaemon(curl_socket_t sock,
 }
 
 
-int main(int argc, char *argv[])
+static int test_sockfilt(int argc, char *argv[])
 {
   srvr_sockaddr_union_t me;
   curl_socket_t sock = CURL_SOCKET_BAD;
index f5df0eff441c86e9516c01aab743b54c293cb2fb..03234b99130564f750d339ac6dd6ff7a327e76ce 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 #include <stdlib.h>
 
 /* Function
@@ -76,7 +76,6 @@
 #include <curlx.h> /* from the private lib dir */
 #include "inet_pton.h"
 #include "util.h"
-#include "server_sockaddr.h"
 #include "tool_binmode.h"
 
 /* include memdebug.h last */
@@ -914,7 +913,7 @@ static curl_socket_t socksd_sockdaemon(curl_socket_t sock,
 }
 
 
-int main(int argc, char *argv[])
+static int test_socksd(int argc, char *argv[])
 {
   curl_socket_t sock = CURL_SOCKET_BAD;
   curl_socket_t msgsock = CURL_SOCKET_BAD;
index 67a01cfdc083065f1e7d892e964c8355ecd4bb1c..096534f2d59716e79dcc2b1b1a1b676b2c052663 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 /* sws.c: simple (silly?) web server
 
@@ -53,7 +53,6 @@
 #include "getpart.h"
 #include "inet_pton.h"
 #include "util.h"
-#include "server_sockaddr.h"
 
 /* include memdebug.h last */
 #include <memdebug.h>
@@ -1989,7 +1988,7 @@ static int service_connection(curl_socket_t msgsock,
   return -1;
 }
 
-int main(int argc, char *argv[])
+static int test_sws(int argc, char *argv[])
 {
   srvr_sockaddr_union_t me;
   curl_socket_t sock = CURL_SOCKET_BAD;
diff --git a/tests/server/tftp.h b/tests/server/tftp.h
deleted file mode 100644 (file)
index d00b8c9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef HEADER_CURL_SERVER_TFTP_H
-#define HEADER_CURL_SERVER_TFTP_H
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "server_setup.h"
-
-/* This file is a rewrite/clone of the arpa/tftp.h file for systems without
-   it. */
-
-#define SEGSIZE 512 /* data segment size */
-
-#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
-  ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
-#  define PACKED_STRUCT __attribute__((__packed__))
-#else
-#  define PACKED_STRUCT /* NOTHING */
-#endif
-
-/* Using a packed struct as binary in a program is begging for problems, but
-   the tftpd server was written like this so we have this struct here to make
-   things build. */
-
-struct tftphdr {
-  unsigned short th_opcode; /* packet type */
-  unsigned short th_block;  /* all sorts of things */
-  char th_data[1];          /* data or error string */
-} PACKED_STRUCT;
-
-#define th_stuff th_block
-#define th_code  th_block
-#define th_msg   th_data
-
-#define TFTP_EUNDEF    0
-#define TFTP_ENOTFOUND 1
-#define TFTP_EACCESS   2
-#define TFTP_ENOSPACE  3
-#define TFTP_EBADOP    4
-#define TFTP_EBADID    5
-#define TFTP_EEXISTS   6
-#define TFTP_ENOUSER   7
-
-#endif /* HEADER_CURL_SERVER_TFTP_H */
index 8b936eea785e5f98ea89ed051b53a49a09b05429..3bbd3be1dd31fa444f0b18a37d6db363949fa290 100644 (file)
@@ -50,7 +50,7 @@
  * SPDX-License-Identifier: BSD-4-Clause-UC
  */
 
-#include "server_setup.h"
+#include "curl_setup.h"
 
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #include <curlx.h> /* from the private lib dir */
 #include "getpart.h"
 #include "util.h"
-#include "server_sockaddr.h"
-#include "tftp.h"
+
+/*****************************************************************************
+*  This is a rewrite/clone of the arpa/tftp.h file for systems without it.   *
+*****************************************************************************/
+#define SEGSIZE 512 /* data segment size */
+
+#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
+  ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
+#  define PACKED_STRUCT __attribute__((__packed__))
+#else
+#  define PACKED_STRUCT /* NOTHING */
+#endif
+
+/* Using a packed struct as binary in a program is begging for problems, but
+   the tftpd server was written like this so we have this struct here to make
+   things build. */
+
+struct tftphdr {
+  unsigned short th_opcode; /* packet type */
+  unsigned short th_block;  /* all sorts of things */
+  char th_data[1];          /* data or error string */
+} PACKED_STRUCT;
+
+#define th_stuff th_block
+#define th_code  th_block
+#define th_msg   th_data
+
+#define TFTP_EUNDEF    0
+#define TFTP_ENOTFOUND 1
+#define TFTP_EACCESS   2
+#define TFTP_ENOSPACE  3
+#define TFTP_EBADOP    4
+#define TFTP_EBADID    5
+#define TFTP_EEXISTS   6
+#define TFTP_ENOUSER   7
+/****************************************************************************/
 
 /* include memdebug.h last */
 #include <memdebug.h>
@@ -528,7 +562,7 @@ static int synchnet(curl_socket_t f /* socket to flush */)
   return j;
 }
 
-int main(int argc, char **argv)
+static int test_tftpd(int argc, char **argv)
 {
   srvr_sockaddr_union_t me;
   struct tftphdr *tp;
@@ -826,7 +860,6 @@ int main(int argc, char **argv)
     }
 
     logmsg("end of one transfer");
-
   }
 
 tftpd_cleanup:
index 81b01386dbe75788901be3b022c19b0f62da2c4b..04e3f60a936d69d345bfbf1ab269990bc3e00858 100644 (file)
@@ -21,7 +21,7 @@
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 #ifndef UNDER_CE
 #include <signal.h>
index da84e4f5dbb386e018543e5c58f5d6001fd2b2b7..5afaa03b78524d291a56db0736b62b38f65f7f4b 100644 (file)
  * SPDX-License-Identifier: curl
  *
  ***************************************************************************/
-#include "server_setup.h"
+#include "curl_setup.h"
 
 /* adjust for old MSVC */
-#ifdef _MSC_VER
-#  if _MSC_VER < 1900
-#   define snprintf _snprintf
-#  endif
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+#  define snprintf _snprintf
 #endif
 
 #ifdef _WIN32
@@ -124,6 +122,17 @@ int bind_unix_socket(curl_socket_t sock, const char *unix_socket,
                      struct sockaddr_un *sau);
 #endif /* USE_UNIX_SOCKETS */
 
+typedef union {
+  struct sockaddr      sa;
+  struct sockaddr_in   sa4;
+#ifdef USE_IPV6
+  struct sockaddr_in6  sa6;
+#endif
+#ifdef USE_UNIX_SOCKETS
+  struct sockaddr_un   sau;
+#endif
+} srvr_sockaddr_union_t;
+
 unsigned short util_ultous(unsigned long ulnum);
 
 #endif  /* HEADER_CURL_SERVER_UTIL_H */
index 1e23f3d01b2b94f4ae530baf89d035f541c3a993..fd762935a2118a6c31cbd2dbac6fd3e879346c2a 100644 (file)
@@ -247,14 +247,7 @@ sub server_exe {
     if(!defined $ext) {
         $ext = 'SRV';
     }
-    my $cmd;
-    if($ENV{'CURL_TEST_BUNDLES'}) {
-        $cmd = $SRVDIR . "servers" . exe_ext($ext) . " $name";
-    }
-    else {
-        $cmd = $SRVDIR . $name . exe_ext($ext);
-    }
-    return exerunner() . "$cmd";
+    return exerunner() . $SRVDIR . "servers" . exe_ext($ext) . " $name";
 }
 
 
@@ -266,13 +259,7 @@ sub server_exe_args {
     if(!defined $ext) {
         $ext = 'SRV';
     }
-    my @cmd;
-    if($ENV{'CURL_TEST_BUNDLES'}) {
-        @cmd = ($SRVDIR . "servers" . exe_ext($ext), $name);
-    }
-    else {
-        @cmd = ($SRVDIR . $name . exe_ext($ext));
-    }
+    my @cmd = ($SRVDIR . "servers" . exe_ext($ext), $name);
     if($ENV{'CURL_TEST_EXE_RUNNER'}) {
         unshift @cmd, $ENV{'CURL_TEST_EXE_RUNNER'};
     }
index f1cc07bf6823551c9653030eadf29627d9d1feda..97fa1ba521c83b0ae40645613ba3c4628df1ad2f 100644 (file)
@@ -2,6 +2,5 @@
 #
 # SPDX-License-Identifier: curl
 
-/tool[0-9][0-9][0-9][0-9]
-tool_bundle.c
 tunits
+tunits.c
index 6d57c790725e76a89cf92e499a44bf4822ff00ee..4151a490974235eaf3f193df1ac2e519168a09d3 100644 (file)
 #
 ###########################################################################
 
-# Get 'TOOLPROGS', '*_SOURCES', 'TOOLFILES' variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
 curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 
-if(CURL_TEST_BUNDLES)
-  add_custom_command(
-    OUTPUT "tool_bundle.c"
-    COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" "${CMAKE_CURRENT_SOURCE_DIR}" > "tool_bundle.c"
-    DEPENDS
-      "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${TOOLFILES}
-      "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
-    VERBATIM)
+add_custom_command(
+  OUTPUT "${BUNDLE_SRC}"
+  COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES}
+    ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+  DEPENDS
+    "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES}
+  VERBATIM)
 
-  set(TOOLPROGS "tunits")
-  set(tunits_SOURCES "tool_bundle.c")
-endif()
-
-foreach(_target IN LISTS TOOLPROGS)
-  set(_target_name "${_target}")
-  add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
-  add_dependencies(testdeps ${_target_name})
-  target_link_libraries(${_target_name} curltool curlu)
-  target_include_directories(${_target_name} PRIVATE
-    "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
-    "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
-    "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
-    "${PROJECT_SOURCE_DIR}/src"
-    "${PROJECT_SOURCE_DIR}/tests/libtest"
-    "${PROJECT_SOURCE_DIR}/tests/unit"     # for curlcheck.h
-  )
-  set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
-  if(CURL_TEST_BUNDLES)
-    target_include_directories(${_target_name} PRIVATE "${PROJECT_SOURCE_DIR}/tests/tunit")
-  endif()
-  set_target_properties(${_target_name} PROPERTIES
-    OUTPUT_NAME "${_target}"
-    PROJECT_LABEL "Test tunit ${_target}")
-endforeach()
+add_executable(tunits EXCLUDE_FROM_ALL ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps tunits)
+target_link_libraries(tunits curltool curlu)
+target_include_directories(tunits PRIVATE
+  "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
+  "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
+  "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
+  "${PROJECT_SOURCE_DIR}/src"
+  "${PROJECT_SOURCE_DIR}/tests/libtest"
+  "${PROJECT_SOURCE_DIR}/tests/unit"     # for curlcheck.h
+  "${PROJECT_SOURCE_DIR}/tests/tunit"
+)
+set_property(TARGET tunits APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}" "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
+set_target_properties(tunits PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
index 01d27673c449d90ce01fd1a46a0db6d86d353192..f4b176bf331ee4a0b4c5a85e6cd92579b0c819af 100644 (file)
@@ -41,7 +41,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_srcdir)/tests/unit     \
               -I$(top_srcdir)/tests/tunit
 
-EXTRA_DIST = CMakeLists.txt README.md
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt README.md $(UTILS) $(TESTFILES)
 
 CFLAGS += @CURL_CFLAG_EXTRAS@
 
@@ -49,7 +52,7 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
 LIBS = $(BLANK_AT_MAKETIME)
 
 LDADD = $(top_builddir)/src/libcurltool.la   \
-        $(top_builddir)/lib/libcurl.la      \
+        $(top_builddir)/lib/libcurl.la       \
         @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
 
 AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
@@ -60,21 +63,15 @@ if CURLDEBUG
 AM_CPPFLAGS += -DCURLDEBUG
 endif
 
-BUNDLE=tunits
+AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
 
 if BUILD_UNITTESTS
-if USE_TEST_BUNDLES
-tool_bundle.c: $(top_srcdir)/tests/mk-bundle.pl Makefile.inc
-       @PERL@ $(top_srcdir)/tests/mk-bundle.pl $(srcdir) > tool_bundle.c
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(TESTFILES)
+       @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) --test $(TESTFILES) > $(BUNDLE_SRC)
 
 noinst_PROGRAMS = $(BUNDLE)
-nodist_tunits_SOURCES = tool_bundle.c
-CLEANFILES = tool_bundle.c
-else
-# Makefile.inc provides neat definitions
-include Makefile.inc
-noinst_PROGRAMS = $(TOOLPROGS)
-endif
+nodist_tunits_SOURCES = $(BUNDLE_SRC)
+CLEANFILES = $(BUNDLE_SRC)
 else
 noinst_PROGRAMS =
 endif
@@ -87,7 +84,7 @@ CS_ = $(CS_0)
 # ignore generated C files since they play by slightly different rules!
 checksrc:
        $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
-         -W$(srcdir)/tool_bundle.c \
+         -W$(srcdir)/$(BUNDLE_SRC) \
          $(srcdir)/*.[ch])
 
 if NOT_CURL_CI
index 55dd1644a8124719734acd137d4c5ca051dfaeab..7f38a3ef25f567cbe5cd3ee5cf01937a033953f3 100644 (file)
 # SPDX-License-Identifier: curl
 #
 ###########################################################################
+# Shared between CMakeLists.txt and Makefile.am
 
-# these files are used in every single unit test program
+BUNDLE = tunits
+BUNDLE_SRC = tunits.c
 
-FIRSTFILES = ../libtest/first.c
+# Files referenced from the bundle source
+FIRSTFILES = ../libtest/first.c ../libtest/first.h
 
-TOOLFILES = $(FIRSTFILES)
+# Common files used by test programs
+UTILS = ../unit/curlcheck.h
 
-# These are all tool unit test programs
-TOOLPROGS = tool1394 tool1604 tool1621
-
-tool1394_SOURCES = tool1394.c $(TOOLFILES)
-
-tool1604_SOURCES = tool1604.c $(TOOLFILES)
-
-tool1621_SOURCES = tool1621.c $(TOOLFILES)
+# All tool unit test programs
+TESTFILES = \
+  tool1394.c \
+  tool1604.c \
+  tool1621.c
index ef398ab22f2219aca53189d0d2d2c796ca0227e6..b57ae1d375bc083f047a10262cf27407f5104a4e 100644 (file)
 
 #include "memdebug.h" /* LAST include file */
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
+static CURLcode test_tool1394(char *arg)
 {
-
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
   const char *values[] = {
     /* -E parameter */        /* exp. cert name */  /* exp. passphrase */
@@ -130,4 +122,5 @@ UNITTEST_START
       free(passphrase);
   }
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index f2b727b62936d9fe4ab130e034b643d6dfa07fc3..bd029c8d189b19987f71e26a4abeb25c875cce45 100644 (file)
 
 #include "memdebug.h" /* LAST include file */
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
 #if defined(_WIN32) || defined(MSDOS)
-
 static char *getflagstr(int flags)
 {
   char *buf = malloc(256);
@@ -71,16 +60,21 @@ static char *getcurlcodestr(int cc)
   }
   return buf;
 }
+#endif
 
-struct data {
-  const char *input;
-  int flags;
-  const char *expected_output;
-  SANITIZEcode expected_result;
-};
+static CURLcode test_tool1604(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+
+#if defined(_WIN32) || defined(MSDOS)
+  struct data {
+    const char *input;
+    int flags;
+    const char *expected_output;
+    SANITIZEcode expected_result;
+  };
 
-UNITTEST_START
-{ /* START sanitize_file_name */
+  /* START sanitize_file_name */
   struct data data[] = {
     { "", 0,
       "", SANITIZE_ERR_OK
@@ -256,13 +250,10 @@ UNITTEST_START
     free(received_ccstr);
     free(expected_ccstr);
   }
-} /* END sanitize_file_name */
-
+  /* END sanitize_file_name */
 #else
-UNITTEST_START
-{
   fprintf(stderr, "Skipped test not for this platform\n");
-}
 #endif /* _WIN32 || MSDOS */
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index b6135e4e6471c2817f5f19ba0e0ea520f9fcda40..bd45daa41cd009041f5143176e69506897fb50e0 100644 (file)
 #include "urldata.h"
 #include "url.h"
 
-#include "memdebug.h" /* LAST include file */
+#include "tool_xattr.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
+#include "memdebug.h" /* LAST include file */
 
-static void unit_stop(void)
+static CURLcode test_tool1621(char *arg)
 {
-}
-
-#ifndef USE_XATTR
-/* stripcredentials isn't available in this case */
+  UNITTEST_BEGIN_SIMPLE
 
-UNITTEST_START
-UNITTEST_STOP
-#else
+#ifdef USE_XATTR  /* Required for stripcredentials() */
 
-char *stripcredentials(const char *url);
+  struct checkthis {
+    const char *input;
+    const char *output;
+  };
 
-struct checkthis {
-  const char *input;
-  const char *output;
-};
-
-static const struct checkthis tests[] = {
-  { "ninja://foo@example.com", "(null)" },  /* unsupported scheme */
-  { "pop3s://foo@example.com", "pop3s://example.com/" },
-  { "ldap://foo@example.com", "ldap://example.com/" },
-  { "https://foo@example.com", "https://example.com/" },
-  { "https://localhost:45", "https://localhost:45/" },
-  { "https://foo@localhost:45", "https://localhost:45/" },
-  { "http://daniel:password@localhost", "http://localhost/" },
-  { "http://daniel@localhost", "http://localhost/" },
-  { "https://user:pass@localhost:45", "https://localhost:45/" },
-  { "http://localhost/", "http://localhost/" },
-  { "http://odd%40host/", "(null)" },  /* bad host */
-  { "http://user@odd%40host/", "(null)" },  /* bad host */
-  { "http://host/@path/", "http://host/@path/" },
-  { "http://emptypw:@host/", "http://host/" },
-  { "http://:emptyuser@host/", "http://host/" },
-  { "http://odd%40user@host/", "http://host/" },
-  { "http://only%40one%40host/", "(null)" },  /* bad host */
-  { "http://odder%3auser@host/", "http://host/" },
-  { NULL, NULL } /* end marker */
-};
+  static const struct checkthis tests[] = {
+    { "ninja://foo@example.com", "(null)" },  /* unsupported scheme */
+#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)
+    { "pop3s://foo@example.com", "pop3s://example.com/" },
+#endif
+#ifndef CURL_DISABLE_LDAP
+    { "ldap://foo@example.com", "ldap://example.com/" },
+#endif
+#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
+    { "https://foo@example.com", "https://example.com/" },
+    { "https://localhost:45", "https://localhost:45/" },
+    { "https://foo@localhost:45", "https://localhost:45/" },
+    { "https://user:pass@localhost:45", "https://localhost:45/" },
+#endif
+#ifndef CURL_DISABLE_HTTP
+    { "http://daniel:password@localhost", "http://localhost/" },
+    { "http://daniel@localhost", "http://localhost/" },
+    { "http://localhost/", "http://localhost/" },
+    { "http://odd%40host/", "(null)" },  /* bad host */
+    { "http://user@odd%40host/", "(null)" },  /* bad host */
+    { "http://host/@path/", "http://host/@path/" },
+    { "http://emptypw:@host/", "http://host/" },
+    { "http://:emptyuser@host/", "http://host/" },
+    { "http://odd%40user@host/", "http://host/" },
+    { "http://only%40one%40host/", "(null)" },  /* bad host */
+    { "http://odder%3auser@host/", "http://host/" },
+#endif
+    { NULL, NULL } /* end marker */
+  };
 
-UNITTEST_START
-{
   int i;
 
   for(i = 0; tests[i].input; i++) {
     const char *url = tests[i].input;
     char *stripped = stripcredentials(url);
-    char *strippedstr = stripped ? stripped : "(null)";
-    printf("Test %u got input \"%s\", output: \"%s\"\n",
-           i, tests[i].input, strippedstr);
+    const char *strippedstr = stripped ? stripped : "(null)";
+    printf("Test %u got input \"%s\", output: \"%s\", expected: \"%s\"\n",
+           i, tests[i].input, strippedstr, tests[i].output);
 
     fail_if(strcmp(tests[i].output, strippedstr), tests[i].output);
     curl_free(stripped);
   }
-}
-UNITTEST_STOP
 #endif
+
+  UNITTEST_END_SIMPLE
+}
index dafe0427dbf25256ee87d18b6515e6a842a2f2cf..bae3c1a76027a7a3113c70e78a896710ee9d6930 100644 (file)
@@ -2,6 +2,5 @@
 #
 # SPDX-License-Identifier: curl
 
-/unit[0-9][0-9][0-9][0-9]
-unit_bundle.c
 units
+units.c
index 069fc768ba9b18db8ff30c2256d79d5dd56bff5d..5416aaeedcd9b8b8c4977928db4e0d57512ea971 100644 (file)
 #
 ###########################################################################
 
-# Get 'UNITPROGS', '*_SOURCES', 'FIRSTFILES' variables
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
 curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
 
-if(CURL_TEST_BUNDLES)
-  add_custom_command(
-    OUTPUT "unit_bundle.c"
-    COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" "${CMAKE_CURRENT_SOURCE_DIR}" > "unit_bundle.c"
-    DEPENDS
-      "${PROJECT_SOURCE_DIR}/tests/mk-bundle.pl" ${FIRSTFILES}
-      "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc"
-    VERBATIM)
+add_custom_command(
+  OUTPUT "${BUNDLE_SRC}"
+  COMMAND ${PERL_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" --test ${TESTFILES}
+    ${CURL_MK_UNITY_OPTION} --srcdir "${CMAKE_CURRENT_SOURCE_DIR}" > "${BUNDLE_SRC}"
+  DEPENDS
+    "${PROJECT_SOURCE_DIR}/scripts/mk-unity.pl" "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.inc" ${FIRSTFILES} ${TESTFILES}
+  VERBATIM)
 
-  set(UNITPROGS "units")
-  set(units_SOURCES "unit_bundle.c")
-endif()
-
-foreach(_target IN LISTS UNITPROGS)
-  set(_target_name "${_target}")
-  add_executable(${_target_name} EXCLUDE_FROM_ALL ${${_target}_SOURCES})
-  add_dependencies(testdeps ${_target_name})
-  target_link_libraries(${_target_name} curltool curlu)
-  target_include_directories(${_target_name} PRIVATE
-    "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
-    "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
-    "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
-    "${PROJECT_SOURCE_DIR}/src"
-    "${PROJECT_SOURCE_DIR}/tests/libtest"
-  )
-  set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
-  # unit tests are small pretend-libcurl-programs
-  set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "BUILDING_LIBCURL")
-  if(CURL_TEST_BUNDLES)
-    target_include_directories(${_target_name} PRIVATE "${PROJECT_SOURCE_DIR}/tests/unit")
-  endif()
-  set_target_properties(${_target_name} PROPERTIES
-    OUTPUT_NAME "${_target}"
-    PROJECT_LABEL "Test unit ${_target}")
-endforeach()
+add_executable(units EXCLUDE_FROM_ALL ${UTILS} "${BUNDLE_SRC}")
+add_dependencies(testdeps units)
+target_link_libraries(units curltool curlu)
+target_include_directories(units PRIVATE
+  "${PROJECT_BINARY_DIR}/lib"            # for "curl_config.h"
+  "${PROJECT_SOURCE_DIR}/lib"            # for "curl_setup.h"
+  "${PROJECT_SOURCE_DIR}/lib/curlx"      # for curlx
+  "${PROJECT_SOURCE_DIR}/src"
+  "${PROJECT_SOURCE_DIR}/tests/libtest"
+  "${PROJECT_SOURCE_DIR}/tests/unit"
+)
+set_property(TARGET units APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}" "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")
+set_property(TARGET units APPEND PROPERTY COMPILE_DEFINITIONS "BUILDING_LIBCURL")  # unit tests are small pretend-libcurl-programs
+set_target_properties(units PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}")
index 331d0a9004800d081eefdd4efe23e68dc66be6b6..af54fdfac461a2c4bfabf4ebc6c41290070d1600 100644 (file)
@@ -40,7 +40,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include        \
               -I$(top_srcdir)/tests/libtest  \
               -I$(top_srcdir)/tests/unit
 
-EXTRA_DIST = CMakeLists.txt README.md
+# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
+include Makefile.inc
+
+EXTRA_DIST = CMakeLists.txt README.md $(UTILS) $(TESTFILES)
 
 CFLAGS += @CURL_CFLAG_EXTRAS@
 
@@ -58,21 +61,15 @@ if CURLDEBUG
 AM_CPPFLAGS += -DCURLDEBUG
 endif
 
-BUNDLE=units
+AM_CPPFLAGS += -DCURL_NO_OLDIES -DCURL_DISABLE_DEPRECATION
 
 if BUILD_UNITTESTS
-if USE_TEST_BUNDLES
-unit_bundle.c: $(top_srcdir)/tests/mk-bundle.pl Makefile.inc
-       @PERL@ $(top_srcdir)/tests/mk-bundle.pl $(srcdir) > unit_bundle.c
+$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(TESTFILES)
+       @PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) --test $(TESTFILES) > $(BUNDLE_SRC)
 
 noinst_PROGRAMS = $(BUNDLE)
-nodist_units_SOURCES = unit_bundle.c
-CLEANFILES = unit_bundle.c
-else
-# Makefile.inc provides neat definitions
-include Makefile.inc
-noinst_PROGRAMS = $(UNITPROGS)
-endif
+nodist_units_SOURCES = $(BUNDLE_SRC)
+CLEANFILES = $(BUNDLE_SRC)
 else
 noinst_PROGRAMS =
 endif
@@ -85,7 +82,7 @@ CS_ = $(CS_0)
 # ignore generated C files since they play by slightly different rules!
 checksrc:
        $(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
-         -W$(srcdir)/unit_bundle.c \
+         -W$(srcdir)/$(BUNDLE_SRC) \
          $(srcdir)/*.[ch])
 
 if NOT_CURL_CI
index fb68911941b912613610a96b82131f7c245cbaf6..73f5163ab4a1deeedf89444b46a989180ad7cc48 100644 (file)
 # SPDX-License-Identifier: curl
 #
 ###########################################################################
-
-# these files are used in every single unit test program
-
-FIRSTFILES = \
- ../libtest/first.c \
- ../libtest/first.h
-
-UNITFILES = curlcheck.h $(FIRSTFILES)
-
-# These are all unit test programs
-UNITPROGS = unit1300          unit1302 unit1303 unit1304 unit1305 unit1307 \
-          unit1309 unit1323 \
- unit1330          unit1395 unit1396 unit1397 unit1398 \
- unit1399 \
- unit1600 unit1601 unit1602 unit1603          unit1605 unit1606 unit1607 \
- unit1608 unit1609 unit1610 unit1611 unit1612 unit1614 unit1615 unit1616 \
- unit1620 \
- unit1650 unit1651 unit1652 unit1653 unit1654 unit1655 unit1656 unit1657 \
- unit1658 \
- unit1660 unit1661 unit1663 unit1664 \
- unit1979 unit1980 \
- unit2600 unit2601 unit2602 unit2603 unit2604 \
- unit3200 \
- unit3205 \
- unit3211 unit3212 unit3213
-
-unit1300_SOURCES = unit1300.c $(UNITFILES)
-
-unit1302_SOURCES = unit1302.c $(UNITFILES)
-
-unit1303_SOURCES = unit1303.c $(UNITFILES)
-
-unit1304_SOURCES = unit1304.c $(UNITFILES)
-
-unit1305_SOURCES = unit1305.c $(UNITFILES)
-
-unit1307_SOURCES = unit1307.c $(UNITFILES)
-
-unit1309_SOURCES = unit1309.c $(UNITFILES)
-
-unit1323_SOURCES = unit1323.c $(UNITFILES)
-
-unit1330_SOURCES = unit1330.c $(UNITFILES)
-
-unit1395_SOURCES = unit1395.c $(UNITFILES)
-
-unit1396_SOURCES = unit1396.c $(UNITFILES)
-
-unit1397_SOURCES = unit1397.c $(UNITFILES)
-
-unit1398_SOURCES = unit1398.c $(UNITFILES)
-
-unit1399_SOURCES = unit1399.c $(UNITFILES)
-
-unit1600_SOURCES = unit1600.c $(UNITFILES)
-
-unit1601_SOURCES = unit1601.c $(UNITFILES)
-
-unit1602_SOURCES = unit1602.c $(UNITFILES)
-
-unit1603_SOURCES = unit1603.c $(UNITFILES)
-
-unit1605_SOURCES = unit1605.c $(UNITFILES)
-
-unit1606_SOURCES = unit1606.c $(UNITFILES)
-
-unit1607_SOURCES = unit1607.c $(UNITFILES)
-
-unit1608_SOURCES = unit1608.c $(UNITFILES)
-
-unit1609_SOURCES = unit1609.c $(UNITFILES)
-
-unit1610_SOURCES = unit1610.c $(UNITFILES)
-
-unit1611_SOURCES = unit1611.c $(UNITFILES)
-
-unit1612_SOURCES = unit1612.c $(UNITFILES)
-
-unit1614_SOURCES = unit1614.c $(UNITFILES)
-
-unit1615_SOURCES = unit1615.c $(UNITFILES)
-
-unit1616_SOURCES = unit1616.c $(UNITFILES)
-
-unit1620_SOURCES = unit1620.c $(UNITFILES)
-
-unit1650_SOURCES = unit1650.c $(UNITFILES)
-
-unit1651_SOURCES = unit1651.c $(UNITFILES)
-
-unit1652_SOURCES = unit1652.c $(UNITFILES)
-
-unit1653_SOURCES = unit1653.c $(UNITFILES)
-
-unit1654_SOURCES = unit1654.c $(UNITFILES)
-
-unit1655_SOURCES = unit1655.c $(UNITFILES)
-
-unit1656_SOURCES = unit1656.c $(UNITFILES)
-
-unit1657_SOURCES = unit1657.c $(UNITFILES)
-
-unit1658_SOURCES = unit1658.c $(UNITFILES)
-
-unit1660_SOURCES = unit1660.c $(UNITFILES)
-
-unit1661_SOURCES = unit1661.c $(UNITFILES)
-
-unit1663_SOURCES = unit1663.c $(UNITFILES)
-
-unit1664_SOURCES = unit1664.c $(UNITFILES)
-
-unit1979_SOURCES = unit1979.c $(UNITFILES)
-
-unit1980_SOURCES = unit1980.c $(UNITFILES)
-
-unit2600_SOURCES = unit2600.c $(UNITFILES)
-
-unit2601_SOURCES = unit2601.c $(UNITFILES)
-
-unit2602_SOURCES = unit2602.c $(UNITFILES)
-
-unit2603_SOURCES = unit2603.c $(UNITFILES)
-
-unit2604_SOURCES = unit2604.c $(UNITFILES)
-
-unit3200_SOURCES = unit3200.c $(UNITFILES)
-
-unit3205_SOURCES = unit3205.c $(UNITFILES)
-
-unit3211_SOURCES = unit3211.c $(UNITFILES)
-
-unit3212_SOURCES = unit3212.c $(UNITFILES)
-
-unit3213_SOURCES = unit3213.c $(UNITFILES)
+# Shared between CMakeLists.txt and Makefile.am
+
+BUNDLE = units
+BUNDLE_SRC = units.c
+
+# Files referenced from the bundle source
+FIRSTFILES = ../libtest/first.c ../libtest/first.h
+
+# Common files used by test programs
+UTILS = curlcheck.h
+
+# All unit test programs
+TESTFILES = \
+  unit1300.c            unit1302.c unit1303.c unit1304.c unit1305.c unit1307.c \
+             unit1309.c unit1323.c \
+  unit1330.c            unit1395.c unit1396.c unit1397.c unit1398.c \
+  unit1399.c \
+  unit1600.c unit1601.c unit1602.c unit1603.c            unit1605.c unit1606.c unit1607.c \
+  unit1608.c unit1609.c unit1610.c unit1611.c unit1612.c unit1614.c unit1615.c unit1616.c \
+  unit1620.c \
+  unit1650.c unit1651.c unit1652.c unit1653.c unit1654.c unit1655.c unit1656.c unit1657.c \
+  unit1658.c \
+  unit1660.c unit1661.c unit1663.c unit1664.c \
+  unit1979.c unit1980.c \
+  unit2600.c unit2601.c unit2602.c unit2603.c unit2604.c \
+  unit3200.c \
+  unit3205.c \
+  unit3211.c unit3212.c unit3213.c
index cf0a944d69a7d04b43a3c131f59182024fe482ad..82407e941504b264a3eb1819ee1dcbd954234239 100644 (file)
@@ -45,7 +45,27 @@ and the `tests/FILEFORMAT.md` documentation.
 
 For the actual C file, here's a simple example:
 ~~~c
+    #include "curlcheck.h"
+
+    #include "a libcurl header.h" /* from the lib dir */
+
+    static CURLcode test_unit9998(char *arg)
+    {
+      UNITTEST_BEGIN_SIMPLE
 
+      /* here you start doing things and checking that the results are good */
+
+      fail_unless( size == 0 , "initial size should be zero" );
+      fail_if( head == NULL , "head should not be initiated to NULL" );
+
+      /* you end the test code like this: */
+
+      UNITTEST_END_SIMPLE
+    }
+~~~
+
+Here's an example using optional initialization and cleanup:
+~~~c
     #include "curlcheck.h"
 
     #include "a libcurl header.h" /* from the lib dir */
@@ -61,7 +81,9 @@ For the actual C file, here's a simple example:
       /* done before shutting down and exiting */
     }
 
-    UNITTEST_START
+    static CURLcode test_unit9999(char *arg)
+    {
+      UNITTEST_BEGIN(unit_setup())
 
       /* here you start doing things and checking that the results are good */
 
@@ -70,4 +92,6 @@ For the actual C file, here's a simple example:
 
       /* you end the test code like this: */
 
-    UNITTEST_STOP
+      UNITTEST_END(unit_stop())
+    }
+~~~
index 362e5e687bcaa2e21efa13e2f85acfa5756f173f..6364e16800c1194e3579f4da20b1ae8475a59ae7 100644 (file)
   } while(0)
 
 
-#define UNITTEST_START                          \
-  CURLcode test(char *arg)                      \
-  {                                             \
-    (void)arg;                                  \
-    if(unit_setup()) {                          \
-      fail("unit_setup() FAILURE");             \
-    }                                           \
-    else {
+#define UNITTEST_BEGIN_SIMPLE                   \
+  (void)arg;                                    \
+  {
 
-#define UNITTEST_STOP                           \
+#define UNITTEST_END_SIMPLE                     \
     goto unit_test_abort; /* avoid warning */   \
+  }                                             \
 unit_test_abort:                                \
-    unit_stop();                                \
+  return (CURLcode)unitfail;
+
+#define UNITTEST_BEGIN(setupfunc)               \
+  (void)arg;                                    \
+  if(setupfunc) {                               \
+    fail("unit_setup() FAILURE");               \
+    return (CURLcode)unitfail;                  \
+  }                                             \
+  {
+
+#define UNITTEST_END(stopfunc)                  \
+    goto unit_test_abort; /* avoid warning */   \
   }                                             \
-  return (CURLcode)unitfail;                    \
-  }
+unit_test_abort:                                \
+  stopfunc;                                     \
+  return (CURLcode)unitfail;
index 55caaca1a1a5a8b1c7261480924ecbebee5956dc..544ac71c757afaf8101112d84bb368329aff07d7 100644 (file)
 
 #include "llist.h"
 
-static struct Curl_llist llist;
-
-static struct Curl_llist llist_destination;
-
 static void test_Curl_llist_dtor(void *key, void *value)
 {
   /* used by the llist API, does nothing here */
@@ -36,19 +32,13 @@ static void test_Curl_llist_dtor(void *key, void *value)
   (void)value;
 }
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1300(char *arg)
 {
-  Curl_llist_init(&llist, test_Curl_llist_dtor);
-  Curl_llist_init(&llist_destination, test_Curl_llist_dtor);
-  return CURLE_OK;
-}
+  UNITTEST_BEGIN_SIMPLE
 
-static void unit_stop(void)
-{
-}
+  struct Curl_llist llist;
+  struct Curl_llist llist_destination;
 
-UNITTEST_START
-{
   int unusedData_case1 = 1;
   int unusedData_case2 = 2;
   int unusedData_case3 = 3;
@@ -62,6 +52,9 @@ UNITTEST_START
   struct Curl_llist_node *to_remove;
   size_t llist_size;
 
+  Curl_llist_init(&llist, test_Curl_llist_dtor);
+  Curl_llist_init(&llist_destination, test_Curl_llist_dtor);
+
   /**
    * testing llist_init
    * case 1:
@@ -271,5 +264,6 @@ UNITTEST_START
 
   Curl_llist_destroy(&llist, NULL);
   Curl_llist_destroy(&llist_destination, NULL);
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
index e9056e4a572807bcb795cc7b61ba75237ee18998..58b0e12518ccbe90fa10a89a44e1cddcde08afa5 100644 (file)
 #include "curlx/base64.h"
 #include "memdebug.h" /* LAST include file */
 
-static struct Curl_easy *t1302_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode test_unit1302(char *arg)
 {
-  CURLcode res = CURLE_OK;
-
-  global_init(CURL_GLOBAL_ALL);
-  t1302_easy = curl_easy_init();
-  if(!t1302_easy) {
-    curl_global_cleanup();
-    return CURLE_OUT_OF_MEMORY;
-  }
-  return res;
+  UNITTEST_BEGIN_SIMPLE
+
+  char *output;
+  unsigned char *decoded;
+  size_t size = 0;
+  unsigned char anychar = 'x';
+  CURLcode rc;
+
+  rc = curlx_base64_encode("i", 1, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 4, "size should be 4");
+  verify_memory(output, "aQ==", 4);
+  Curl_safefree(output);
+
+  rc = curlx_base64_encode("ii", 2, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 4, "size should be 4");
+  verify_memory(output, "aWk=", 4);
+  Curl_safefree(output);
+
+  rc = curlx_base64_encode("iii", 3, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 4, "size should be 4");
+  verify_memory(output, "aWlp", 4);
+  Curl_safefree(output);
+
+  rc = curlx_base64_encode("iiii", 4, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 8, "size should be 8");
+  verify_memory(output, "aWlpaQ==", 8);
+  Curl_safefree(output);
+
+  rc = curlx_base64_encode("\xff\x01\xfe\x02", 4, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 8, "size should be 8");
+  verify_memory(output, "/wH+Ag==", 8);
+  Curl_safefree(output);
+
+  rc = curlx_base64url_encode("\xff\x01\xfe\x02", 4, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 6, "size should be 6");
+  verify_memory(output, "_wH-Ag", 6);
+  Curl_safefree(output);
+
+  rc = curlx_base64url_encode("iiii", 4, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 6, "size should be 6");
+  verify_memory(output, "aWlpaQ", 6);
+  Curl_safefree(output);
+
+  /* 0 length makes it do strlen() */
+  rc = curlx_base64_encode("iiii", 0, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 8, "size should be 8");
+  verify_memory(output, "aWlpaQ==", 8);
+  Curl_safefree(output);
+
+  rc = curlx_base64_encode("", 0, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 0, "size should be 0");
+  fail_unless(output && !output[0], "output should be a zero-length string");
+  Curl_safefree(output);
+
+  rc = curlx_base64url_encode("", 0, &output, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 0, "size should be 0");
+  fail_unless(output && !output[0], "output should be a zero-length string");
+  Curl_safefree(output);
+
+  rc = curlx_base64_decode("aWlpaQ==", &decoded, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 4, "size should be 4");
+  verify_memory(decoded, "iiii", 4);
+  Curl_safefree(decoded);
+
+  rc = curlx_base64_decode("aWlp", &decoded, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 3, "size should be 3");
+  verify_memory(decoded, "iii", 3);
+  Curl_safefree(decoded);
+
+  rc = curlx_base64_decode("aWk=", &decoded, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 2, "size should be 2");
+  verify_memory(decoded, "ii", 2);
+  Curl_safefree(decoded);
+
+  rc = curlx_base64_decode("aQ==", &decoded, &size);
+  fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+  fail_unless(size == 1, "size should be 1");
+  verify_memory(decoded, "i", 2);
+  Curl_safefree(decoded);
+
+  /* This is illegal input as the data is too short */
+  size = 1; /* not zero */
+  decoded = &anychar; /* not NULL */
+  rc = curlx_base64_decode("aQ", &decoded, &size);
+  fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+              "return code should be CURLE_BAD_CONTENT_ENCODING");
+  fail_unless(size == 0, "size should be 0");
+  fail_if(decoded, "returned pointer should be NULL");
+
+  /* This is illegal input as it contains three padding characters */
+  size = 1; /* not zero */
+  decoded = &anychar; /* not NULL */
+  rc = curlx_base64_decode("a===", &decoded, &size);
+  fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+              "return code should be CURLE_BAD_CONTENT_ENCODING");
+  fail_unless(size == 0, "size should be 0");
+  fail_if(decoded, "returned pointer should be NULL");
+
+  /* This is illegal input as it contains a padding character mid input */
+  size = 1; /* not zero */
+  decoded = &anychar; /* not NULL */
+  rc = curlx_base64_decode("a=Q=", &decoded, &size);
+  fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+              "return code should be CURLE_BAD_CONTENT_ENCODING");
+  fail_unless(size == 0, "size should be 0");
+  fail_if(decoded, "returned pointer should be NULL");
+
+  /* This is also illegal input as it contains a padding character mid input */
+  size = 1; /* not zero */
+  decoded = &anychar; /* not NULL */
+  rc = curlx_base64_decode("aWlpa=Q=", &decoded, &size);
+  fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+              "return code should be CURLE_BAD_CONTENT_ENCODING");
+  fail_unless(size == 0, "size should be 0");
+  fail_if(decoded, "returned pointer should be NULL");
+
+  /* This is garbage input as it contains an illegal base64 character */
+  size = 1; /* not zero */
+  decoded = &anychar; /* not NULL */
+  rc = curlx_base64_decode("a\x1f==", &decoded, &size);
+  fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+              "return code should be CURLE_BAD_CONTENT_ENCODING");
+  fail_unless(size == 0, "size should be 0");
+  fail_if(decoded, "returned pointer should be NULL");
+
+  UNITTEST_END_SIMPLE
 }
-
-static void unit_stop(void)
-{
-  curl_easy_cleanup(t1302_easy);
-  curl_global_cleanup();
-}
-
-UNITTEST_START
-
-char *output;
-unsigned char *decoded;
-size_t size = 0;
-unsigned char anychar = 'x';
-CURLcode rc;
-
-rc = curlx_base64_encode("i", 1, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(output, "aQ==", 4);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("ii", 2, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(output, "aWk=", 4);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("iii", 3, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(output, "aWlp", 4);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("iiii", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 8, "size should be 8");
-verify_memory(output, "aWlpaQ==", 8);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("\xff\x01\xfe\x02", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 8, "size should be 8");
-verify_memory(output, "/wH+Ag==", 8);
-Curl_safefree(output);
-
-rc = curlx_base64url_encode("\xff\x01\xfe\x02", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 6, "size should be 6");
-verify_memory(output, "_wH-Ag", 6);
-Curl_safefree(output);
-
-rc = curlx_base64url_encode("iiii", 4, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 6, "size should be 6");
-verify_memory(output, "aWlpaQ", 6);
-Curl_safefree(output);
-
-/* 0 length makes it do strlen() */
-rc = curlx_base64_encode("iiii", 0, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 8, "size should be 8");
-verify_memory(output, "aWlpaQ==", 8);
-Curl_safefree(output);
-
-rc = curlx_base64_encode("", 0, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 0, "size should be 0");
-fail_unless(output && !output[0], "output should be a zero-length string");
-Curl_safefree(output);
-
-rc = curlx_base64url_encode("", 0, &output, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 0, "size should be 0");
-fail_unless(output && !output[0], "output should be a zero-length string");
-Curl_safefree(output);
-
-rc = curlx_base64_decode("aWlpaQ==", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 4, "size should be 4");
-verify_memory(decoded, "iiii", 4);
-Curl_safefree(decoded);
-
-rc = curlx_base64_decode("aWlp", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 3, "size should be 3");
-verify_memory(decoded, "iii", 3);
-Curl_safefree(decoded);
-
-rc = curlx_base64_decode("aWk=", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 2, "size should be 2");
-verify_memory(decoded, "ii", 2);
-Curl_safefree(decoded);
-
-rc = curlx_base64_decode("aQ==", &decoded, &size);
-fail_unless(rc == CURLE_OK, "return code should be CURLE_OK");
-fail_unless(size == 1, "size should be 1");
-verify_memory(decoded, "i", 2);
-Curl_safefree(decoded);
-
-/* This is illegal input as the data is too short */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("aQ", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
-            "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is illegal input as it contains three padding characters */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("a===", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
-            "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is illegal input as it contains a padding character mid input */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("a=Q=", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
-            "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is also illegal input as it contains a padding character mid input */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("aWlpa=Q=", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
-            "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-/* This is garbage input as it contains an illegal base64 character */
-size = 1; /* not zero */
-decoded = &anychar; /* not NULL */
-rc = curlx_base64_decode("a\x1f==", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
-            "return code should be CURLE_BAD_CONTENT_ENCODING");
-fail_unless(size == 0, "size should be 0");
-fail_if(decoded, "returned pointer should be NULL");
-
-
-UNITTEST_STOP
index d6d39f810e15e478653d839ea7713d1c7bfae340..415d574f0cab7d2b3b1be141119fa2b681e97f35 100644 (file)
 #include "connect.h"
 #include "memdebug.h" /* LAST include file */
 
-static struct Curl_easy *t1303_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1303_setup(struct Curl_easy **easy)
 {
   CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
-  t1303_easy = curl_easy_init();
-  if(!t1303_easy) {
+  *easy = curl_easy_init();
+  if(!*easy) {
     curl_global_cleanup();
     return CURLE_OUT_OF_MEMORY;
   }
   return res;
 }
 
-static void unit_stop(void)
+static void t1303_stop(struct Curl_easy *easy)
 {
-  curl_easy_cleanup(t1303_easy);
+  curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
@@ -55,8 +53,8 @@ static void unit_stop(void)
 /* macro to set the pretended current time */
 #define NOW(x,y) now.tv_sec = x; now.tv_usec = y
 /* macro to set the millisecond based timeouts to use */
-#define TIMEOUTS(x,y) t1303_easy->set.timeout = x; \
-                      t1303_easy->set.connecttimeout = y
+#define TIMEOUTS(x,y) easy->set.timeout = x; \
+                      easy->set.connecttimeout = y
 
 /*
  * To test:
@@ -67,21 +65,25 @@ static void unit_stop(void)
  * N           various values of now
  */
 
-struct timetest {
-  int now_s;
-  int now_us;
-  unsigned int timeout_ms;
-  unsigned int connecttimeout_ms;
-  bool connecting;
-  timediff_t result;
-  const char *comment;
-};
-
-UNITTEST_START
+static CURLcode test_unit1303(char *arg)
 {
+  struct Curl_easy *easy;
+
+  UNITTEST_BEGIN(t1303_setup(&easy))
+
   struct curltime now;
   unsigned int i;
 
+  struct timetest {
+    int now_s;
+    int now_us;
+    unsigned int timeout_ms;
+    unsigned int connecttimeout_ms;
+    bool connecting;
+    timediff_t result;
+    const char *comment;
+  };
+
   const struct timetest run[] = {
   /* both timeouts set, not connecting */
   {BASE + 4, 0,      10000, 8000, FALSE, 6000, "6 seconds should be left"},
@@ -137,18 +139,19 @@ UNITTEST_START
   };
 
   /* this is the pretended start time of the transfer */
-  t1303_easy->progress.t_startsingle.tv_sec = BASE;
-  t1303_easy->progress.t_startsingle.tv_usec = 0;
-  t1303_easy->progress.t_startop.tv_sec = BASE;
-  t1303_easy->progress.t_startop.tv_usec = 0;
+  easy->progress.t_startsingle.tv_sec = BASE;
+  easy->progress.t_startsingle.tv_usec = 0;
+  easy->progress.t_startop.tv_sec = BASE;
+  easy->progress.t_startop.tv_usec = 0;
 
   for(i = 0; i < CURL_ARRAYSIZE(run); i++) {
     timediff_t timeout;
     NOW(run[i].now_s, run[i].now_us);
     TIMEOUTS(run[i].timeout_ms, run[i].connecttimeout_ms);
-    timeout =  Curl_timeleft(t1303_easy, &now, run[i].connecting);
+    timeout =  Curl_timeleft(easy, &now, run[i].connecting);
     if(timeout != run[i].result)
       fail(run[i].comment);
   }
+
+  UNITTEST_END(t1303_stop(easy))
 }
-UNITTEST_STOP
index 46ccd1745ca871d182d666f6483c58f3242ddb66..4c66170f4531933539f6688427b1acd48da31248 100644 (file)
 
 #ifndef CURL_DISABLE_NETRC
 
-static char *s_login;
-static char *s_password;
-
-static CURLcode unit_setup(void)
+static void t1304_stop(char **password, char **login)
 {
-  s_password = NULL;
-  s_login = NULL;
-  return CURLE_OK;
+  Curl_safefree(*password);
+  Curl_safefree(*login);
 }
 
-static void unit_stop(void)
+static CURLcode test_unit1304(char *arg)
 {
-  Curl_safefree(s_password);
-  Curl_safefree(s_login);
-}
+  char *login = NULL;
+  char *password = NULL;
+
+  UNITTEST_BEGIN_SIMPLE
 
-UNITTEST_START
-{
   int result;
   struct store_netrc store;
 
@@ -53,142 +48,140 @@ UNITTEST_START
    */
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "test.example.com", &s_login, &s_password, arg);
+                           "test.example.com", &login, &password, arg);
   fail_unless(result == 1, "Host not found should return 1");
-  abort_unless(s_password == NULL, "password did not return NULL!");
-  abort_unless(s_login == NULL, "user did not return NULL!");
+  abort_unless(password == NULL, "password did not return NULL!");
+  abort_unless(login == NULL, "user did not return NULL!");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test a non existent login in our netrc file.
    */
-  s_login = (char *)CURL_UNCONST("me");
+  login = (char *)CURL_UNCONST("me");
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "example.com", &s_login, &s_password, arg);
+                           "example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password == NULL, "password is not NULL!");
+  abort_unless(password == NULL, "password is not NULL!");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test a non existent login and host in our netrc file.
    */
-  s_login = (char *)CURL_UNCONST("me");
+  login = (char *)CURL_UNCONST("me");
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "test.example.com", &s_login, &s_password, arg);
+                           "test.example.com", &login, &password, arg);
   fail_unless(result == 1, "Host not found should return 1");
-  abort_unless(s_password == NULL, "password is not NULL!");
+  abort_unless(password == NULL, "password is not NULL!");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test a non existent login (substring of an existing one) in our
    * netrc file.
    */
-  s_login = (char *)CURL_UNCONST("admi");
+  login = (char *)CURL_UNCONST("admi");
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "example.com", &s_login, &s_password, arg);
+                           "example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password == NULL, "password is not NULL!");
+  abort_unless(password == NULL, "password is not NULL!");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test a non existent login (superstring of an existing one)
    * in our netrc file.
    */
-  s_login = (char *)CURL_UNCONST("adminn");
+  login = (char *)CURL_UNCONST("adminn");
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "example.com", &s_login, &s_password, arg);
+                           "example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password == NULL, "password is not NULL!");
+  abort_unless(password == NULL, "password is not NULL!");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test for the first existing host in our netrc file
-   * with s_login[0] = 0.
+   * with login[0] = 0.
    */
-  s_login = NULL;
+  login = NULL;
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "example.com", &s_login, &s_password, arg);
+                           "example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password != NULL, "returned NULL!");
-  fail_unless(strncmp(s_password, "passwd", 6) == 0,
+  abort_unless(password != NULL, "returned NULL!");
+  fail_unless(strncmp(password, "passwd", 6) == 0,
               "password should be 'passwd'");
-  abort_unless(s_login != NULL, "returned NULL!");
-  fail_unless(strncmp(s_login, "admin", 5) == 0, "login should be 'admin'");
+  abort_unless(login != NULL, "returned NULL!");
+  fail_unless(strncmp(login, "admin", 5) == 0, "login should be 'admin'");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test for the first existing host in our netrc file
-   * with s_login[0] != 0.
+   * with login[0] != 0.
    */
-  free(s_password);
-  free(s_login);
-  s_password = NULL;
-  s_login = NULL;
+  free(password);
+  free(login);
+  password = NULL;
+  login = NULL;
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "example.com", &s_login, &s_password, arg);
+                           "example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password != NULL, "returned NULL!");
-  fail_unless(strncmp(s_password, "passwd", 6) == 0,
+  abort_unless(password != NULL, "returned NULL!");
+  fail_unless(strncmp(password, "passwd", 6) == 0,
               "password should be 'passwd'");
-  abort_unless(s_login != NULL, "returned NULL!");
-  fail_unless(strncmp(s_login, "admin", 5) == 0, "login should be 'admin'");
+  abort_unless(login != NULL, "returned NULL!");
+  fail_unless(strncmp(login, "admin", 5) == 0, "login should be 'admin'");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test for the second existing host in our netrc file
-   * with s_login[0] = 0.
+   * with login[0] = 0.
    */
-  free(s_password);
-  s_password = NULL;
-  free(s_login);
-  s_login = NULL;
+  free(password);
+  password = NULL;
+  free(login);
+  login = NULL;
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "curl.example.com", &s_login, &s_password, arg);
+                           "curl.example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password != NULL, "returned NULL!");
-  fail_unless(strncmp(s_password, "none", 4) == 0,
+  abort_unless(password != NULL, "returned NULL!");
+  fail_unless(strncmp(password, "none", 4) == 0,
               "password should be 'none'");
-  abort_unless(s_login != NULL, "returned NULL!");
-  fail_unless(strncmp(s_login, "none", 4) == 0, "login should be 'none'");
+  abort_unless(login != NULL, "returned NULL!");
+  fail_unless(strncmp(login, "none", 4) == 0, "login should be 'none'");
   Curl_netrc_cleanup(&store);
 
   /*
    * Test for the second existing host in our netrc file
-   * with s_login[0] != 0.
+   * with login[0] != 0.
    */
-  free(s_password);
-  free(s_login);
-  s_password = NULL;
-  s_login = NULL;
+  free(password);
+  free(login);
+  password = NULL;
+  login = NULL;
   Curl_netrc_init(&store);
   result = Curl_parsenetrc(&store,
-                           "curl.example.com", &s_login, &s_password, arg);
+                           "curl.example.com", &login, &password, arg);
   fail_unless(result == 0, "Host should have been found");
-  abort_unless(s_password != NULL, "returned NULL!");
-  fail_unless(strncmp(s_password, "none", 4) == 0,
+  abort_unless(password != NULL, "returned NULL!");
+  fail_unless(strncmp(password, "none", 4) == 0,
               "password should be 'none'");
-  abort_unless(s_login != NULL, "returned NULL!");
-  fail_unless(strncmp(s_login, "none", 4) == 0, "login should be 'none'");
+  abort_unless(login != NULL, "returned NULL!");
+  fail_unless(strncmp(login, "none", 4) == 0, "login should be 'none'");
   Curl_netrc_cleanup(&store);
+
+  UNITTEST_END(t1304_stop(&password, &login))
 }
-UNITTEST_STOP
 
 #else
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-static void unit_stop(void)
+
+static CURLcode test_unit1304(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_START
-UNITTEST_STOP
 
 #endif
index ebff79c2f167e00b6bc7224339b6c1f046a52f83..a2bc7292ed51fb30e1ef6ce0bebb9dd99f72a426 100644 (file)
 
 #include "memdebug.h" /* LAST include file */
 
-static struct Curl_easy *t1305_easy;
 static struct Curl_dnscache hp;
 static char *data_key;
 static struct Curl_dns_entry *data_node;
 
-static CURLcode unit_setup(void)
+static CURLcode t1305_setup(void)
 {
-  t1305_easy = curl_easy_init();
-  if(!t1305_easy) {
-    curl_global_cleanup();
-    return CURLE_OUT_OF_MEMORY;
-  }
-
   Curl_dnscache_init(&hp, 7);
   return CURLE_OK;
 }
 
-static void unit_stop(void)
+static void t1305_stop(void)
 {
   if(data_node) {
     Curl_freeaddrinfo(data_node->addr);
@@ -65,15 +58,12 @@ static void unit_stop(void)
   }
   free(data_key);
   Curl_dnscache_destroy(&hp);
-
-  curl_easy_cleanup(t1305_easy);
-  curl_global_cleanup();
 }
 
 static struct Curl_addrinfo *fake_ai(void)
 {
   static struct Curl_addrinfo *ai;
-  static const char dummy[]="dummy";
+  static const char dummy[] = "dummy";
   size_t namelen = sizeof(dummy); /* including the null-terminator */
 
   ai = calloc(1, sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_in) +
@@ -109,14 +99,15 @@ static CURLcode create_node(void)
   return CURLE_OK;
 }
 
-
-UNITTEST_START
+static CURLcode test_unit1305(char *arg)
+{
+  UNITTEST_BEGIN(t1305_setup())
 
   struct Curl_dns_entry *nodep;
   size_t key_len;
 
   /* Test 1305 exits without adding anything to the hash */
-  if(strcmp(arg, "1305") != 0) {
+  if(testnum == 1306) {
     CURLcode rc = create_node();
     abort_unless(rc == CURLE_OK, "data node creation failed");
     key_len = strlen(data_key);
@@ -128,4 +119,5 @@ UNITTEST_START
     data_node = NULL;
   }
 
-UNITTEST_STOP
+  UNITTEST_END(t1305_stop())
+}
index c3329c51f18f09218006e98cd5eefc70468ae292..1b3dcd034394226258fba291b4734d228f70b03f 100644 (file)
 
 #include "curl_fnmatch.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
 #ifndef CURL_DISABLE_FTP
 
 /*
@@ -72,14 +63,10 @@ static const char *ret2name(int i)
   /* not reached */
 }
 
-enum system {
-  SYSTEM_CUSTOM,
-  SYSTEM_LINUX,
-  SYSTEM_MACOS
-};
-
-UNITTEST_START
+static CURLcode test_unit1307(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
+
   struct testcase {
     const char *pattern;
     const char *string;
@@ -278,6 +265,13 @@ UNITTEST_START
   };
 
   int i;
+
+  enum system {
+    SYSTEM_CUSTOM,
+    SYSTEM_LINUX,
+    SYSTEM_MACOS
+  };
+
   enum system machine;
 
 #ifdef HAVE_FNMATCH
@@ -311,12 +305,16 @@ UNITTEST_START
       fail("pattern mismatch");
     }
   }
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
 
 #else
 
-UNITTEST_START
-UNITTEST_STOP
+static CURLcode test_unit1307(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+  UNITTEST_END_SIMPLE
+}
 
 #endif
index 2cbab546d82773412df4e8e89167b7dd805e58c3..5da43328a8e70cd084bc35965aefb0893a4e79c5 100644 (file)
 #include "splay.h"
 #include "warnless.h"
 
-
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
 static void splayprint(struct Curl_tree *t, int d, char output)
 {
   struct Curl_tree *node;
@@ -68,7 +57,9 @@ static void splayprint(struct Curl_tree *t, int d, char output)
   splayprint(t->smaller, d + 1, output);
 }
 
-UNITTEST_START
+static CURLcode test_unit1309(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
 
 /* number of nodes to add to the splay tree */
 #define NUM_NODES 50
@@ -141,4 +132,5 @@ UNITTEST_START
 
   fail_unless(root == NULL, "tree not empty when it should be");
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 3f5ee334bb9636eb31da793795a44aa48e7beea1..a112e06c40a796dbdf1cfa3badfa3155b113f869 100644 (file)
 
 #include "timeval.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1323(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
+  UNITTEST_BEGIN_SIMPLE
 
-struct a {
-  struct curltime first;
-  struct curltime second;
-  time_t result;
-};
+  struct a {
+    struct curltime first;
+    struct curltime second;
+    time_t result;
+  };
 
-UNITTEST_START
-{
   struct a tests[] = {
     { {36762, 8345 }, {36761, 995926 }, 13 },
     { {36761, 995926 }, {36762, 8345 }, -13 },
     { {36761, 995926 }, {0, 0}, 36761995 },
     { {0, 0}, {36761, 995926 }, -36761995 },
   };
+
   size_t i;
 
   for(i = 0; i < CURL_ARRAYSIZE(tests); i++) {
@@ -64,5 +57,6 @@ UNITTEST_START
       fail("unexpected result!");
     }
   }
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
index 2e27e8093fa3fa0176df5a7571b2f5506da2707f..2144e1c2169e9a186f9de26fe532a4fd83e9d688 100644 (file)
 
 #include "memdebug.h"
 
-
-static CURLcode unit_setup(void)
+static CURLcode test_unit1330(char *arg)
 {
-  return CURLE_OK;
-}
+  UNITTEST_BEGIN_SIMPLE
 
-static void unit_stop(void)
-{
-}
+  char *ptr = malloc(1330);
+  Curl_safefree(ptr);
 
-UNITTEST_START
-
-char *ptr = malloc(1330);
-Curl_safefree(ptr);
-
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 130fc0748fcd88872ed473b95a05205a43c506a0..abb22a4370ebb9ded0b5029a0973cfcf15e818de 100644 (file)
@@ -28,25 +28,18 @@ extern int dedotdotify(const char *input, size_t clen, char **out);
 
 #include "memdebug.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1395(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-struct dotdot {
-  const char *input;
-  const char *output;
-};
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
   unsigned int i;
   int fails = 0;
+
+  struct dotdot {
+    const char *input;
+    const char *output;
+  };
+
   const struct dotdot pairs[] = {
     { "%2f%2e%2e%2f/../a", "%2f%2e%2e%2f/a" },
     { "%2f%2e%2e%2f/../", "%2f%2e%2e%2f/" },
@@ -148,4 +141,5 @@ UNITTEST_START
 
   fail_if(fails, "output mismatched");
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 43f9c8667268e655fb076492d9ecf647353b43ad..03d0a387990b6dcee9344de4a2f147329212348c 100644 (file)
  ***************************************************************************/
 #include "curlcheck.h"
 
-static CURL *hnd;
-
-static CURLcode unit_setup(void)
+static CURLcode t1396_setup(void)
 {
   CURLcode res = CURLE_OK;
-
   global_init(CURL_GLOBAL_ALL);
   return res;
 }
 
-static void unit_stop(void)
+static void t1396_stop(CURL *easy)
 {
-  if(hnd)
-    curl_easy_cleanup(hnd);
+  if(easy)
+    curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
-struct test {
-  const char *in;
-  int inlen;
-  const char *out;
-  int outlen;
-};
-
-UNITTEST_START
+static CURLcode test_unit1396(char *arg)
 {
+  CURL *easy;
+
+  UNITTEST_BEGIN(t1396_setup())
+
+  struct test {
+    const char *in;
+    int inlen;
+    const char *out;
+    int outlen;
+  };
+
   /* unescape, this => that */
-  const struct test list1[]={
+  const struct test list1[] = {
     {"%61", 3, "a", 1},
     {"%61a", 4, "aa", 2},
     {"%61b", 4, "ab", 2},
@@ -66,7 +67,7 @@ UNITTEST_START
     {NULL, 0, NULL, 0} /* end of list marker */
   };
   /* escape, this => that */
-  const struct test list2[]={
+  const struct test list2[] = {
     {"a", 1, "a", 1},
     {"/", 1, "%2F", 3},
     {"a=b", 3, "a%3Db", 5},
@@ -81,11 +82,11 @@ UNITTEST_START
   };
   int i;
 
-  hnd = curl_easy_init();
-  abort_unless(hnd != NULL, "returned NULL!");
+  easy = curl_easy_init();
+  abort_unless(easy != NULL, "returned NULL!");
   for(i = 0; list1[i].in; i++) {
     int outlen;
-    char *out = curl_easy_unescape(hnd,
+    char *out = curl_easy_unescape(easy,
                                    list1[i].in, list1[i].inlen,
                                    &outlen);
 
@@ -101,7 +102,7 @@ UNITTEST_START
 
   for(i = 0; list2[i].in; i++) {
     int outlen;
-    char *out = curl_easy_escape(hnd, list2[i].in, list2[i].inlen);
+    char *out = curl_easy_escape(easy, list2[i].in, list2[i].inlen);
     abort_unless(out != NULL, "returned NULL!");
 
     outlen = (int)strlen(out);
@@ -113,5 +114,6 @@ UNITTEST_START
 
     curl_free(out);
   }
+
+  UNITTEST_END(t1396_stop(easy))
 }
-UNITTEST_STOP
index 68acb4d2302dbf6ad1f76be931506639ba68f525..478b2a896212126bdf14635373ed5d9a90352471 100644 (file)
  ***************************************************************************/
 #include "curlcheck.h"
 
+#include "vtls/hostcheck.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1397(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+  UNITTEST_BEGIN_SIMPLE
 
 /* only these backends define the tested functions */
 #if defined(USE_OPENSSL) || defined(USE_SCHANNEL)
-#include "vtls/hostcheck.h"
 
-UNITTEST_START
-{
   struct testcase {
     const char *host;
     const char *pattern;
     bool match;
   };
 
-  static struct testcase tests[] = {
+  static const struct testcase tests[] = {
     {"", "", FALSE},
     {"a", "", FALSE},
     {"", "b", FALSE},
@@ -114,12 +107,7 @@ UNITTEST_START
       unitfail++;
     }
   }
-}
-
-UNITTEST_STOP
-#else
-
-UNITTEST_START
-
-UNITTEST_STOP
 #endif
+
+  UNITTEST_END_SIMPLE
+}
index 32d32160ed768fe5a2310ae807489eec8f9688b6..96a7e65366305fb2d2f280daf6cb9ea705b3f798 100644 (file)
 #pragma GCC diagnostic ignored "-Wformat"
 #endif
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1398(char *arg)
 {
-  return CURLE_OK;
+  UNITTEST_BEGIN_SIMPLE
+
+  int rc;
+  char buf[3] = {'b', 'u', 'g'};
+  const char *str = "bug";
+  int width = 3;
+  char output[130];
+
+  /*#define curl_msnprintf snprintf */
+
+  /* without a trailing zero */
+  rc = curl_msnprintf(output, 4, "%.*s", width, buf);
+  fail_unless(rc == 3, "return code should be 3");
+  fail_unless(!strcmp(output, "bug"), "wrong output");
+
+  /* with a trailing zero */
+  rc = curl_msnprintf(output, 4, "%.*s", width, str);
+  fail_unless(rc == 3, "return code should be 3");
+  fail_unless(!strcmp(output, "bug"), "wrong output");
+
+  width = 2;
+  /* one byte less */
+  rc = curl_msnprintf(output, 4, "%.*s", width, buf);
+  fail_unless(rc == 2, "return code should be 2");
+  fail_unless(!strcmp(output, "bu"), "wrong output");
+
+  /* string with larger precision */
+  rc = curl_msnprintf(output, 8, "%.8s", str);
+  fail_unless(rc == 3, "return code should be 3");
+  fail_unless(!strcmp(output, "bug"), "wrong output");
+
+  /* longer string with precision */
+  rc = curl_msnprintf(output, 8, "%.3s", "0123456789");
+  fail_unless(rc == 3, "return code should be 3");
+  fail_unless(!strcmp(output, "012"), "wrong output");
+
+  /* negative width */
+  rc = curl_msnprintf(output, 8, "%-8s", str);
+  fail_unless(rc == 7, "return code should be 7");
+  fail_unless(!strcmp(output, "bug    "), "wrong output");
+
+  /* larger width that string length */
+  rc = curl_msnprintf(output, 8, "%8s", str);
+  fail_unless(rc == 7, "return code should be 7");
+  fail_unless(!strcmp(output, "     bu"), "wrong output");
+
+  /* output a number in a limited output */
+  rc = curl_msnprintf(output, 4, "%d", 10240);
+  fail_unless(rc == 3, "return code should be 3");
+  fail_unless(!strcmp(output, "102"), "wrong output");
+
+  /* padded strings */
+  rc = curl_msnprintf(output, 16, "%8s%8s", str, str);
+  fail_unless(rc == 15, "return code should be 15");
+  fail_unless(!strcmp(output, "     bug     bu"), "wrong output");
+
+  /* padded numbers */
+  rc = curl_msnprintf(output, 16, "%8d%8d", 1234, 5678);
+  fail_unless(rc == 15, "return code should be 15");
+  fail_unless(!strcmp(output, "    1234    567"), "wrong output");
+
+  /* double precision */
+  rc = curl_msnprintf(output, 24, "%2$.*1$.99d", 3, 5678);
+  fail_unless(rc == 0, "return code should be 0");
+
+  /* 129 input % flags */
+  rc = curl_msnprintf(output, 130,
+                      "%s%s%s%s%s%s%s%s%s%s" /* 10 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 20 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 30 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 40 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 50 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 60 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 70 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 80 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 90 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 100 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 110 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 120 */
+                      "%s%s%s%s%s%s%s%s%s", /* 129 */
+
+                      "a", "", "", "", "", "", "", "", "", "", /* 10 */
+                      "b", "", "", "", "", "", "", "", "", "", /* 20 */
+                      "c", "", "", "", "", "", "", "", "", "", /* 30 */
+                      "d", "", "", "", "", "", "", "", "", "", /* 40 */
+                      "e", "", "", "", "", "", "", "", "", "", /* 50 */
+                      "f", "", "", "", "", "", "", "", "", "", /* 60 */
+                      "g", "", "", "", "", "", "", "", "", "", /* 70 */
+                      "h", "", "", "", "", "", "", "", "", "", /* 80 */
+                      "i", "", "", "", "", "", "", "", "", "", /* 90 */
+                      "j", "", "", "", "", "", "", "", "", "", /* 100 */
+                      "k", "", "", "", "", "", "", "", "", "", /* 110 */
+                      "l", "", "", "", "", "", "", "", "", "", /* 120 */
+                      "m", "", "", "", "", "", "", "", ""  /* 129 */
+    );
+  fail_unless(rc == 0, "return code should be 0");
+
+  /* 128 input % flags */
+  rc = curl_msnprintf(output, 130,
+                      "%s%s%s%s%s%s%s%s%s%s" /* 10 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 20 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 30 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 40 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 50 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 60 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 70 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 80 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 90 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 100 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 110 */
+                      "%s%s%s%s%s%s%s%s%s%s" /* 120 */
+                      "%s%s%s%s%s%s%s%s", /* 128 */
+
+                      "a", "", "", "", "", "", "", "", "", "", /* 10 */
+                      "b", "", "", "", "", "", "", "", "", "", /* 20 */
+                      "c", "", "", "", "", "", "", "", "", "", /* 30 */
+                      "d", "", "", "", "", "", "", "", "", "", /* 40 */
+                      "e", "", "", "", "", "", "", "", "", "", /* 50 */
+                      "f", "", "", "", "", "", "", "", "", "", /* 60 */
+                      "g", "", "", "", "", "", "", "", "", "", /* 70 */
+                      "h", "", "", "", "", "", "", "", "", "", /* 80 */
+                      "i", "", "", "", "", "", "", "", "", "", /* 90 */
+                      "j", "", "", "", "", "", "", "", "", "", /* 100 */
+                      "k", "", "", "", "", "", "", "", "", "", /* 110 */
+                      "l", "", "", "", "", "", "", "", "", "", /* 120 */
+                      "m", "", "", "", "", "", "", ""  /* 128 */
+    );
+  fail_unless(rc == 13, "return code should be 13");
+
+  /* 129 output segments */
+  rc = curl_msnprintf(output, 130,
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
+                      "%%%%%%%%%%%%%%%%%%" /* 129 */
+    );
+  fail_unless(rc == 0, "return code should be 0");
+
+  /* 128 output segments */
+  rc = curl_msnprintf(output, 129,
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
+                      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
+                      "%%%%%%%%%%%%%%%%" /* 128 */
+    );
+  fail_unless(rc == 128, "return code should be 128");
+
+  UNITTEST_END_SIMPLE
 }
 
-static void unit_stop(void)
-{
-}
-
-UNITTEST_START
-
-int rc;
-char buf[3] = {'b', 'u', 'g'};
-const char *str = "bug";
-int width = 3;
-char output[130];
-
-/*#define curl_msnprintf snprintf */
-
-/* without a trailing zero */
-rc = curl_msnprintf(output, 4, "%.*s", width, buf);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "bug"), "wrong output");
-
-/* with a trailing zero */
-rc = curl_msnprintf(output, 4, "%.*s", width, str);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "bug"), "wrong output");
-
-width = 2;
-/* one byte less */
-rc = curl_msnprintf(output, 4, "%.*s", width, buf);
-fail_unless(rc == 2, "return code should be 2");
-fail_unless(!strcmp(output, "bu"), "wrong output");
-
-/* string with larger precision */
-rc = curl_msnprintf(output, 8, "%.8s", str);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "bug"), "wrong output");
-
-/* longer string with precision */
-rc = curl_msnprintf(output, 8, "%.3s", "0123456789");
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "012"), "wrong output");
-
-/* negative width */
-rc = curl_msnprintf(output, 8, "%-8s", str);
-fail_unless(rc == 7, "return code should be 7");
-fail_unless(!strcmp(output, "bug    "), "wrong output");
-
-/* larger width that string length */
-rc = curl_msnprintf(output, 8, "%8s", str);
-fail_unless(rc == 7, "return code should be 7");
-fail_unless(!strcmp(output, "     bu"), "wrong output");
-
-/* output a number in a limited output */
-rc = curl_msnprintf(output, 4, "%d", 10240);
-fail_unless(rc == 3, "return code should be 3");
-fail_unless(!strcmp(output, "102"), "wrong output");
-
-/* padded strings */
-rc = curl_msnprintf(output, 16, "%8s%8s", str, str);
-fail_unless(rc == 15, "return code should be 15");
-fail_unless(!strcmp(output, "     bug     bu"), "wrong output");
-
-/* padded numbers */
-rc = curl_msnprintf(output, 16, "%8d%8d", 1234, 5678);
-fail_unless(rc == 15, "return code should be 15");
-fail_unless(!strcmp(output, "    1234    567"), "wrong output");
-
-/* double precision */
-rc = curl_msnprintf(output, 24, "%2$.*1$.99d", 3, 5678);
-fail_unless(rc == 0, "return code should be 0");
-
-/* 129 input % flags */
-rc = curl_msnprintf(output, 130,
-                    "%s%s%s%s%s%s%s%s%s%s" /* 10 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 20 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 30 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 40 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 50 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 60 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 70 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 80 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 90 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 100 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 110 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 120 */
-                    "%s%s%s%s%s%s%s%s%s", /* 129 */
-
-                    "a", "", "", "", "", "", "", "", "", "", /* 10 */
-                    "b", "", "", "", "", "", "", "", "", "", /* 20 */
-                    "c", "", "", "", "", "", "", "", "", "", /* 30 */
-                    "d", "", "", "", "", "", "", "", "", "", /* 40 */
-                    "e", "", "", "", "", "", "", "", "", "", /* 50 */
-                    "f", "", "", "", "", "", "", "", "", "", /* 60 */
-                    "g", "", "", "", "", "", "", "", "", "", /* 70 */
-                    "h", "", "", "", "", "", "", "", "", "", /* 80 */
-                    "i", "", "", "", "", "", "", "", "", "", /* 90 */
-                    "j", "", "", "", "", "", "", "", "", "", /* 100 */
-                    "k", "", "", "", "", "", "", "", "", "", /* 110 */
-                    "l", "", "", "", "", "", "", "", "", "", /* 120 */
-                    "m", "", "", "", "", "", "", "", ""  /* 129 */
-  );
-fail_unless(rc == 0, "return code should be 0");
-
-/* 128 input % flags */
-rc = curl_msnprintf(output, 130,
-                    "%s%s%s%s%s%s%s%s%s%s" /* 10 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 20 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 30 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 40 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 50 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 60 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 70 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 80 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 90 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 100 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 110 */
-                    "%s%s%s%s%s%s%s%s%s%s" /* 120 */
-                    "%s%s%s%s%s%s%s%s", /* 128 */
-
-                    "a", "", "", "", "", "", "", "", "", "", /* 10 */
-                    "b", "", "", "", "", "", "", "", "", "", /* 20 */
-                    "c", "", "", "", "", "", "", "", "", "", /* 30 */
-                    "d", "", "", "", "", "", "", "", "", "", /* 40 */
-                    "e", "", "", "", "", "", "", "", "", "", /* 50 */
-                    "f", "", "", "", "", "", "", "", "", "", /* 60 */
-                    "g", "", "", "", "", "", "", "", "", "", /* 70 */
-                    "h", "", "", "", "", "", "", "", "", "", /* 80 */
-                    "i", "", "", "", "", "", "", "", "", "", /* 90 */
-                    "j", "", "", "", "", "", "", "", "", "", /* 100 */
-                    "k", "", "", "", "", "", "", "", "", "", /* 110 */
-                    "l", "", "", "", "", "", "", "", "", "", /* 120 */
-                    "m", "", "", "", "", "", "", ""  /* 128 */
-  );
-fail_unless(rc == 13, "return code should be 13");
-
-/* 129 output segments */
-rc = curl_msnprintf(output, 130,
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
-                    "%%%%%%%%%%%%%%%%%%" /* 129 */
-  );
-fail_unless(rc == 0, "return code should be 0");
-
-/* 128 output segments */
-rc = curl_msnprintf(output, 129,
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 20 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 40 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 60 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 80 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 100 */
-                    "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" /* 120 */
-                    "%%%%%%%%%%%%%%%%" /* 128 */
-  );
-fail_unless(rc == 128, "return code should be 128");
-
-UNITTEST_STOP
-
 #if defined(CURL_GNUC_DIAG) || defined(__clang__)
 #pragma GCC diagnostic pop
 #endif
index b2e764ca7ff8c6848a91b7e1efaae3b890d871d0..7fba074f4f6fc797a1f8df50b1253a6f4c1c0924 100644 (file)
 #include "urldata.h"
 #include "progress.h"
 
-static int usec_magnitude = 1000000;
-
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
 /*
  * Invoke Curl_pgrsTime for TIMER_STARTSINGLE to trigger the behavior that
  * manages is_t_startransfer_set, but fake the t_startsingle time for purposes
@@ -53,6 +42,8 @@ static void fake_t_startsingle_time(struct Curl_easy *data,
 
 static bool usec_matches_seconds(timediff_t time_usec, int expected_seconds)
 {
+  static int usec_magnitude = 1000000;
+
   int time_sec = (int)(time_usec / usec_magnitude);
   bool same = (time_sec == expected_seconds);
   curl_mfprintf(stderr, "is %d us same as %d seconds? %s\n",
@@ -80,7 +71,10 @@ static void expect_timer_seconds(struct Curl_easy *data, int seconds)
  * E.g., if t_starttransfer took 2 seconds initially and took another 1
  * second for the redirect request, then the resulting t_starttransfer should
  * be 3 seconds. */
-UNITTEST_START
+static CURLcode test_unit1399(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+
   struct Curl_easy data;
   struct curltime now = curlx_now();
 
@@ -116,4 +110,6 @@ UNITTEST_START
   Curl_pgrsTime(&data, TIMER_STARTTRANSFER);
 
   expect_timer_seconds(&data, 3);
-UNITTEST_STOP
+
+  UNITTEST_END_SIMPLE
+}
index 2ed82eaff92b2ccd38eb771fb5ec5ecdf6c988f5..de8431d998080327071531768271fe6c92863da1 100644 (file)
 #include "urldata.h"
 #include "curl_ntlm_core.h"
 
-static CURL *t1600_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1600_setup(CURL **easy)
 {
   CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
-  t1600_easy = curl_easy_init();
-  if(!t1600_easy) {
+  *easy = curl_easy_init();
+  if(!*easy) {
     curl_global_cleanup();
     return CURLE_OUT_OF_MEMORY;
   }
   return res;
 }
 
-static void unit_stop(void)
+static void t1600_stop(CURL *easy)
 {
-  curl_easy_cleanup(t1600_easy);
+  curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
-UNITTEST_START
+static CURLcode test_unit1600(char *arg)
+{
+  CURL *easy;
+
+  UNITTEST_BEGIN(t1600_setup(&easy))
 
 #if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || \
                           defined(USE_WIN32_CRYPTO))
@@ -65,11 +67,12 @@ UNITTEST_START
               "\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0"
               "\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21);
 
-/* !checksrc! disable LONGLINE 2 */
+  /* !checksrc! disable LONGLINE 2 */
   Curl_ntlm_core_mk_nt_hash("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output);
 
   verify_memory(testp,
                 "\x36\x9d\xae\x06\x84\x7e\xe1\xc1\x4a\x94\x39\xea\x6f\x44\x8c\x65\x00\x00\x00\x00\x00", 21);
 #endif
 
-UNITTEST_STOP
+  UNITTEST_END(t1600_stop(easy))
+}
index 4623bb7769bd8d1176e7c9f1e304aaf557dda3c9..343ef4adb433cae57d35e3206acb0dd1ea2b2e61 100644 (file)
 
 #include "curl_md5.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1601(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
 #if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \
     || !defined(CURL_DISABLE_DIGEST_AUTH)
@@ -56,5 +48,5 @@ UNITTEST_START
                 "\x87\x5f\x22", MD5_DIGEST_LEN);
 #endif
 
-
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 29562c6143ac40bfd467d52edb8304bc98afe03d..020d57f458e88294032a1e9b9b249d0b93025ce6 100644 (file)
 
 #include <memdebug.h> /* LAST include file */
 
-static struct Curl_hash t1602_hash_static;
-
 static void t1602_mydtor(void *p)
 {
   int *ptr = (int *)p;
   free(ptr);
 }
 
-static CURLcode unit_setup(void)
+static CURLcode t1602_setup(struct Curl_hash *hash)
 {
-  Curl_hash_init(&t1602_hash_static, 7, Curl_hash_str,
+  Curl_hash_init(hash, 7, Curl_hash_str,
                  curlx_str_key_compare, t1602_mydtor);
   return CURLE_OK;
 }
 
-static void unit_stop(void)
+static void t1602_stop(struct Curl_hash *hash)
 {
-  Curl_hash_destroy(&t1602_hash_static);
+  Curl_hash_destroy(hash);
 }
 
-UNITTEST_START
+static CURLcode test_unit1602(char *arg)
+{
+  struct Curl_hash hash;
+
+  UNITTEST_BEGIN(t1602_setup(&hash))
+
   int *value;
   int *value2;
   int *nodep;
@@ -58,23 +61,23 @@ UNITTEST_START
   int key = 20;
   int key2 = 25;
 
-
   value = malloc(sizeof(int));
   abort_unless(value != NULL, "Out of memory");
   *value = 199;
-  nodep = Curl_hash_add(&t1602_hash_static, &key, klen, value);
+  nodep = Curl_hash_add(&hash, &key, klen, value);
   if(!nodep)
     free(value);
   abort_unless(nodep, "insertion into hash failed");
-  Curl_hash_clean(&t1602_hash_static);
+  Curl_hash_clean(&hash);
 
   /* Attempt to add another key/value pair */
   value2 = malloc(sizeof(int));
   abort_unless(value2 != NULL, "Out of memory");
   *value2 = 204;
-  nodep = Curl_hash_add(&t1602_hash_static, &key2, klen, value2);
+  nodep = Curl_hash_add(&hash, &key2, klen, value2);
   if(!nodep)
     free(value2);
   abort_unless(nodep, "insertion into hash failed");
 
-UNITTEST_STOP
+  UNITTEST_END(t1602_stop(&hash))
+}
index 20861ea86a5823646c4d8b8b91c85fa8e1b4b469..37700af9b6409dd1f04bef92e8a08986ae62cd06 100644 (file)
@@ -27,7 +27,6 @@
 #include "hash.h"
 #include <memdebug.h> /* LAST include file */
 
-static struct Curl_hash t1603_hash_static;
 static const size_t slots = 3;
 
 static void t1603_mydtor(void *p)
@@ -46,19 +45,24 @@ static void my_elem_dtor(void *key, size_t key_len, void *p)
   ++elem_dtor_calls;
 }
 
-static CURLcode unit_setup(void)
+static CURLcode t1603_setup(struct Curl_hash *hash_static)
 {
-  Curl_hash_init(&t1603_hash_static, slots, Curl_hash_str,
+  Curl_hash_init(hash_static, slots, Curl_hash_str,
                  curlx_str_key_compare, t1603_mydtor);
   return CURLE_OK;
 }
 
-static void unit_stop(void)
+static void t1603_stop(struct Curl_hash *hash_static)
 {
-  Curl_hash_destroy(&t1603_hash_static);
+  Curl_hash_destroy(hash_static);
 }
 
-UNITTEST_START
+static CURLcode test_unit1603(char *arg)
+{
+  struct Curl_hash hash_static;
+
+  UNITTEST_BEGIN(t1603_setup(&hash_static))
+
   char key1[] = "key1";
   char key2[] = "key2b";
   char key3[] = "key3";
@@ -78,100 +82,100 @@ UNITTEST_START
                   "Warning: hashes are not computed as expected on this "
                   "architecture; test coverage will be less comprehensive\n");
 
-  nodep = Curl_hash_add(&t1603_hash_static, &key1, strlen(key1), &key1);
+  nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), &key1);
   fail_unless(nodep, "insertion into hash failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+  nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
   fail_unless(nodep == key1, "hash retrieval failed");
 
-  nodep = Curl_hash_add(&t1603_hash_static, &key2, strlen(key2), &key2);
+  nodep = Curl_hash_add(&hash_static, &key2, strlen(key2), &key2);
   fail_unless(nodep, "insertion into hash failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key2, strlen(key2));
+  nodep = Curl_hash_pick(&hash_static, &key2, strlen(key2));
   fail_unless(nodep == key2, "hash retrieval failed");
 
-  nodep = Curl_hash_add(&t1603_hash_static, &key3, strlen(key3), &key3);
+  nodep = Curl_hash_add(&hash_static, &key3, strlen(key3), &key3);
   fail_unless(nodep, "insertion into hash failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key3, strlen(key3));
+  nodep = Curl_hash_pick(&hash_static, &key3, strlen(key3));
   fail_unless(nodep == key3, "hash retrieval failed");
 
   /* The fourth element exceeds the number of slots & collides */
-  nodep = Curl_hash_add(&t1603_hash_static, &key4, strlen(key4), &key4);
+  nodep = Curl_hash_add(&hash_static, &key4, strlen(key4), &key4);
   fail_unless(nodep, "insertion into hash failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+  nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
   fail_unless(nodep == key4, "hash retrieval failed");
 
   /* Make sure all elements are still accessible */
-  nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+  nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
   fail_unless(nodep == key1, "hash retrieval failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key2, strlen(key2));
+  nodep = Curl_hash_pick(&hash_static, &key2, strlen(key2));
   fail_unless(nodep == key2, "hash retrieval failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key3, strlen(key3));
+  nodep = Curl_hash_pick(&hash_static, &key3, strlen(key3));
   fail_unless(nodep == key3, "hash retrieval failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+  nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
   fail_unless(nodep == key4, "hash retrieval failed");
 
   /* Delete the second of two entries in a bucket */
-  rc = Curl_hash_delete(&t1603_hash_static, &key4, strlen(key4));
+  rc = Curl_hash_delete(&hash_static, &key4, strlen(key4));
   fail_unless(rc == 0, "hash delete failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+  nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
   fail_unless(nodep == key1, "hash retrieval failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+  nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
   fail_unless(!nodep, "hash retrieval should have failed");
 
   /* Insert that deleted node again */
-  nodep = Curl_hash_add(&t1603_hash_static, &key4, strlen(key4), &key4);
+  nodep = Curl_hash_add(&hash_static, &key4, strlen(key4), &key4);
   fail_unless(nodep, "insertion into hash failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+  nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
   fail_unless(nodep == key4, "hash retrieval failed");
 
   /* Delete the first of two entries in a bucket */
-  rc = Curl_hash_delete(&t1603_hash_static, &key1, strlen(key1));
+  rc = Curl_hash_delete(&hash_static, &key1, strlen(key1));
   fail_unless(rc == 0, "hash delete failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+  nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
   fail_unless(!nodep, "hash retrieval should have failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+  nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
   fail_unless(nodep == key4, "hash retrieval failed");
 
   /* Delete the remaining one of two entries in a bucket */
-  rc = Curl_hash_delete(&t1603_hash_static, &key4, strlen(key4));
+  rc = Curl_hash_delete(&hash_static, &key4, strlen(key4));
   fail_unless(rc == 0, "hash delete failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+  nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
   fail_unless(!nodep, "hash retrieval should have failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key4, strlen(key4));
+  nodep = Curl_hash_pick(&hash_static, &key4, strlen(key4));
   fail_unless(!nodep, "hash retrieval should have failed");
 
   /* Delete an already deleted node */
-  rc = Curl_hash_delete(&t1603_hash_static, &key4, strlen(key4));
+  rc = Curl_hash_delete(&hash_static, &key4, strlen(key4));
   fail_unless(rc, "hash delete should have failed");
 
   /* Replace an existing node */
-  nodep = Curl_hash_add(&t1603_hash_static, &key1, strlen(key1), &notakey);
+  nodep = Curl_hash_add(&hash_static, &key1, strlen(key1), &notakey);
   fail_unless(nodep, "insertion into hash failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key1, strlen(key1));
+  nodep = Curl_hash_pick(&hash_static, &key1, strlen(key1));
   fail_unless(nodep == notakey, "hash retrieval failed");
 
   /* Make sure all remaining elements are still accessible */
-  nodep = Curl_hash_pick(&t1603_hash_static, &key2, strlen(key2));
+  nodep = Curl_hash_pick(&hash_static, &key2, strlen(key2));
   fail_unless(nodep == key2, "hash retrieval failed");
-  nodep = Curl_hash_pick(&t1603_hash_static, &key3, strlen(key3));
+  nodep = Curl_hash_pick(&hash_static, &key3, strlen(key3));
   fail_unless(nodep == key3, "hash retrieval failed");
 
   /* Add element with own destructor */
-  nodep = Curl_hash_add2(&t1603_hash_static, &key1, strlen(key1), &key1,
+  nodep = Curl_hash_add2(&hash_static, &key1, strlen(key1), &key1,
                          my_elem_dtor);
   fail_unless(nodep, "add2 insertion into hash failed");
   fail_unless(elem_dtor_calls == 0, "element destructor count should be 0");
   /* Add it again, should invoke destructor on first */
-  nodep = Curl_hash_add2(&t1603_hash_static, &key1, strlen(key1), &key1,
+  nodep = Curl_hash_add2(&hash_static, &key1, strlen(key1), &key1,
                          my_elem_dtor);
   fail_unless(nodep, "add2 again, insertion into hash failed");
   fail_unless(elem_dtor_calls == 1, "element destructor count should be 1");
   /* remove, should invoke destructor */
-  rc = Curl_hash_delete(&t1603_hash_static, &key1, strlen(key1));
+  rc = Curl_hash_delete(&hash_static, &key1, strlen(key1));
   fail_unless(rc == 0, "hash delete failed");
   fail_unless(elem_dtor_calls == 2, "element destructor count should be 1");
 
-
   /* Clean up */
-  Curl_hash_clean(&t1603_hash_static);
+  Curl_hash_clean(&hash_static);
 
-UNITTEST_STOP
+  UNITTEST_END(t1603_stop(&hash_static))
+}
index 30b62a80803d9217a0800e9162a30c63011651b3..0beeb0769f855b4b42369308a9a83250ffc41972 100644 (file)
 
 #include "llist.h"
 
-static CURL *t1605_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1605_setup(CURL **easy)
 {
   CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
-  t1605_easy = curl_easy_init();
-  if(!t1605_easy) {
+  *easy = curl_easy_init();
+  if(!*easy) {
     curl_global_cleanup();
     return CURLE_OUT_OF_MEMORY;
   }
   return res;
 }
 
-static void unit_stop(void)
+static void t1605_stop(CURL *easy)
 {
-  curl_easy_cleanup(t1605_easy);
+  curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
-UNITTEST_START
+static CURLcode test_unit1605(char *arg)
+{
+  CURL *easy;
+
+  UNITTEST_BEGIN(t1605_setup(&easy))
+
   int len;
   char *esc;
 
-  esc = curl_easy_escape(t1605_easy, "", -1);
+  esc = curl_easy_escape(easy, "", -1);
   fail_unless(esc == NULL, "negative string length can't work");
 
-  esc = curl_easy_unescape(t1605_easy, "%41%41%41%41", -1, &len);
+  esc = curl_easy_unescape(easy, "%41%41%41%41", -1, &len);
   fail_unless(esc == NULL, "negative string length can't work");
 
-UNITTEST_STOP
+  UNITTEST_END(t1605_stop(easy))
+}
index 1e3297036a17b283cb7b837287c394a8f35925e3..56748e8d8b2ab855c13a2dac33b76508a2a229bc 100644 (file)
 #include "speedcheck.h"
 #include "urldata.h"
 
-static struct Curl_easy *t1606_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t1606_setup(struct Curl_easy **easy)
 {
   CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
-  t1606_easy = curl_easy_init();
-  if(!t1606_easy) {
+  *easy = curl_easy_init();
+  if(!*easy) {
     curl_global_cleanup();
     return CURLE_OUT_OF_MEMORY;
   }
   return res;
 }
 
-static void unit_stop(void)
+static void t1606_stop(struct Curl_easy *easy)
 {
-  curl_easy_cleanup(t1606_easy);
+  curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
-static int runawhile(long time_limit,
+static int runawhile(struct Curl_easy *easy,
+                     long time_limit,
                      long speed_limit,
                      curl_off_t speed,
                      int dec)
@@ -57,14 +56,14 @@ static int runawhile(long time_limit,
   CURLcode result;
   int finaltime;
 
-  curl_easy_setopt(t1606_easy, CURLOPT_LOW_SPEED_LIMIT, speed_limit);
-  curl_easy_setopt(t1606_easy, CURLOPT_LOW_SPEED_TIME, time_limit);
-  Curl_speedinit(t1606_easy);
+  curl_easy_setopt(easy, CURLOPT_LOW_SPEED_LIMIT, speed_limit);
+  curl_easy_setopt(easy, CURLOPT_LOW_SPEED_TIME, time_limit);
+  Curl_speedinit(easy);
 
   do {
     /* fake the current transfer speed */
-    t1606_easy->progress.current_speed = speed;
-    result = Curl_speedcheck(t1606_easy, now);
+    easy->progress.current_speed = speed;
+    result = Curl_speedcheck(easy, now);
     if(result)
       break;
     /* step the time */
@@ -77,17 +76,24 @@ static int runawhile(long time_limit,
   return finaltime;
 }
 
-UNITTEST_START
-  fail_unless(runawhile(41, 41, 40, 0) == 41,
+static CURLcode test_unit1606(char *arg)
+{
+  struct Curl_easy *easy;
+
+  UNITTEST_BEGIN(t1606_setup(&easy))
+
+  fail_unless(runawhile(easy, 41, 41, 40, 0) == 41,
               "wrong low speed timeout");
-  fail_unless(runawhile(21, 21, 20, 0) == 21,
+  fail_unless(runawhile(easy, 21, 21, 20, 0) == 21,
               "wrong low speed timeout");
-  fail_unless(runawhile(60, 60, 40, 0) == 60,
+  fail_unless(runawhile(easy, 60, 60, 40, 0) == 60,
               "wrong log speed timeout");
-  fail_unless(runawhile(50, 50, 40, 0) == 50,
+  fail_unless(runawhile(easy, 50, 50, 40, 0) == 50,
               "wrong log speed timeout");
-  fail_unless(runawhile(40, 40, 40, 0) == 99,
+  fail_unless(runawhile(easy, 40, 40, 40, 0) == 99,
               "should not time out");
-  fail_unless(runawhile(10, 50, 100, 2) == 36,
+  fail_unless(runawhile(easy, 10, 50, 100, 2) == 36,
               "bad timeout");
-UNITTEST_STOP
+
+  UNITTEST_END(t1606_stop(easy))
+}
index 59b85eaacb18b61f858fde83bc724fc72bd5b36a..ba047361d329d6a950f245476576284b05fc6ee6 100644 (file)
 
 #include "memdebug.h" /* LAST include file */
 
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-}
-
-static CURLcode unit_setup(void)
+static CURLcode t1607_setup(void)
 {
   CURLcode res = CURLE_OK;
-
   global_init(CURL_GLOBAL_ALL);
-
   return res;
 }
-/* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
-   addresses, so we have to do that as well. */
-static const char skip = 0;
+
+static CURLcode test_unit1607(char *arg)
+{
+  /* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
+     addresses, so we have to do that as well. */
+  static const char skip = 0;
 #ifdef USE_IPV6
 #define IPV6ONLY(x) x
 #else
 #define IPV6ONLY(x) &skip
 #endif
 
-UNITTEST_START
-{
+  UNITTEST_BEGIN(t1607_setup())
+
   struct testcase {
     /* host:port:address[,address]... */
     const char *optval;
@@ -233,5 +229,6 @@ error:
   curl_easy_cleanup(easy);
   curl_multi_cleanup(multi);
   curl_slist_free_all(list);
+
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
index f734b77885c250005c188fd88322ac300c952dcc..6a395c1feeefbeacc92fe95335a5cbcd7c10012f 100644 (file)
 CURLcode Curl_shuffle_addr(struct Curl_easy *data,
                            struct Curl_addrinfo **addr);
 
-#define NUM_ADDRS 8
-static struct Curl_addrinfo addrs[NUM_ADDRS];
+static struct Curl_addrinfo addrs[8];
 
-static CURLcode unit_setup(void)
+static CURLcode t1608_setup(void)
 {
-  int i;
-  for(i = 0; i < NUM_ADDRS - 1; i++) {
+  size_t i;
+  for(i = 0; i < CURL_ARRAYSIZE(addrs) - 1; i++) {
     addrs[i].ai_next = &addrs[i + 1];
   }
 
   return CURLE_OK;
 }
 
-static void unit_stop(void)
+static CURLcode test_unit1608(char *arg)
 {
-  curl_global_cleanup();
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN(t1608_setup())
 
   int i;
   CURLcode code;
@@ -73,17 +69,15 @@ UNITTEST_START
 
   abort_unless(addrhead != addrs, "addresses are not being reordered");
 
-UNITTEST_STOP
+  UNITTEST_END(curl_global_cleanup())
+}
 
 #else
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-static void unit_stop(void)
+
+static CURLcode test_unit1608(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_START
-UNITTEST_STOP
 
 #endif
index 19dcb1771cde46f93808731c21dcc31930b4ccd5..f8758f6acceaad88bea33a02a2bb8e931053f8d9 100644 (file)
 
 #include "memdebug.h" /* LAST include file */
 
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-}
-
-static CURLcode unit_setup(void)
+static CURLcode t1609_setup(void)
 {
   CURLcode res = CURLE_OK;
-
   global_init(CURL_GLOBAL_ALL);
-
   return res;
 }
 
@@ -75,8 +68,10 @@ Test:
  expected result: cached address has zero timestamp and new address
 */
 
-UNITTEST_START
+static CURLcode test_unit1609(char *arg)
 {
+  UNITTEST_BEGIN(t1609_setup())
+
   struct testcase {
     /* host:port:address[,address]... */
     const char *optval;
@@ -217,5 +212,6 @@ error:
   curl_easy_cleanup(easy);
   curl_multi_cleanup(multi);
   curl_slist_free_all(list);
+
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
index b9d6117a74b6224307e235a85a9353c3d4039f24..180d140b87cdb0b527f129ddb1dde9eef7d9e9db 100644 (file)
 
 #include "curl_sha256.h"
 
-static CURLcode unit_setup(void)
+static CURLcode t1610_setup(void)
 {
   CURLcode res = CURLE_OK;
   global_init(CURL_GLOBAL_ALL);
   return res;
 }
 
-static void unit_stop(void)
+static CURLcode test_unit1610(char *arg)
 {
-  curl_global_cleanup();
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN(t1610_setup())
 
 #if !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) \
     || defined(USE_LIBSSH2)
@@ -62,5 +59,5 @@ UNITTEST_START
                 "\x15\xae", CURL_SHA256_DIGEST_LENGTH);
 #endif
 
-
-UNITTEST_STOP
+  UNITTEST_END(curl_global_cleanup())
+}
index 0062ac6c373c7fd501c805f7f0635d081e249fa4..8368c3785672be511c87b36f2900e54d4e523051 100644 (file)
 
 #include "curl_md4.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1611(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
 #ifdef USE_CURL_NTLM_CORE
   const char string1[] = "1";
@@ -56,5 +48,5 @@ UNITTEST_START
                 "\x0b", MD4_DIGEST_LENGTH);
 #endif
 
-
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 76483d92a391bef6639b35bcd95b6170dc401bd6..f6e5a4e5188b82611a8723224a1d663e911ec86b 100644 (file)
 #include "curl_hmac.h"
 #include "curl_md5.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1612(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
 #if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \
     || !defined(CURL_DISABLE_DIGEST_AUTH)
@@ -66,5 +58,5 @@ UNITTEST_START
                 "\xd0", HMAC_MD5_LENGTH);
 #endif
 
-
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 5cb96cfd9f451b0ea38ff1ed1637a3c386270d3d..0b30fcd51241a85aeafab0b170b2e520dbe42dd9 100644 (file)
 
 #include "noproxy.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1614(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-struct check {
-  const char *a;
-  const char *n;
-  unsigned int bits;
-  bool match;
-};
-
-struct noproxy {
-  const char *a;
-  const char *n;
-  bool match;
-};
+  UNITTEST_BEGIN_SIMPLE
 
-UNITTEST_START
 #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_PROXY)
-{
   int i;
   int err = 0;
+
+  struct check {
+  const char *a;
+    const char *n;
+    unsigned int bits;
+    bool match;
+  };
   struct check list4[]= {
     { "192.160.0.1", "192.160.0.1", 33, FALSE},
     { "192.160.0.1", "192.160.0.1", 32, TRUE},
@@ -78,6 +64,11 @@ UNITTEST_START
     { NULL, NULL, 0, FALSE} /* end marker */
   };
 #endif
+  struct noproxy {
+    const char *a;
+    const char *n;
+    bool match;
+  };
   struct noproxy list[]= {
     { "www.example.com", "localhost .example.com .example.de", FALSE},
     { "www.example.com", "localhost,.example.com,.example.de", TRUE},
@@ -161,6 +152,7 @@ UNITTEST_START
     }
   }
   fail_if(err, "errors");
-}
 #endif
-UNITTEST_STOP
+
+  UNITTEST_END_SIMPLE
+}
index b0b32b61fcb7bb525ee136ffef4e22aecfa43224..f1004c1e8d81eec3b32179f354721e4ed9b42ef8 100644 (file)
 
 #include "curl_sha512_256.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1615(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
 #ifdef CURL_HAVE_SHA512_256
 
@@ -155,5 +147,5 @@ UNITTEST_START
 
 #endif /* CURL_HAVE_SHA512_256 */
 
-
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 4520503c9eb72b4a7407fa68f5c59cd2172cffa3..67757fba098e8c85d3d1a720d641ec2935b063aa 100644 (file)
@@ -27,8 +27,6 @@
 #include <uint-hash.h>
 #include <memdebug.h> /* LAST include file */
 
-static struct uint_hash t1616_hash_static;
-
 static void t1616_mydtor(unsigned int id, void *elem)
 {
   int *ptr = (int *)elem;
@@ -36,18 +34,23 @@ static void t1616_mydtor(unsigned int id, void *elem)
   free(ptr);
 }
 
-static CURLcode unit_setup(void)
+static CURLcode t1616_setup(struct uint_hash *hash)
 {
-  Curl_uint_hash_init(&t1616_hash_static, 15, t1616_mydtor);
+  Curl_uint_hash_init(hash, 15, t1616_mydtor);
   return CURLE_OK;
 }
 
-static void unit_stop(void)
+static void t1616_stop(struct uint_hash *hash)
 {
-  Curl_uint_hash_destroy(&t1616_hash_static);
+  Curl_uint_hash_destroy(hash);
 }
 
-UNITTEST_START
+static CURLcode test_unit1616(char *arg)
+{
+  struct uint_hash hash;
+
+  UNITTEST_BEGIN(t1616_setup(&hash))
+
   int *value, *v;
   int *value2;
   bool ok;
@@ -55,31 +58,31 @@ UNITTEST_START
   unsigned int key = 20;
   unsigned int key2 = 25;
 
-
   value = malloc(sizeof(int));
   abort_unless(value != NULL, "Out of memory");
   *value = 199;
-  ok = Curl_uint_hash_set(&t1616_hash_static, key, value);
+  ok = Curl_uint_hash_set(&hash, key, value);
   if(!ok)
     free(value);
   abort_unless(ok, "insertion into hash failed");
-  v = Curl_uint_hash_get(&t1616_hash_static, key);
+  v = Curl_uint_hash_get(&hash, key);
   abort_unless(v == value, "lookup present entry failed");
-  v = Curl_uint_hash_get(&t1616_hash_static, key2);
+  v = Curl_uint_hash_get(&hash, key2);
   abort_unless(!v, "lookup missing entry failed");
-  Curl_uint_hash_clear(&t1616_hash_static);
+  Curl_uint_hash_clear(&hash);
 
   /* Attempt to add another key/value pair */
   value2 = malloc(sizeof(int));
   abort_unless(value2 != NULL, "Out of memory");
   *value2 = 204;
-  ok = Curl_uint_hash_set(&t1616_hash_static, key2, value2);
+  ok = Curl_uint_hash_set(&hash, key2, value2);
   if(!ok)
     free(value2);
   abort_unless(ok, "insertion into hash failed");
-  v = Curl_uint_hash_get(&t1616_hash_static, key2);
+  v = Curl_uint_hash_get(&hash, key2);
   abort_unless(v == value2, "lookup present entry failed");
-  v = Curl_uint_hash_get(&t1616_hash_static, key);
+  v = Curl_uint_hash_get(&hash, key);
   abort_unless(!v, "lookup missing entry failed");
 
-UNITTEST_STOP
+  UNITTEST_END(t1616_stop(&hash))
+}
index 736f69e081fd89a0d99a7ed5e4e9837a023c8010..866ecb1baad576a8d6ae85c2051d9ee136733a63 100644 (file)
 
 #include "memdebug.h" /* LAST include file */
 
-static CURLcode unit_setup(void)
+static CURLcode t1620_setup(void)
 {
   CURLcode res = CURLE_OK;
   global_init(CURL_GLOBAL_ALL);
   return res;
 }
 
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-}
-
 static void t1620_parse(
   const char *input,
   const char *exp_username,
@@ -74,8 +69,10 @@ static void t1620_parse(
   free(options);
 }
 
-UNITTEST_START
+static CURLcode test_unit1620(char *arg)
 {
+  UNITTEST_BEGIN(t1620_setup())
+
   CURLcode rc;
   struct Curl_easy *empty;
   enum dupstring i;
@@ -131,5 +128,5 @@ UNITTEST_START
   rc = Curl_close(&empty);
   fail_unless(rc == CURLE_OK, "Curl_close() failed");
 
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
index 53b44c00bc5e550e967e0e2d2134642447359874..0abcd99a51fd717b2084837fd7c4d977c178b989 100644 (file)
 #include "doh.h"
 #include "dynbuf.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1650(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
+  UNITTEST_BEGIN_SIMPLE
 
 #ifndef CURL_DISABLE_DOH
+
 #define DNS_PREAMBLE "\x00\x00\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00"
 #define LABEL_TEST "\x04\x74\x65\x73\x74"
 #define LABEL_HOST "\x04\x68\x6f\x73\x74"
@@ -49,36 +44,35 @@ static void unit_stop(void)
 #define DNS_Q1 DNS_PREAMBLE LABEL_TEST LABEL_HOST LABEL_NAME DNSA_EPILOGUE
 #define DNS_Q2 DNS_PREAMBLE LABEL_TEST LABEL_HOST LABEL_NAME DNSAAAA_EPILOGUE
 
-struct dohrequest {
-  /* input */
-  const char *name;
-  DNStype type;
-
-  /* output */
-  const char *packet;
-  size_t size;
-  DOHcode rc;
-};
-
-
-static const struct dohrequest req[] = {
-  {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
-  {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
-  {"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
-   ".host.name",
-   DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
-};
-
-struct dohresp {
-  /* input */
-  const char *packet;
-  size_t size;
-  DNStype type;
+  struct dohrequest {
+    /* input */
+    const char *name;
+    DNStype type;
 
-  /* output */
-  DOHcode rc;
-  const char *out;
-};
+    /* output */
+    const char *packet;
+    size_t size;
+    DOHcode rc;
+  };
+
+  static const struct dohrequest req[] = {
+    {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
+    {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
+    {"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
+     ".host.name",
+     DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
+  };
+
+  struct dohresp {
+    /* input */
+    const char *packet;
+    size_t size;
+    DNStype type;
+
+    /* output */
+    DOHcode rc;
+    const char *out;
+  };
 
 #define DNS_FOO_EXAMPLE_COM                                          \
   "\x00\x00\x01\x00\x00\x01\x00\x01\x00\x00\x00\x00\x03\x66\x6f\x6f" \
@@ -86,9 +80,9 @@ struct dohresp {
   "\x01\xc0\x0c\x00\x01\x00\x01\x00\x00\x00\x37\x00\x04\x7f\x00\x00" \
   "\x01"
 
-static const char full49[] = DNS_FOO_EXAMPLE_COM;
+  static const char full49[] = DNS_FOO_EXAMPLE_COM;
 
-static const struct dohresp resp[] = {
+  static const struct dohresp resp[] = {
   {"\x00\x00", 2, DNS_TYPE_A, DOH_TOO_SMALL_BUFFER, NULL },
   {"\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01", 12,
    DNS_TYPE_A, DOH_DNS_BAD_ID, NULL },
@@ -151,10 +145,8 @@ static const struct dohresp resp[] = {
    DNS_TYPE_AAAA, DOH_OK,
    "2020:2020:0000:0000:0000:0000:0000:2020 " },
 
-};
+  };
 
-UNITTEST_START
-{
   size_t size = 0;
   unsigned char buffer[256];
   size_t i;
@@ -285,13 +277,7 @@ UNITTEST_START
     }
     fail_if(d.numcname, "bad cname counter");
   }
-}
-UNITTEST_STOP
-
-#else /* CURL_DISABLE_DOH */
-UNITTEST_START
-/* nothing to do, just succeed */
-UNITTEST_STOP
-
-
 #endif
+
+  UNITTEST_END_SIMPLE
+}
index 6b5f9b1847f9b494d04d5a19b999a7d0c398a08e..19b84d4b013d533ff2ad3c478f59eafad6981025 100644 (file)
 
 #include "vtls/x509asn1.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
+static CURLcode test_unit1651(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
 
-}
 #if defined(USE_GNUTLS) || defined(USE_SCHANNEL)
 
-/* cert captured from gdb when connecting to curl.se on October 26
-   2018 */
-static unsigned char cert[] = {
+  /* cert captured from gdb when connecting to curl.se on October 26
+     2018 */
+  static unsigned char cert[] = {
   0x30, 0x82, 0x0F, 0x5B, 0x30, 0x82, 0x0E, 0x43, 0xA0, 0x03, 0x02, 0x01, 0x02,
   0x02, 0x0C, 0x08, 0x77, 0x99, 0x2C, 0x6B, 0x67, 0xE1, 0x18, 0xD6, 0x66, 0x66,
   0x9E, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01,
@@ -342,10 +337,8 @@ static unsigned char cert[] = {
   0x70, 0x77, 0x54, 0x57, 0x09, 0x03, 0x56, 0x4A, 0x33, 0x60, 0x00, 0x27, 0xFE,
   0xA7, 0xD7, 0xA9, 0xC4, 0xEC, 0x17, 0x17, 0x8D, 0x87, 0x70, 0x6B, 0x48, 0x88,
   0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB,
-};
+  };
 
-UNITTEST_START
-{
   CURLcode result;
   const char *beg = (const char *)&cert[0];
   const char *end = (const char *)&cert[sizeof(cert)];
@@ -378,15 +371,9 @@ UNITTEST_START
     curl_easy_cleanup(data);
   }
   curl_global_cleanup();
-}
-UNITTEST_STOP
-
 #else
+  puts("not tested since Curl_extract_certinfo() is not built in");
+#endif
 
-UNITTEST_START
-{
-  puts("not tested since Curl_extract_certinfo() is not built-in");
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
-
-#endif
index a4a6ecd6699c2a0d317ee7b1c90570824d2770cf..f846731884804de718c406c712e0aebe7f1470dc 100644 (file)
  * updated to still be valid.
  */
 
-static struct Curl_easy *t1652_easy;
-
 static char input[4096];
 static char output[4096];
 
-int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
-              void *userptr);
-
 /*
  * This debugf callback is simply dumping the string into the static buffer
  * for the unit test to inspect. Since we know that we're only dealing with
  * text we can afford the luxury of skipping the type check here.
  */
-int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
-              void *userptr)
+static int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
+                     void *userptr)
 {
   (void)handle;
   (void)type;
@@ -57,24 +52,24 @@ int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size,
   return 0;
 }
 
-static CURLcode unit_setup(void)
+static CURLcode t1652_setup(struct Curl_easy **easy)
 {
   CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
-  t1652_easy = curl_easy_init();
-  if(!t1652_easy) {
+  *easy = curl_easy_init();
+  if(!*easy) {
     curl_global_cleanup();
     return CURLE_OUT_OF_MEMORY;
   }
-  curl_easy_setopt(t1652_easy, CURLOPT_DEBUGFUNCTION, debugf_cb);
-  curl_easy_setopt(t1652_easy, CURLOPT_VERBOSE, 1L);
+  curl_easy_setopt(*easy, CURLOPT_DEBUGFUNCTION, debugf_cb);
+  curl_easy_setopt(*easy, CURLOPT_VERBOSE, 1L);
   return res;
 }
 
-static void unit_stop(void)
+static void t1652_stop(struct Curl_easy *easy)
 {
-  curl_easy_cleanup(t1652_easy);
+  curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
@@ -87,7 +82,11 @@ static int verify(const char *info, const char *two)
   return strncmp(info, two, nl - info);
 }
 
-UNITTEST_START
+static CURLcode test_unit1652(char *arg)
+{
+  struct Curl_easy *easy;
+
+  UNITTEST_BEGIN(t1652_setup(&easy))
 
 #if defined(CURL_GNUC_DIAG) && !defined(__clang__)
 #pragma GCC diagnostic push
@@ -100,18 +99,18 @@ UNITTEST_START
 
   /* Injecting a simple short string via a format */
   curl_msnprintf(input, sizeof(input), "Simple Test");
-  Curl_infof(t1652_easy, "%s", input);
+  Curl_infof(easy, "%s", input);
   fail_unless(verify(output, input) == 0, "Simple string test");
 
   /* Injecting a few different variables with a format */
-  Curl_infof(t1652_easy, "%s %u testing %lu", input, 42, 43L);
+  Curl_infof(easy, "%s %u testing %lu", input, 42, 43L);
   fail_unless(verify(output, "Simple Test 42 testing 43\n") == 0,
               "Format string");
 
   /* Variations of empty strings */
-  Curl_infof(t1652_easy, "");
+  Curl_infof(easy, "");
   fail_unless(strlen(output) == 1, "Empty string");
-  Curl_infof(t1652_easy, "%s", (char *)NULL);
+  Curl_infof(easy, "%s", (char *)NULL);
   fail_unless(verify(output, "(nil)") == 0, "Passing NULL as string");
 
   /* Note: libcurl's tracebuffer hold 2048 bytes, so the max strlen() we
@@ -124,7 +123,7 @@ UNITTEST_START
   /* A string just long enough to not be truncated */
   memset(input, '\0', sizeof(input));
   memset(input, 'A', 2045);
-  Curl_infof(t1652_easy, "%s", input);
+  Curl_infof(easy, "%s", input);
   fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
   /* output is input + \n */
   fail_unless(strlen(output) == 2046, "No truncation of infof input");
@@ -134,7 +133,7 @@ UNITTEST_START
 
   /* Just over the limit without newline for truncation via '...' */
   memset(input + 2045, 'A', 4);
-  Curl_infof(t1652_easy, "%s", input);
+  Curl_infof(easy, "%s", input);
   fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
   fail_unless(strlen(output) == 2047, "Truncation of infof input 1");
   fail_unless(output[sizeof(output) - 1] == '\0',
@@ -143,7 +142,7 @@ UNITTEST_START
   /* Just over the limit with newline for truncation via '...' */
   memset(input + 2045, 'A', 4);
   memset(input + 2045 + 4, '\n', 1);
-  Curl_infof(t1652_easy, "%s", input);
+  Curl_infof(easy, "%s", input);
   fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
   fail_unless(strlen(output) == 2047, "Truncation of infof input 2");
   fail_unless(output[sizeof(output) - 1] == '\0',
@@ -152,7 +151,7 @@ UNITTEST_START
   /* Way over the limit for truncation via '...' */
   memset(input, '\0', sizeof(input));
   memset(input, 'A', sizeof(input) - 1);
-  Curl_infof(t1652_easy, "%s", input);
+  Curl_infof(easy, "%s", input);
   fprintf(stderr, "output len %d: %s", (int)strlen(output), output);
   fail_unless(strlen(output) == 2047, "Truncation of infof input 3");
   fail_unless(output[sizeof(output) - 1] == '\0',
@@ -162,4 +161,5 @@ UNITTEST_START
 #pragma GCC diagnostic pop
 #endif
 
-UNITTEST_STOP
+  UNITTEST_END(t1652_stop(easy))
+}
index 76958450eabef3a4dc22b9d9012aca429aa20199..7b725f36ef06392afda61b7942253a0d5fdf930d 100644 (file)
 #include "curl/urlapi.h"
 #include "urlapi-int.h"
 
-
-static CURLU *u;
-
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-}
-
 #define free_and_clear(x) free(x); x = NULL
 
-static CURLUcode parse_port(CURLU *url,
-                           char *h, bool has_scheme)
+static CURLUcode parse_port(CURLU *url, char *h, bool has_scheme)
 {
   struct dynbuf host;
   CURLUcode ret;
@@ -55,8 +41,12 @@ static CURLUcode parse_port(CURLU *url,
   return ret;
 }
 
-UNITTEST_START
+static CURLcode test_unit1653(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
+
+  CURLU *u;
+
   CURLUcode ret;
   char *ipv6port = NULL;
   char *portnum;
@@ -226,5 +216,5 @@ fail:
   free(ipv6port);
   curl_url_cleanup(u);
 
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
index 7515df305e73006cd250433947107895665af5c9..071fcbf9a17a355f03a9eab40a398a974d7f686b 100644 (file)
 #include "urldata.h"
 #include "altsvc.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1654(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-}
+  UNITTEST_BEGIN_SIMPLE
 
-UNITTEST_START
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
-{
   char outname[256];
   CURL *curl;
   CURLcode result;
@@ -132,6 +124,7 @@ UNITTEST_START
   curl_easy_cleanup(curl);
 fail:
   Curl_altsvc_cleanup(&asi);
-}
 #endif
-UNITTEST_STOP
+
+  UNITTEST_END(curl_global_cleanup())
+}
index 384fc120e6e736a37787434614998b5ac9bca49d..3671b5615060bd28500c3c8dee599be80c7bb1d2 100644 (file)
 
 #include "doh.h" /* from the lib dir */
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1655(char *arg)
 {
-  /* whatever you want done first */
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-    /* done before shutting down and exiting */
-}
+  UNITTEST_BEGIN_SIMPLE
 
 #ifndef CURL_DISABLE_DOH
-
-UNITTEST_START
-
-/*
- * Prove detection of write overflow using a short buffer and a name
- * of maximal valid length.
- *
- * Prove detection of other invalid input.
- */
-do {
-  static const char max[] =
-    /* ..|....1.........2.........3.........4.........5.........6... */
-    /* 3456789012345678901234567890123456789012345678901234567890123 */
-    "this.is.a.maximum-length.hostname."                  /* 34:  34 */
-    "with-no-label-of-greater-length-than-the-sixty-three-characters."
-                                                          /* 64:  98 */
-    "specified.in.the.RFCs."                              /* 22: 120 */
-    "and.with.a.QNAME.encoding.whose.length.is.exactly."  /* 50: 170 */
-    "the.maximum.length.allowed."                         /* 27: 197 */
-    "that.is.two-hundred.and.fifty-six."                  /* 34: 231 */
-    "including.the.last.null."                            /* 24: 255 */
-    "";
-  static const char toolong[] =
-    /* ..|....1.........2.........3.........4.........5.........6... */
-    /* 3456789012345678901234567890123456789012345678901234567890123 */
-    "here.is.a.hostname.which.is.just.barely.too.long."   /* 49:  49 */
-    "to.be.encoded.as.a.QNAME.of.the.maximum.allowed.length."
-                                                          /* 55: 104 */
-    "which.is.256.including.a.final.zero-length.label."   /* 49: 153 */
-    "representing.the.root.node.so.that.a.name.with."     /* 47: 200 */
-    "a.trailing.dot.may.have.up.to."                      /* 30: 230 */
-    "255.characters.never.more."                          /* 26: 256 */
-    "";
-  static const char emptylabel[] =
-    "this.is.an.otherwise-valid.hostname."
-    ".with.an.empty.label.";
-  static const char outsizelabel[] =
-    "this.is.an.otherwise-valid.hostname."
-    "with-a-label-of-greater-length-than-the-sixty-three-characters-"
-    "specified.in.the.RFCs.";
-  int i;
-
-  struct test {
-    const char *name;
-    const DOHcode expected_result;
-  };
-
-  /* plays the role of struct dnsprobe in urldata.h */
-  struct demo {
-    unsigned char dohbuffer[255 + 16]; /* deliberately short buffer */
-    unsigned char canary1;
-    unsigned char canary2;
-    unsigned char canary3;
-  };
-
-  const struct test playlist[4] = {
-    { toolong, DOH_DNS_NAME_TOO_LONG },  /* expect early failure */
-    { emptylabel, DOH_DNS_BAD_LABEL },   /* also */
-    { outsizelabel, DOH_DNS_BAD_LABEL }, /* also */
-    { max, DOH_OK }                      /* expect buffer overwrite */
-  };
-
-  for(i = 0; i < (int)(CURL_ARRAYSIZE(playlist)); i++) {
-    const char *name = playlist[i].name;
-    size_t olen = 100000;
-    struct demo victim;
-    DOHcode d;
-
-    victim.canary1 = 87; /* magic numbers, arbitrarily picked */
-    victim.canary2 = 35;
-    victim.canary3 = 41;
-    d = doh_req_encode(name, DNS_TYPE_A, victim.dohbuffer,
-                       sizeof(struct demo), /* allow room for overflow */
-                       &olen);
-
-    fail_unless(d == playlist[i].expected_result,
-                "result returned was not as expected");
-    if(d == playlist[i].expected_result) {
-      if(name == max) {
-        fail_if(victim.canary1 == 87,
-                "demo one-byte buffer overwrite did not happen");
+  /*
+   * Prove detection of write overflow using a short buffer and a name
+   * of maximal valid length.
+   *
+   * Prove detection of other invalid input.
+   */
+  do {
+    static const char max[] =
+      /* ..|....1.........2.........3.........4.........5.........6... */
+      /* 3456789012345678901234567890123456789012345678901234567890123 */
+      "this.is.a.maximum-length.hostname."                  /* 34:  34 */
+      "with-no-label-of-greater-length-than-the-sixty-three-characters."
+                                                            /* 64:  98 */
+      "specified.in.the.RFCs."                              /* 22: 120 */
+      "and.with.a.QNAME.encoding.whose.length.is.exactly."  /* 50: 170 */
+      "the.maximum.length.allowed."                         /* 27: 197 */
+      "that.is.two-hundred.and.fifty-six."                  /* 34: 231 */
+      "including.the.last.null."                            /* 24: 255 */
+      "";
+    static const char toolong[] =
+      /* ..|....1.........2.........3.........4.........5.........6... */
+      /* 3456789012345678901234567890123456789012345678901234567890123 */
+      "here.is.a.hostname.which.is.just.barely.too.long."   /* 49:  49 */
+      "to.be.encoded.as.a.QNAME.of.the.maximum.allowed.length."
+                                                            /* 55: 104 */
+      "which.is.256.including.a.final.zero-length.label."   /* 49: 153 */
+      "representing.the.root.node.so.that.a.name.with."     /* 47: 200 */
+      "a.trailing.dot.may.have.up.to."                      /* 30: 230 */
+      "255.characters.never.more."                          /* 26: 256 */
+      "";
+    static const char emptylabel[] =
+      "this.is.an.otherwise-valid.hostname."
+      ".with.an.empty.label.";
+    static const char outsizelabel[] =
+      "this.is.an.otherwise-valid.hostname."
+      "with-a-label-of-greater-length-than-the-sixty-three-characters-"
+      "specified.in.the.RFCs.";
+    int i;
+
+    struct test {
+      const char *name;
+      const DOHcode expected_result;
+    };
+
+    /* plays the role of struct dnsprobe in urldata.h */
+    struct demo {
+      unsigned char dohbuffer[255 + 16]; /* deliberately short buffer */
+      unsigned char canary1;
+      unsigned char canary2;
+      unsigned char canary3;
+    };
+
+    const struct test playlist[4] = {
+      { toolong, DOH_DNS_NAME_TOO_LONG },  /* expect early failure */
+      { emptylabel, DOH_DNS_BAD_LABEL },   /* also */
+      { outsizelabel, DOH_DNS_BAD_LABEL }, /* also */
+      { max, DOH_OK }                      /* expect buffer overwrite */
+    };
+
+    for(i = 0; i < (int)(CURL_ARRAYSIZE(playlist)); i++) {
+      const char *name = playlist[i].name;
+      size_t olen = 100000;
+      struct demo victim;
+      DOHcode d;
+
+      victim.canary1 = 87; /* magic numbers, arbitrarily picked */
+      victim.canary2 = 35;
+      victim.canary3 = 41;
+      d = doh_req_encode(name, DNS_TYPE_A, victim.dohbuffer,
+                         sizeof(struct demo), /* allow room for overflow */
+                         &olen);
+
+      fail_unless(d == playlist[i].expected_result,
+                  "result returned was not as expected");
+      if(d == playlist[i].expected_result) {
+        if(name == max) {
+          fail_if(victim.canary1 == 87,
+                  "demo one-byte buffer overwrite did not happen");
+        }
+        else {
+          fail_unless(victim.canary1 == 87,
+                      "one-byte buffer overwrite has happened");
+        }
+        fail_unless(victim.canary2 == 35,
+                    "two-byte buffer overwrite has happened");
+        fail_unless(victim.canary3 == 41,
+                    "three-byte buffer overwrite has happened");
       }
       else {
-        fail_unless(victim.canary1 == 87,
-                    "one-byte buffer overwrite has happened");
+        if(d == DOH_OK) {
+          fail_unless(olen <= sizeof(victim.dohbuffer),
+            "wrote outside bounds");
+          fail_unless(olen > strlen(name), "unrealistic low size");
+        }
       }
-      fail_unless(victim.canary2 == 35,
-                  "two-byte buffer overwrite has happened");
-      fail_unless(victim.canary3 == 41,
-                  "three-byte buffer overwrite has happened");
     }
-    else {
-      if(d == DOH_OK) {
-        fail_unless(olen <= sizeof(victim.dohbuffer), "wrote outside bounds");
-        fail_unless(olen > strlen(name), "unrealistic low size");
-      }
-    }
-  }
-} while(0);
-
-/* run normal cases and try to trigger buffer length related errors */
-do {
-  DNStype dnstype = DNS_TYPE_A;
-  unsigned char buffer[128];
-  const size_t buflen = sizeof(buffer);
-  const size_t magic1 = 9765;
-  size_t olen1 = magic1;
-  const char *sunshine1 = "a.com";
-  const char *dotshine1 = "a.com.";
-  const char *sunshine2 = "aa.com";
-  size_t olen2;
-  DOHcode ret2;
-  size_t olen;
-
-  DOHcode ret = doh_req_encode(sunshine1, dnstype, buffer, buflen, &olen1);
-  fail_unless(ret == DOH_OK, "sunshine case 1 should pass fine");
-  fail_if(olen1 == magic1, "olen has not been assigned properly");
-  fail_unless(olen1 > strlen(sunshine1), "bad out length");
-
-  /* with a trailing dot, the response should have the same length */
-  olen2 = magic1;
-  ret2 = doh_req_encode(dotshine1, dnstype, buffer, buflen, &olen2);
-  fail_unless(ret2 == DOH_OK, "dotshine case should pass fine");
-  fail_if(olen2 == magic1, "olen has not been assigned properly");
-  fail_unless(olen1 == olen2, "olen should not grow for a trailing dot");
-
-  /* add one letter, the response should be one longer */
-  olen2 = magic1;
-  ret2 = doh_req_encode(sunshine2, dnstype, buffer, buflen, &olen2);
-  fail_unless(ret2 == DOH_OK, "sunshine case 2 should pass fine");
-  fail_if(olen2 == magic1, "olen has not been assigned properly");
-  fail_unless(olen1 + 1 == olen2, "olen should grow with the hostname");
-
-  /* pass a short buffer, should fail */
-  ret = doh_req_encode(sunshine1, dnstype, buffer, olen1 - 1, &olen);
-  fail_if(ret == DOH_OK, "short buffer should have been noticed");
-
-  /* pass a minimum buffer, should succeed */
-  ret = doh_req_encode(sunshine1, dnstype, buffer, olen1, &olen);
-  fail_unless(ret == DOH_OK, "minimal length buffer should be long enough");
-  fail_unless(olen == olen1, "bad buffer length");
-} while(0);
-UNITTEST_STOP
-
-#else /* CURL_DISABLE_DOH */
-
-UNITTEST_START
-/* nothing to do, just succeed */
-UNITTEST_STOP
-
-#endif
+  } while(0);
+
+  /* run normal cases and try to trigger buffer length related errors */
+  do {
+    DNStype dnstype = DNS_TYPE_A;
+    unsigned char buffer[128];
+    const size_t buflen = sizeof(buffer);
+    const size_t magic1 = 9765;
+    size_t olen1 = magic1;
+    const char *sunshine1 = "a.com";
+    const char *dotshine1 = "a.com.";
+    const char *sunshine2 = "aa.com";
+    size_t olen2;
+    DOHcode ret2;
+    size_t olen;
+
+    DOHcode ret = doh_req_encode(sunshine1, dnstype, buffer, buflen, &olen1);
+    fail_unless(ret == DOH_OK, "sunshine case 1 should pass fine");
+    fail_if(olen1 == magic1, "olen has not been assigned properly");
+    fail_unless(olen1 > strlen(sunshine1), "bad out length");
+
+    /* with a trailing dot, the response should have the same length */
+    olen2 = magic1;
+    ret2 = doh_req_encode(dotshine1, dnstype, buffer, buflen, &olen2);
+    fail_unless(ret2 == DOH_OK, "dotshine case should pass fine");
+    fail_if(olen2 == magic1, "olen has not been assigned properly");
+    fail_unless(olen1 == olen2, "olen should not grow for a trailing dot");
+
+    /* add one letter, the response should be one longer */
+    olen2 = magic1;
+    ret2 = doh_req_encode(sunshine2, dnstype, buffer, buflen, &olen2);
+    fail_unless(ret2 == DOH_OK, "sunshine case 2 should pass fine");
+    fail_if(olen2 == magic1, "olen has not been assigned properly");
+    fail_unless(olen1 + 1 == olen2, "olen should grow with the hostname");
+
+    /* pass a short buffer, should fail */
+    ret = doh_req_encode(sunshine1, dnstype, buffer, olen1 - 1, &olen);
+    fail_if(ret == DOH_OK, "short buffer should have been noticed");
+
+    /* pass a minimum buffer, should succeed */
+    ret = doh_req_encode(sunshine1, dnstype, buffer, olen1, &olen);
+    fail_unless(ret == DOH_OK, "minimal length buffer should be long enough");
+    fail_unless(olen == olen1, "bad buffer length");
+  } while(0);
+
+#endif /* CURL_DISABLE_DOH */
+
+  UNITTEST_END_SIMPLE
+}
index 1ab62524384dabef5a64615d617e065069a70451..98e9e57e808f3692ad7fc17599d03a55f99abf66 100644 (file)
 
 #include "vtls/x509asn1.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
 #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
 
 struct test_spec {
@@ -43,7 +33,34 @@ struct test_spec {
   CURLcode exp_result;
 };
 
-static struct test_spec test_specs[] = {
+static bool do_test(const struct test_spec *spec, size_t i,
+                    struct dynbuf *dbuf)
+{
+  CURLcode result;
+  const char *in = spec->input;
+
+  curlx_dyn_reset(dbuf);
+  result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
+  if(result != spec->exp_result) {
+    curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
+                  i, spec->exp_result, result);
+    return FALSE;
+  }
+  else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
+    curl_mfprintf(stderr,
+                  "test %zu: input '%s', expected output '%s', got '%s'\n",
+                  i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+static CURLcode test_unit1656(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+
+  static const struct test_spec test_specs[] = {
   { "190321134340", "1903-21-13 43:40:00", CURLE_OK },
   { "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
   { "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
@@ -70,32 +87,8 @@ static struct test_spec test_specs[] = {
   { "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
   { "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
   { "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10", CURLE_OK },
-};
-
-static bool do_test(struct test_spec *spec, size_t i, struct dynbuf *dbuf)
-{
-  CURLcode result;
-  const char *in = spec->input;
+  };
 
-  curlx_dyn_reset(dbuf);
-  result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
-  if(result != spec->exp_result) {
-    curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
-                  i, spec->exp_result, result);
-    return FALSE;
-  }
-  else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
-    curl_mfprintf(stderr,
-                  "test %zu: input '%s', expected output '%s', got '%s'\n",
-                  i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-UNITTEST_START
-{
   size_t i;
   struct dynbuf dbuf;
   bool all_ok = TRUE;
@@ -115,15 +108,17 @@ UNITTEST_START
 
   curlx_dyn_free(&dbuf);
   curl_global_cleanup();
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
 
 #else
 
-UNITTEST_START
+static CURLcode test_unit1656(char *arg)
 {
-  puts("not tested since Curl_x509_GTime2str() is not built-in");
+  UNITTEST_BEGIN_SIMPLE
+  puts("not tested since Curl_x509_GTime2str() is not built in");
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
 
 #endif
index 8a9dea788e49544ef32a945cfda4bdb58f4b0288..b5fb5398d419dfdc47cdcd7cd7f99251d3cace6d 100644 (file)
 
 #include "vtls/x509asn1.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-
-}
-
 #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS)
 
 struct test1657_spec {
-  CURLcode (*setbuf)(struct test1657_spec *spec, struct dynbuf *buf);
+  CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
   size_t n;
   CURLcode exp_result;
 };
 
-static CURLcode make1657_nested(struct test1657_spec *spec, struct dynbuf *buf)
+static CURLcode make1657_nested(const struct test1657_spec *spec,
+                                struct dynbuf *buf)
 {
   CURLcode r;
   size_t i;
-  unsigned char open_undef[] = { 0x32,  0x80 };
-  unsigned char close_undef[] = { 0x00,  0x00 };
+  unsigned char open_undef[] = { 0x32, 0x80 };
+  unsigned char close_undef[] = { 0x00, 0x00 };
 
   for(i = 0; i < spec->n; ++i) {
     r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
@@ -63,14 +54,14 @@ static CURLcode make1657_nested(struct test1657_spec *spec, struct dynbuf *buf)
   return CURLE_OK;
 }
 
-static struct test1657_spec test1657_specs[] = {
+static const struct test1657_spec test1657_specs[] = {
   { make1657_nested, 3, CURLE_OK },
   { make1657_nested, 16, CURLE_OK },
   { make1657_nested, 17, CURLE_BAD_FUNCTION_ARGUMENT },
   { make1657_nested, 1024, CURLE_BAD_FUNCTION_ARGUMENT },
 };
 
-static bool do_test1657(struct test1657_spec *spec, size_t i,
+static bool do_test1657(const struct test1657_spec *spec, size_t i,
                         struct dynbuf *buf)
 {
   CURLcode result;
@@ -94,8 +85,10 @@ static bool do_test1657(struct test1657_spec *spec, size_t i,
   return TRUE;
 }
 
-UNITTEST_START
+static CURLcode test_unit1657(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
+
   size_t i;
   bool all_ok = TRUE;
   struct dynbuf dbuf;
@@ -115,15 +108,17 @@ UNITTEST_START
 
   curlx_dyn_free(&dbuf);
   curl_global_cleanup();
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
 
 #else
 
-UNITTEST_START
+static CURLcode test_unit1657(char *arg)
 {
-  puts("not tested since Curl_x509_getASN1Element() is not built-in");
+  UNITTEST_BEGIN_SIMPLE
+  puts("not tested since Curl_x509_getASN1Element() is not built in");
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
 
 #endif
index 8816fb0614088b7c547920f1414853af2781e6fa..b572fbec3c24b5a3b6b281fc1f62c3b1be866650 100644 (file)
 
 #include "doh.h" /* from the lib dir */
 
-static CURLcode unit_setup(void)
+/* DoH + HTTPSRR are required */
+#if !defined(CURL_DISABLE_DOH) && defined(USE_HTTPSRR)
+
+static CURLcode t1658_setup(void)
 {
   /* whatever you want done first */
   curl_global_init(CURL_GLOBAL_ALL);
   return CURLE_OK;
 }
 
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-  /* done before shutting down and exiting */
-}
-
-/* DoH + HTTPSRR are required */
-#if !defined(CURL_DISABLE_DOH) && defined(USE_HTTPSRR)
-
 extern CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data,
                                         const unsigned char *cp, size_t len,
                                         struct Curl_https_rrinfo **hrr);
 extern void doh_print_httpsrr(struct Curl_easy *data,
                               struct Curl_https_rrinfo *hrr);
 
-struct test {
-  const char *name;
-  const unsigned char *dns;
-  size_t len; /* size of the dns packet */
-  const char *expect;
-};
-
 /*
  * The idea here is that we pass one DNS packet at the time to the decoder. we
  * then generate a string output with the results and compare if it matches
@@ -127,12 +114,21 @@ static void rrresults(struct Curl_https_rrinfo *rr, CURLcode result)
   }
 }
 
-UNITTEST_START
+static CURLcode test_unit1658(char *arg)
 {
+  UNITTEST_BEGIN(t1658_setup())
+
   /* The "SvcParamKeys" specified within the HTTPS RR packet *must* be
      provided in numerical order. */
 
-  static struct test t[] = {
+  struct test {
+    const char *name;
+    const unsigned char *dns;
+    size_t len; /* size of the dns packet */
+    const char *expect;
+  };
+
+  static const struct test t[] = {
     {
       "single h2 alpn",
       (const unsigned char *)"\x00\x00" /* 16-bit prio */
@@ -541,13 +537,16 @@ UNITTEST_START
     }
     curl_easy_cleanup(easy);
   }
+
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
 
 #else /* CURL_DISABLE_DOH or not HTTPSRR enabled */
 
-UNITTEST_START
-/* nothing to do, just succeed */
-UNITTEST_STOP
+static CURLcode test_unit1658(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+  UNITTEST_END_SIMPLE
+}
 
 #endif
index 4e24d01a800c5939fbc8467d75b09f1cec8d270e..c47073a18f9d79ae4e42bf22702fd0d453f614e5 100644 (file)
 #include "urldata.h"
 #include "hsts.h"
 
-static CURLcode unit_setup(void)
+#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS)
+static CURLcode test_unit1660(char *arg)
 {
-  return CURLE_OK;
+  UNITTEST_BEGIN_SIMPLE
+  puts("nothing to do when HTTP or HSTS are disabled");
+  UNITTEST_END_SIMPLE
 }
+#else
 
-static void unit_stop(void)
+static void showsts(struct stsentry *e, const char *chost)
 {
-  curl_global_cleanup();
+  if(!e)
+    printf("'%s' is not HSTS\n", chost);
+  else {
+    curl_mprintf("%s [%s]: %" CURL_FORMAT_CURL_OFF_T "%s\n",
+                 chost, e->host, e->expires,
+                 e->includeSubDomains ? " includeSubDomains" : "");
+  }
 }
 
-#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS)
-UNITTEST_START
+static CURLcode test_unit1660(char *arg)
 {
-  puts("nothing to do when HTTP or HSTS are disabled");
-}
-UNITTEST_STOP
-#else
+  UNITTEST_BEGIN_SIMPLE
 
-struct testit {
-  const char *host;
-  const char *chost; /* if non-NULL, use to lookup with */
-  const char *hdr; /* if NULL, just do the lookup */
-  const CURLcode result; /* parse result */
-};
+  struct testit {
+    const char *host;
+    const char *chost; /* if non-NULL, use to lookup with */
+    const char *hdr; /* if NULL, just do the lookup */
+    const CURLcode result; /* parse result */
+  };
 
-static const struct testit headers[] = {
+  static const struct testit headers[] = {
   /* two entries read from disk cache, verify first */
   { "-", "readfrom.example", NULL, CURLE_OK},
   { "-", "old.example", NULL, CURLE_OK},
@@ -102,21 +108,8 @@ static const struct testit headers[] = {
   /* make this live for 7 seconds */
   { "expire.example", NULL, "max-age=\"7\"\r\n", CURLE_OK },
   { NULL, NULL, NULL, CURLE_OK }
-};
-
-static void showsts(struct stsentry *e, const char *chost)
-{
-  if(!e)
-    printf("'%s' is not HSTS\n", chost);
-  else {
-    curl_mprintf("%s [%s]: %" CURL_FORMAT_CURL_OFF_T "%s\n",
-                 chost, e->host, e->expires,
-                 e->includeSubDomains ? " includeSubDomains" : "");
-  }
-}
+  };
 
-UNITTEST_START
-{
   CURLcode result;
   struct stsentry *e;
   struct hsts *h = Curl_hsts_init();
@@ -173,6 +166,7 @@ UNITTEST_START
   Curl_hsts_cleanup(&h);
   curl_easy_cleanup(easy);
   curl_global_cleanup();
+
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
 #endif
index 3d4eead93f4d2dada5e75841193ba6c9d5e3f2bd..494f0b9e0919f2f8036f0d7ed567931361f1174c 100644 (file)
@@ -25,8 +25,6 @@
 #include "bufref.h"
 #include "memdebug.h"
 
-static struct bufref bufref;
-
 static int freecount = 0;
 
 static void test_free(void *p)
@@ -36,19 +34,23 @@ static void test_free(void *p)
   free(p);
 }
 
-static CURLcode unit_setup(void)
+static CURLcode t1661_setup(struct bufref *bufref)
 {
-  Curl_bufref_init(&bufref);
+  Curl_bufref_init(bufref);
   return CURLE_OK;
 }
 
-static void unit_stop(void)
+static void t1661_stop(struct bufref *bufref)
 {
-  Curl_bufref_free(&bufref);
+  Curl_bufref_free(bufref);
 }
 
-UNITTEST_START
+static CURLcode test_unit1661(char *arg)
 {
+  struct bufref bufref;
+
+  UNITTEST_BEGIN(t1661_setup(&bufref))
+
   const char *buffer = NULL;
   CURLcode result = CURLE_OK;
 
@@ -59,7 +61,6 @@ UNITTEST_START
    * 2: reference will be NULL
    * 3: destructor will be NULL
    */
-
   fail_unless(!bufref.ptr, "Initial reference must be NULL");
   fail_unless(!bufref.len, "Initial length must be NULL");
   fail_unless(!bufref.dtor, "Destructor must be NULL");
@@ -67,7 +68,6 @@ UNITTEST_START
   /**
    * testing Curl_bufref_set
    */
-
   buffer = malloc(13);
   abort_unless(buffer, "Out of memory");
   Curl_bufref_set(&bufref, buffer, 13, test_free);
@@ -79,20 +79,17 @@ UNITTEST_START
   /**
    * testing Curl_bufref_ptr
    */
-
   fail_unless((const char *) Curl_bufref_ptr(&bufref) == buffer,
               "Wrong pointer value returned");
 
   /**
    * testing Curl_bufref_len
    */
-
   fail_unless(Curl_bufref_len(&bufref) == 13, "Wrong data size returned");
 
   /**
    * testing Curl_bufref_memdup
    */
-
   result = Curl_bufref_memdup(&bufref, "1661", 3);
   abort_unless(result == CURLE_OK, curl_easy_strerror(result));
   fail_unless(freecount == 1, "Destructor not called");
@@ -108,11 +105,11 @@ UNITTEST_START
   /**
    * testing Curl_bufref_free
    */
-
   Curl_bufref_free(&bufref);
   fail_unless(freecount == 1, "Wrong destructor called");
   fail_unless(!bufref.ptr, "Initial reference must be NULL");
   fail_unless(!bufref.len, "Initial length must be NULL");
   fail_unless(!bufref.dtor, "Destructor must be NULL");
+
+  UNITTEST_END(t1661_stop(&bufref))
 }
-UNITTEST_STOP
index bed8c77a8ff945626df40f05f35c63c997ad5f0b..52cbd7da22e1aa9d0c4dc0290731ab3b11efb99f 100644 (file)
 #include <netinet/in6.h>
 #endif
 
-#include <curl/curl.h>
-
 #include "cf-socket.h"
 
 #include "memdebug.h" /* LAST include file */
 
-static CURLcode unit_setup(void)
+static CURLcode t1663_setup(void)
 {
   CURLcode res = CURLE_OK;
   global_init(CURL_GLOBAL_ALL);
   return res;
 }
 
-static void unit_stop(void)
-{
-  curl_global_cleanup();
-}
-
 static void t1663_parse(
   const char *input_data,
   const char *exp_dev,
@@ -79,8 +72,10 @@ static void t1663_parse(
   free(host);
 }
 
-UNITTEST_START
+static CURLcode test_unit1663(char *arg)
 {
+  UNITTEST_BEGIN(t1663_setup())
+
   t1663_parse("dev", "dev", NULL, NULL, CURLE_OK);
   t1663_parse("if!eth0", NULL, "eth0", NULL, CURLE_OK);
   t1663_parse("host!myname", NULL, NULL, "myname", CURLE_OK);
@@ -93,5 +88,6 @@ UNITTEST_START
   t1663_parse("ifhost!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
   t1663_parse("ifhost!eth0", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
   t1663_parse("ifhost!eth0!", NULL, NULL, NULL, CURLE_BAD_FUNCTION_ARGUMENT);
+
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
index 528f73708f72aca6bb23c6fa714d801b00552f3a..b4e7e383f056cdf00a59b361c7ba2758dbd3fb79 100644 (file)
 #include <netinet/in6.h>
 #endif
 
-#include <curl/curl.h>
-
 #include "curlx/strparse.h"
 
 #include "memdebug.h" /* LAST include file */
 
-static CURLcode unit_setup(void)
+static CURLcode t1664_setup(void)
 {
   CURLcode res = CURLE_OK;
   global_init(CURL_GLOBAL_ALL);
   return res;
 }
 
-static void unit_stop(void)
+static CURLcode test_unit1664(char *arg)
 {
-  curl_global_cleanup();
-}
+  UNITTEST_BEGIN(t1664_setup())
 
-UNITTEST_START
-{
   static const char *wordparse[] = {
     "word",
     "word ",
@@ -487,5 +482,5 @@ UNITTEST_START
     }
   }
 
+  UNITTEST_END(curl_global_cleanup())
 }
-UNITTEST_STOP
index 89af6c66054df91590b38c73e675fcaa86205f21..c1a53560c5bd029a992bbe0ce5e6a511b4448e29 100644 (file)
 #include "http_aws_sigv4.h"
 #include "dynbuf.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1979(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+  UNITTEST_BEGIN_SIMPLE
 
-UNITTEST_START
-{
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS)
   struct testcase {
     const char *testname;
@@ -140,5 +133,6 @@ UNITTEST_START
     curlx_dyn_free(&canonical_path);
   }
 #endif /* !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS) */
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
index dcc415dca5124bb064b1dcc7fba8dd413b76ffe0..5cb81e99c1638a599ec707f11bd30e1195815a46 100644 (file)
 #include "http_aws_sigv4.h"
 #include "dynbuf.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit1980(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+  UNITTEST_BEGIN_SIMPLE
 
-UNITTEST_START
-{
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS)
   struct testcase {
     const char *testname;
@@ -111,5 +104,6 @@ UNITTEST_START
     curlx_dyn_free(&canonical_query);
   }
 #endif /* !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_AWS) */
+
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_STOP
index 6aa922160f616c21aaf42ff392d7f4aa1b796fd7..09af1690290a2725c5b34f373167ab9f189865ed 100644 (file)
 #include "curl_trc.h"
 #include "memdebug.h"
 
-static CURL *t2600_easy;
-
-static CURLcode unit_setup(void)
+static CURLcode t2600_setup(CURL **easy)
 {
   CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
-  t2600_easy = curl_easy_init();
-  if(!t2600_easy) {
+  *easy = curl_easy_init();
+  if(!*easy) {
     curl_global_cleanup();
     return CURLE_OUT_OF_MEMORY;
   }
   curl_global_trace("all");
-  curl_easy_setopt(t2600_easy, CURLOPT_VERBOSE, 1L);
+  curl_easy_setopt(*easy, CURLOPT_VERBOSE, 1L);
   return res;
 }
 
-static void unit_stop(void)
+static void t2600_stop(CURL *easy)
 {
-  curl_easy_cleanup(t2600_easy);
+  curl_easy_cleanup(easy);
   curl_global_cleanup();
 }
 
@@ -104,7 +102,7 @@ struct test_result {
   struct ai_family_stats cf6;
 };
 
-static struct test_case *current_tc;
+static const struct test_case *current_tc;
 static struct test_result *current_tr;
 
 struct cf_test_ctx {
@@ -161,31 +159,31 @@ static void cf_test_adjust_pollset(struct Curl_cfilter *cf,
   Curl_pollset_set(data, ps, 1, TRUE, TRUE);
 }
 
-static struct Curl_cftype cft_test = {
-  "TEST",
-  CF_TYPE_IP_CONNECT,
-  CURL_LOG_LVL_NONE,
-  cf_test_destroy,
-  cf_test_connect,
-  Curl_cf_def_close,
-  Curl_cf_def_shutdown,
-  Curl_cf_def_get_host,
-  cf_test_adjust_pollset,
-  Curl_cf_def_data_pending,
-  Curl_cf_def_send,
-  Curl_cf_def_recv,
-  Curl_cf_def_cntrl,
-  Curl_cf_def_conn_is_alive,
-  Curl_cf_def_conn_keep_alive,
-  Curl_cf_def_query,
-};
-
 static CURLcode cf_test_create(struct Curl_cfilter **pcf,
                                struct Curl_easy *data,
                                struct connectdata *conn,
                                const struct Curl_addrinfo *ai,
                                int transport)
 {
+  static const struct Curl_cftype cft_test = {
+    "TEST",
+    CF_TYPE_IP_CONNECT,
+    CURL_LOG_LVL_NONE,
+    cf_test_destroy,
+    cf_test_connect,
+    Curl_cf_def_close,
+    Curl_cf_def_shutdown,
+    Curl_cf_def_get_host,
+    cf_test_adjust_pollset,
+    Curl_cf_def_data_pending,
+    Curl_cf_def_send,
+    Curl_cf_def_recv,
+    Curl_cf_def_cntrl,
+    Curl_cf_def_conn_is_alive,
+    Curl_cf_def_conn_keep_alive,
+    Curl_cf_def_query,
+  };
+
   struct cf_test_ctx *ctx = NULL;
   struct Curl_cfilter *cf = NULL;
   timediff_t created_at;
@@ -238,7 +236,7 @@ out:
   return result;
 }
 
-static void check_result(struct test_case *tc,
+static void check_result(const struct test_case *tc,
                          struct test_result *tr)
 {
   char msg[256];
@@ -301,7 +299,7 @@ static void check_result(struct test_case *tc,
   }
 }
 
-static void test_connect(struct test_case *tc)
+static void test_connect(CURL *easy, const struct test_case *tc)
 {
   struct test_result tr;
   struct curl_slist *list = NULL;
@@ -312,23 +310,23 @@ static void test_connect(struct test_case *tc)
 
   list = curl_slist_append(NULL, tc->resolve_info);
   fail_unless(list, "error allocating resolve list entry");
-  curl_easy_setopt(t2600_easy, CURLOPT_RESOLVE, list);
-  curl_easy_setopt(t2600_easy, CURLOPT_IPRESOLVE, (long)tc->ip_version);
-  curl_easy_setopt(t2600_easy, CURLOPT_CONNECTTIMEOUT_MS,
+  curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
+  curl_easy_setopt(easy, CURLOPT_IPRESOLVE, (long)tc->ip_version);
+  curl_easy_setopt(easy, CURLOPT_CONNECTTIMEOUT_MS,
                    (long)tc->connect_timeout_ms);
-  curl_easy_setopt(t2600_easy, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
+  curl_easy_setopt(easy, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
                    (long)tc->he_timeout_ms);
 
-  curl_easy_setopt(t2600_easy, CURLOPT_URL, tc->url);
+  curl_easy_setopt(easy, CURLOPT_URL, tc->url);
   memset(&tr, 0, sizeof(tr));
   tr.cf6.family = "v6";
   tr.cf4.family = "v4";
 
   tr.started = curlx_now();
-  tr.result = curl_easy_perform(t2600_easy);
+  tr.result = curl_easy_perform(easy);
   tr.ended = curlx_now();
 
-  curl_easy_setopt(t2600_easy, CURLOPT_RESOLVE, NULL);
+  curl_easy_setopt(easy, CURLOPT_RESOLVE, NULL);
   curl_slist_free_all(list);
   list = NULL;
   current_tc = NULL;
@@ -355,46 +353,51 @@ static void test_connect(struct test_case *tc)
 #define TC_TMOT     90000  /* 90 sec max test duration */
 #define CNCT_TMOT   60000  /* 60sec connect timeout */
 
-static struct test_case TEST_CASES[] = {
-  /* TIMEOUT_MS,    FAIL_MS      CREATED    DURATION     Result, HE_PREF */
-  /* CNCT   HE      v4    v6     v4 v6      MIN   MAX */
-  { 1, TURL, "test.com:123:192.0.2.1", CURL_IPRESOLVE_WHATEVER,
-    CNCT_TMOT, 150, 200,  200,    1,  0,      200,  TC_TMOT,  R_FAIL, NULL },
-  /* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT   */
-  { 2, TURL, "test.com:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER,
-    CNCT_TMOT, 150, 200,  200,    2,  0,      400,  TC_TMOT,  R_FAIL, NULL },
-  /* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT   */
+static CURLcode test_unit2600(char *arg)
+{
+  CURL *easy;
+
+  UNITTEST_BEGIN(t2600_setup(&easy))
+
+  static const struct test_case TEST_CASES[] = {
+    /* TIMEOUT_MS,    FAIL_MS      CREATED    DURATION     Result, HE_PREF */
+    /* CNCT   HE      v4    v6     v4 v6      MIN   MAX */
+    { 1, TURL, "test.com:123:192.0.2.1", CURL_IPRESOLVE_WHATEVER,
+      CNCT_TMOT, 150, 200,  200,    1,  0,      200,  TC_TMOT,  R_FAIL, NULL },
+    /* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT   */
+    { 2, TURL, "test.com:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER,
+      CNCT_TMOT, 150, 200,  200,    2,  0,      400,  TC_TMOT,  R_FAIL, NULL },
+    /* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT   */
 #ifdef USE_IPV6
-  { 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
-    CNCT_TMOT, 150, 200,  200,    0,  1,      200,  TC_TMOT,  R_FAIL, NULL },
-  /* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT   */
-  { 4, TURL, "test.com:123:::1,::2", CURL_IPRESOLVE_WHATEVER,
-    CNCT_TMOT, 150, 200,  200,    0,  2,      400,  TC_TMOT,  R_FAIL, NULL },
-  /* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT   */
-
-  { 5, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_WHATEVER,
-    CNCT_TMOT, 150, 200, 200,     1,  1,      350,  TC_TMOT,  R_FAIL, "v6" },
-  /* mixed ip4+6, v6 always first, v4 kicks in on HE, fails after ~350ms */
-  { 6, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_WHATEVER,
-    CNCT_TMOT, 150, 200, 200,     1,  1,      350,  TC_TMOT,  R_FAIL, "v6" },
-  /* mixed ip6+4, v6 starts, v4 never starts due to high HE, TIMEOUT */
-  { 7, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_V4,
-    CNCT_TMOT, 150, 500, 500,     1,  0,      400,  TC_TMOT,  R_FAIL, NULL },
-  /* mixed ip4+6, but only use v4, check it uses full connect timeout,
-     although another address of the 'wrong' family is available */
-  { 8, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_V6,
-    CNCT_TMOT, 150, 500, 500,     0,  1,      400,  TC_TMOT,  R_FAIL, NULL },
-  /* mixed ip4+6, but only use v6, check it uses full connect timeout,
-     although another address of the 'wrong' family is available */
+    { 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
+      CNCT_TMOT, 150, 200,  200,    0,  1,      200,  TC_TMOT,  R_FAIL, NULL },
+    /* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT   */
+    { 4, TURL, "test.com:123:::1,::2", CURL_IPRESOLVE_WHATEVER,
+      CNCT_TMOT, 150, 200,  200,    0,  2,      400,  TC_TMOT,  R_FAIL, NULL },
+    /* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT   */
+
+    { 5, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_WHATEVER,
+      CNCT_TMOT, 150, 200, 200,     1,  1,      350,  TC_TMOT,  R_FAIL, "v6" },
+    /* mixed ip4+6, v6 always first, v4 kicks in on HE, fails after ~350ms */
+    { 6, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_WHATEVER,
+      CNCT_TMOT, 150, 200, 200,     1,  1,      350,  TC_TMOT,  R_FAIL, "v6" },
+    /* mixed ip6+4, v6 starts, v4 never starts due to high HE, TIMEOUT */
+    { 7, TURL, "test.com:123:192.0.2.1,::1", CURL_IPRESOLVE_V4,
+      CNCT_TMOT, 150, 500, 500,     1,  0,      400,  TC_TMOT,  R_FAIL, NULL },
+    /* mixed ip4+6, but only use v4, check it uses full connect timeout,
+       although another address of the 'wrong' family is available */
+    { 8, TURL, "test.com:123:::1,192.0.2.1", CURL_IPRESOLVE_V6,
+      CNCT_TMOT, 150, 500, 500,     0,  1,      400,  TC_TMOT,  R_FAIL, NULL },
+    /* mixed ip4+6, but only use v6, check it uses full connect timeout,
+       although another address of the 'wrong' family is available */
 #endif
-};
-
-UNITTEST_START
+  };
 
   size_t i;
 
   for(i = 0; i < CURL_ARRAYSIZE(TEST_CASES); ++i) {
-    test_connect(&TEST_CASES[i]);
+    test_connect(easy, &TEST_CASES[i]);
   }
 
-UNITTEST_STOP
+  UNITTEST_END(t2600_stop(easy))
+}
index 9fd8d56aebbdb54a5bb8340325033f5b46ba44bc..41395186f098e5d012792232eef4f8d2c3d5f1ad 100644 (file)
 #include "bufq.h"
 #include "curl_trc.h"
 
-static CURLcode unit_setup(void)
-{
-  CURLcode res = CURLE_OK;
-  return res;
-}
-
-static void unit_stop(void)
-{
-}
-
 static const char *tail_err(struct bufq *q)
 {
   struct buf_chunk *chunk;
@@ -86,12 +76,12 @@ static void dump_bufq(struct bufq *q, const char *msg)
   curl_mfprintf(stderr, "- spares: %zu\n", n);
 }
 
-static unsigned char test_data[32*1024];
-
 static void check_bufq(size_t pool_spares,
                        size_t chunk_size, size_t max_chunks,
                        size_t wsize, size_t rsize, int opts)
 {
+  static unsigned char test_data[32*1024];
+
   struct bufq q;
   struct bufc_pool pool;
   size_t max_len = chunk_size * max_chunks;
@@ -250,7 +240,10 @@ static void check_bufq(size_t pool_spares,
     Curl_bufcp_free(&pool);
 }
 
-UNITTEST_START
+static CURLcode test_unit2601(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+
   struct bufq q;
   ssize_t n;
   CURLcode result;
@@ -278,4 +271,5 @@ UNITTEST_START
   check_bufq(8, 8000, 10, 1234, 1234, BUFQ_OPT_NONE);
   check_bufq(8, 1024, 4, 129, 127, BUFQ_OPT_NO_SPARES);
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index d730a987407719937342a539bc003ee6d9ae8aee..ee0cac08dac7b0a0ce09e5fb27ed01155b8c34b4 100644 (file)
 #include "dynhds.h"
 #include "curl_trc.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit2602(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
 
   struct dynhds hds;
   struct dynbuf dbuf;
@@ -145,4 +137,5 @@ UNITTEST_START
 
   Curl_dynhds_free(&hds);
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 82d56a5a793430f07c5c860c8efaa6701c141904..cfbe8eb305fe752aef0735bad32b96634e7b861d 100644 (file)
 #include "http1.h"
 #include "curl_trc.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
-
 #ifndef CURL_DISABLE_HTTP
-struct tcase {
-  const char **input;
-  const char *default_scheme;
-  const char *method;
-  const char *scheme;
-  const char *authority;
-  const char *path;
-  size_t header_count;
-  size_t input_remain;
-};
-
 static void check_eq(const char *s, const char *exp_s, const char *name)
 {
   if(s && exp_s) {
@@ -68,7 +48,18 @@ static void check_eq(const char *s, const char *exp_s, const char *name)
   }
 }
 
-static void parse_success(struct tcase *t)
+struct tcase {
+  const char **input;
+  const char *default_scheme;
+  const char *method;
+  const char *scheme;
+  const char *authority;
+  const char *path;
+  size_t header_count;
+  size_t input_remain;
+};
+
+static void parse_success(const struct tcase *t)
 {
   struct h1_req_parser p;
   const char *buf;
@@ -119,70 +110,72 @@ static void parse_success(struct tcase *t)
 
   Curl_h1_req_parse_free(&p);
 }
-
-static const char *T1_INPUT[] = {
-  "GET /path HTTP/1.1\r\nHost: test.curl.se\r\n\r\n",
-  NULL,
-};
-static struct tcase TEST1a = {
-  T1_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 0
-};
-static struct tcase TEST1b = {
-  T1_INPUT, "https", "GET", "https", NULL, "/path", 1, 0
-};
-
-static const char *T2_INPUT[] = {
-  "GET /path HTT",
-  "P/1.1\r\nHost: te",
-  "st.curl.se\r\n\r",
-  "\n12345678",
-  NULL,
-};
-static struct tcase TEST2 = {
-  T2_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 8
-};
-
-static const char *T3_INPUT[] = {
-  "GET ftp://ftp.curl.se/xxx?a=2 HTTP/1.1\r\nContent-Length: 0\r",
-  "\nUser-Agent: xxx\r\n\r\n",
-  NULL,
-};
-static struct tcase TEST3a = {
-  T3_INPUT, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0
-};
-
-static const char *T4_INPUT[] = {
-  "CONNECT ftp.curl.se:123 HTTP/1.1\r\nContent-Length: 0\r\n",
-  "User-Agent: xxx\r\n",
-  "nothing:  \r\n\r\n\n\n",
-  NULL,
-};
-static struct tcase TEST4a = {
-  T4_INPUT, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2
-};
-
-static const char *T5_INPUT[] = {
-  "OPTIONS * HTTP/1.1\r\nContent-Length: 0\r\nBlabla: xxx.yyy\r",
-  "\n\tzzzzzz\r\n\r\n",
-  "123",
-  NULL,
-};
-static struct tcase TEST5a = {
-  T5_INPUT, NULL, "OPTIONS", NULL, NULL, "*", 2, 3
-};
-
-static const char *T6_INPUT[] = {
-  "PUT /path HTTP/1.1\nHost: test.curl.se\n\n123",
-  NULL,
-};
-static struct tcase TEST6a = {
-  T6_INPUT, NULL, "PUT", NULL, NULL, "/path", 1, 3
-};
 #endif
 
-UNITTEST_START
+static CURLcode test_unit2603(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
 
 #ifndef CURL_DISABLE_HTTP
+  static const char *T1_INPUT[] = {
+    "GET /path HTTP/1.1\r\nHost: test.curl.se\r\n\r\n",
+    NULL,
+  };
+  static const struct tcase TEST1a = {
+    T1_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 0
+  };
+  static const struct tcase TEST1b = {
+    T1_INPUT, "https", "GET", "https", NULL, "/path", 1, 0
+  };
+
+  static const char *T2_INPUT[] = {
+    "GET /path HTT",
+    "P/1.1\r\nHost: te",
+    "st.curl.se\r\n\r",
+    "\n12345678",
+    NULL,
+  };
+  static const struct tcase TEST2 = {
+    T2_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 8
+  };
+
+  static const char *T3_INPUT[] = {
+    "GET ftp://ftp.curl.se/xxx?a=2 HTTP/1.1\r\nContent-Length: 0\r",
+    "\nUser-Agent: xxx\r\n\r\n",
+    NULL,
+  };
+  static const struct tcase TEST3a = {
+    T3_INPUT, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0
+  };
+
+  static const char *T4_INPUT[] = {
+    "CONNECT ftp.curl.se:123 HTTP/1.1\r\nContent-Length: 0\r\n",
+    "User-Agent: xxx\r\n",
+    "nothing:  \r\n\r\n\n\n",
+    NULL,
+  };
+  static const struct tcase TEST4a = {
+    T4_INPUT, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2
+  };
+
+  static const char *T5_INPUT[] = {
+    "OPTIONS * HTTP/1.1\r\nContent-Length: 0\r\nBlabla: xxx.yyy\r",
+    "\n\tzzzzzz\r\n\r\n",
+    "123",
+    NULL,
+  };
+  static const struct tcase TEST5a = {
+    T5_INPUT, NULL, "OPTIONS", NULL, NULL, "*", 2, 3
+  };
+
+  static const char *T6_INPUT[] = {
+    "PUT /path HTTP/1.1\nHost: test.curl.se\n\n123",
+    NULL,
+  };
+  static const struct tcase TEST6a = {
+    T6_INPUT, NULL, "PUT", NULL, NULL, "/path", 1, 3
+  };
+
   parse_success(&TEST1a);
   parse_success(&TEST1b);
   parse_success(&TEST2);
@@ -192,4 +185,5 @@ UNITTEST_START
   parse_success(&TEST6a);
 #endif
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 16330e4f238429a9cd4fa6977f0803daac8f01a2..608a2ef0b7c8b981d06b5dca29bd2bb1be42fe59 100644 (file)
 #include "vssh/curl_path.h"
 #include "memdebug.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit2604(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+  UNITTEST_BEGIN_SIMPLE
 
+#ifdef USE_SSH
 
-struct set {
-  const char *cp;
-  const char *expect; /* the returned content */
-  const char *next;   /* what cp points to after the call */
-  const char *home;
-  CURLcode result;
-};
+  struct set {
+    const char *cp;
+    const char *expect; /* the returned content */
+    const char *next;   /* what cp points to after the call */
+    const char *home;
+    CURLcode result;
+  };
 
-UNITTEST_START
-#ifdef USE_SSH
-{
 #if defined(CURL_GNUC_DIAG) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Woverlength-strings"
@@ -79,7 +72,7 @@ UNITTEST_START
   };
 
 #if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic warning "-Woverlength-strings"
+#pragma GCC diagnostic pop
 #endif
 
   list[0].cp = calloc(1, too_long + 1);
@@ -113,11 +106,8 @@ UNITTEST_START
   }
 
   free(CURL_UNCONST(list[0].cp));
-}
-#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
 
 #endif
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 866be9eca81b92f49d01e0d910f1e0361e1dabc9..00c94811062e375001dfa8842e456f0ddc70959b 100644 (file)
 #include "curl_get_line.h"
 #include "memdebug.h"
 
+static CURLcode test_unit3200(char *arg)
+{
+  UNITTEST_BEGIN_SIMPLE
+
 #if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) ||  \
   !defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
 
-/* The test XML does not supply a way to write files without newlines
- * so we write our own
- */
+#if defined(CURL_GNUC_DIAG) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverlength-strings"
+#endif
+
+  /* The test XML does not supply a way to write files without newlines
+   * so we write our own
+   */
 
 #define C64 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
 #define C256 C64 C64 C64 C64
 #define C1024 C256 C256 C256 C256
 #define C4096 C1024 C1024 C1024 C1024
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
+  static const char *filecontents[] = {
+    /* Both should be read */
+    "LINE1\n"
+    "LINE2 NEWLINE\n",
 
-static void unit_stop(void)
-{
-}
+    /* Both should be read */
+    "LINE1\n"
+    "LINE2 NONEWLINE",
 
-#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Woverlength-strings"
-#endif
-
-#define NUMTESTS 6
-static const char *filecontents[] = {
-  /* Both should be read */
-  "LINE1\n"
-  "LINE2 NEWLINE\n",
-
-  /* Both should be read */
-  "LINE1\n"
-  "LINE2 NONEWLINE",
-
-  /* Only first should be read */
-  "LINE1\n"
-  C4096,
+    /* Only first should be read */
+    "LINE1\n"
+    C4096,
 
-  /* First line should be read */
-  "LINE1\n"
-  C4096 "SOME EXTRA TEXT",
+    /* First line should be read */
+    "LINE1\n"
+    C4096 "SOME EXTRA TEXT",
 
-  /* Only first should be read */
-  "LINE1\n"
-  C4096 "SOME EXTRA TEXT\n"
-  "LINE3\n",
+    /* Only first should be read */
+    "LINE1\n"
+    C4096 "SOME EXTRA TEXT\n"
+    "LINE3\n",
 
-  "LINE1\x1aTEST"
-};
+    "LINE1\x1aTEST"
+  };
 
 #if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic warning "-Woverlength-strings"
+#pragma GCC diagnostic pop
 #endif
 
-
-UNITTEST_START
   size_t i;
   int rc = 0;
-  for(i = 0; i < NUMTESTS; i++) {
+  for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
     FILE *fp;
     struct dynbuf buf;
     size_t len = 4096;
@@ -170,21 +162,8 @@ UNITTEST_START
     curl_mfprintf(stderr, "OK\n");
   }
   return (CURLcode)rc;
-UNITTEST_STOP
 
-#if defined(CURL_GNUC_DIAG) || defined(__clang__)
-#pragma GCC diagnostic pop
 #endif
 
-#else
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-static void unit_stop(void)
-{
+  UNITTEST_END_SIMPLE
 }
-UNITTEST_START
-UNITTEST_STOP
-
-#endif
index 99b8b0d06253cf0402ee4957e006eccd413984ba..779938cc6fcb6d7c1e1a5fde9ce3e70edb33656f 100644 (file)
 
 #include "vtls/cipher_suite.h"
 
-static CURLcode unit_setup(void)
+static CURLcode test_unit3205(char *arg)
 {
-  return CURLE_OK;
-}
-
-static void unit_stop(void)
-{
-}
+  UNITTEST_BEGIN_SIMPLE
 
 #if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
 
-struct test_cs_entry {
-  uint16_t id;
-  const char *rfc;
-  const char *openssl;
-};
-static const struct test_cs_entry test_cs_list[] = {
-#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
-  { 0x1301, "TLS_AES_128_GCM_SHA256",
-            NULL },
-  { 0x1302, "TLS_AES_256_GCM_SHA384",
-            NULL },
-  { 0x1303, "TLS_CHACHA20_POLY1305_SHA256",
-            NULL },
-  { 0x1304, "TLS_AES_128_CCM_SHA256",
-            NULL },
-  { 0x1305, "TLS_AES_128_CCM_8_SHA256",
-            NULL },
-#endif
-  { 0xC02B, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
-            "ECDHE-ECDSA-AES128-GCM-SHA256" },
-  { 0xC02C, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
-            "ECDHE-ECDSA-AES256-GCM-SHA384" },
-  { 0xC02F, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
-            "ECDHE-RSA-AES128-GCM-SHA256" },
-  { 0xC030, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
-            "ECDHE-RSA-AES256-GCM-SHA384" },
-  { 0xCCA8, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
-            "ECDHE-RSA-CHACHA20-POLY1305" },
-  { 0xCCA9, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
-            "ECDHE-ECDSA-CHACHA20-POLY1305" },
-#if defined(USE_MBEDTLS)
-  { 0x002F, "TLS_RSA_WITH_AES_128_CBC_SHA",
-            "AES128-SHA" },
-  { 0x0035, "TLS_RSA_WITH_AES_256_CBC_SHA",
-            "AES256-SHA" },
-  { 0x003C, "TLS_RSA_WITH_AES_128_CBC_SHA256",
-            "AES128-SHA256" },
-  { 0x003D, "TLS_RSA_WITH_AES_256_CBC_SHA256",
-            "AES256-SHA256" },
-  { 0x009C, "TLS_RSA_WITH_AES_128_GCM_SHA256",
-            "AES128-GCM-SHA256" },
-  { 0x009D, "TLS_RSA_WITH_AES_256_GCM_SHA384",
-            "AES256-GCM-SHA384" },
-  { 0xC004, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
-            "ECDH-ECDSA-AES128-SHA" },
-  { 0xC005, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
-            "ECDH-ECDSA-AES256-SHA" },
-  { 0xC009, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
-            "ECDHE-ECDSA-AES128-SHA" },
-  { 0xC00A, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
-            "ECDHE-ECDSA-AES256-SHA" },
-  { 0xC00E, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
-            "ECDH-RSA-AES128-SHA" },
-  { 0xC00F, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
-            "ECDH-RSA-AES256-SHA" },
-  { 0xC013, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
-            "ECDHE-RSA-AES128-SHA" },
-  { 0xC014, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
-            "ECDHE-RSA-AES256-SHA" },
-  { 0xC023, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
-            "ECDHE-ECDSA-AES128-SHA256" },
-  { 0xC024, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
-            "ECDHE-ECDSA-AES256-SHA384" },
-  { 0xC025, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
-            "ECDH-ECDSA-AES128-SHA256" },
-  { 0xC026, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
-            "ECDH-ECDSA-AES256-SHA384" },
-  { 0xC027, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
-            "ECDHE-RSA-AES128-SHA256" },
-  { 0xC028, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
-            "ECDHE-RSA-AES256-SHA384" },
-  { 0xC029, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
-            "ECDH-RSA-AES128-SHA256" },
-  { 0xC02A, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
-            "ECDH-RSA-AES256-SHA384" },
-  { 0xC02D, "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
-            "ECDH-ECDSA-AES128-GCM-SHA256" },
-  { 0xC02E, "TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
-            "ECDH-ECDSA-AES256-GCM-SHA384" },
-  { 0xC031, "TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
-            "ECDH-RSA-AES128-GCM-SHA256" },
-  { 0xC032, "TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
-            "ECDH-RSA-AES256-GCM-SHA384" },
-#endif
-#if defined(USE_MBEDTLS)
-  { 0x0001, "TLS_RSA_WITH_NULL_MD5",
-            "NULL-MD5" },
-  { 0x0002, "TLS_RSA_WITH_NULL_SHA",
-            "NULL-SHA" },
-  { 0x002C, "TLS_PSK_WITH_NULL_SHA",
-            "PSK-NULL-SHA" },
-  { 0x002D, "TLS_DHE_PSK_WITH_NULL_SHA",
-            "DHE-PSK-NULL-SHA" },
-  { 0x002E, "TLS_RSA_PSK_WITH_NULL_SHA",
-            "RSA-PSK-NULL-SHA" },
-  { 0x0033, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
-            "DHE-RSA-AES128-SHA" },
-  { 0x0039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
-            "DHE-RSA-AES256-SHA" },
-  { 0x003B, "TLS_RSA_WITH_NULL_SHA256",
-            "NULL-SHA256" },
-  { 0x0067, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
-            "DHE-RSA-AES128-SHA256" },
-  { 0x006B, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
-            "DHE-RSA-AES256-SHA256" },
-  { 0x008C, "TLS_PSK_WITH_AES_128_CBC_SHA",
-            "PSK-AES128-CBC-SHA" },
-  { 0x008D, "TLS_PSK_WITH_AES_256_CBC_SHA",
-            "PSK-AES256-CBC-SHA" },
-  { 0x0090, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA",
-            "DHE-PSK-AES128-CBC-SHA" },
-  { 0x0091, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA",
-            "DHE-PSK-AES256-CBC-SHA" },
-  { 0x0094, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA",
-            "RSA-PSK-AES128-CBC-SHA" },
-  { 0x0095, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA",
-            "RSA-PSK-AES256-CBC-SHA" },
-  { 0x009E, "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
-            "DHE-RSA-AES128-GCM-SHA256" },
-  { 0x009F, "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
-            "DHE-RSA-AES256-GCM-SHA384" },
-  { 0x00A8, "TLS_PSK_WITH_AES_128_GCM_SHA256",
-            "PSK-AES128-GCM-SHA256" },
-  { 0x00A9, "TLS_PSK_WITH_AES_256_GCM_SHA384",
-            "PSK-AES256-GCM-SHA384" },
-  { 0x00AA, "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256",
-            "DHE-PSK-AES128-GCM-SHA256" },
-  { 0x00AB, "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384",
-            "DHE-PSK-AES256-GCM-SHA384" },
-  { 0x00AC, "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256",
-            "RSA-PSK-AES128-GCM-SHA256" },
-  { 0x00AD, "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384",
-            "RSA-PSK-AES256-GCM-SHA384" },
-  { 0x00AE, "TLS_PSK_WITH_AES_128_CBC_SHA256",
-            "PSK-AES128-CBC-SHA256" },
-  { 0x00AF, "TLS_PSK_WITH_AES_256_CBC_SHA384",
-            "PSK-AES256-CBC-SHA384" },
-  { 0x00B0, "TLS_PSK_WITH_NULL_SHA256",
-            "PSK-NULL-SHA256" },
-  { 0x00B1, "TLS_PSK_WITH_NULL_SHA384",
-            "PSK-NULL-SHA384" },
-  { 0x00B2, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256",
-            "DHE-PSK-AES128-CBC-SHA256" },
-  { 0x00B3, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384",
-            "DHE-PSK-AES256-CBC-SHA384" },
-  { 0x00B4, "TLS_DHE_PSK_WITH_NULL_SHA256",
-            "DHE-PSK-NULL-SHA256" },
-  { 0x00B5, "TLS_DHE_PSK_WITH_NULL_SHA384",
-            "DHE-PSK-NULL-SHA384" },
-  { 0x00B6, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256",
-            "RSA-PSK-AES128-CBC-SHA256" },
-  { 0x00B7, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384",
-            "RSA-PSK-AES256-CBC-SHA384" },
-  { 0x00B8, "TLS_RSA_PSK_WITH_NULL_SHA256",
-            "RSA-PSK-NULL-SHA256" },
-  { 0x00B9, "TLS_RSA_PSK_WITH_NULL_SHA384",
-            "RSA-PSK-NULL-SHA384" },
-  { 0xC001, "TLS_ECDH_ECDSA_WITH_NULL_SHA",
-            "ECDH-ECDSA-NULL-SHA" },
-  { 0xC006, "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
-            "ECDHE-ECDSA-NULL-SHA" },
-  { 0xC00B, "TLS_ECDH_RSA_WITH_NULL_SHA",
-            "ECDH-RSA-NULL-SHA" },
-  { 0xC010, "TLS_ECDHE_RSA_WITH_NULL_SHA",
-            "ECDHE-RSA-NULL-SHA" },
-  { 0xC035, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA",
-            "ECDHE-PSK-AES128-CBC-SHA" },
-  { 0xC036, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA",
-            "ECDHE-PSK-AES256-CBC-SHA" },
-  { 0xCCAB, "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256",
-            "PSK-CHACHA20-POLY1305" },
-#endif
-#if defined(USE_MBEDTLS)
-  { 0xC09C, "TLS_RSA_WITH_AES_128_CCM",
-            "AES128-CCM" },
-  { 0xC09D, "TLS_RSA_WITH_AES_256_CCM",
-            "AES256-CCM" },
-  { 0xC0A0, "TLS_RSA_WITH_AES_128_CCM_8",
-            "AES128-CCM8" },
-  { 0xC0A1, "TLS_RSA_WITH_AES_256_CCM_8",
-            "AES256-CCM8" },
-  { 0xC0AC, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM",
-            "ECDHE-ECDSA-AES128-CCM" },
-  { 0xC0AD, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM",
-            "ECDHE-ECDSA-AES256-CCM" },
-  { 0xC0AE, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8",
-            "ECDHE-ECDSA-AES128-CCM8" },
-  { 0xC0AF, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8",
-            "ECDHE-ECDSA-AES256-CCM8" },
-#endif
+  struct test_cs_entry {
+    uint16_t id;
+    const char *rfc;
+    const char *openssl;
+  };
+
+  static const struct test_cs_entry test_cs_list[] = {
+    { 0x1301, "TLS_AES_128_GCM_SHA256",
+              NULL },
+    { 0x1302, "TLS_AES_256_GCM_SHA384",
+              NULL },
+    { 0x1303, "TLS_CHACHA20_POLY1305_SHA256",
+              NULL },
+    { 0x1304, "TLS_AES_128_CCM_SHA256",
+              NULL },
+    { 0x1305, "TLS_AES_128_CCM_8_SHA256",
+              NULL },
+    { 0xC02B, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
+              "ECDHE-ECDSA-AES128-GCM-SHA256" },
+    { 0xC02C, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
+              "ECDHE-ECDSA-AES256-GCM-SHA384" },
+    { 0xC02F, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
+              "ECDHE-RSA-AES128-GCM-SHA256" },
+    { 0xC030, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
+              "ECDHE-RSA-AES256-GCM-SHA384" },
+    { 0xCCA8, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
+              "ECDHE-RSA-CHACHA20-POLY1305" },
+    { 0xCCA9, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
+              "ECDHE-ECDSA-CHACHA20-POLY1305" },
 #if defined(USE_MBEDTLS)
-  /* entries marked ns are non-"standard", they are not in OpenSSL */
-  { 0x0041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA",
-            "CAMELLIA128-SHA" },
-  { 0x0045, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA",
-            "DHE-RSA-CAMELLIA128-SHA" },
-  { 0x0084, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA",
-            "CAMELLIA256-SHA" },
-  { 0x0088, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA",
-            "DHE-RSA-CAMELLIA256-SHA" },
-  { 0x00BA, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256",
-            "CAMELLIA128-SHA256" },
-  { 0x00BE, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
-            "DHE-RSA-CAMELLIA128-SHA256" },
-  { 0x00C0, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256",
-            "CAMELLIA256-SHA256" },
-  { 0x00C4, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256",
-            "DHE-RSA-CAMELLIA256-SHA256" },
-  { 0xC037, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256",
-            "ECDHE-PSK-AES128-CBC-SHA256" },
-  { 0xC038, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384",
-            "ECDHE-PSK-AES256-CBC-SHA384" },
-  { 0xC039, "TLS_ECDHE_PSK_WITH_NULL_SHA",
-            "ECDHE-PSK-NULL-SHA" },
-  { 0xC03A, "TLS_ECDHE_PSK_WITH_NULL_SHA256",
-            "ECDHE-PSK-NULL-SHA256" },
-  { 0xC03B, "TLS_ECDHE_PSK_WITH_NULL_SHA384",
-            "ECDHE-PSK-NULL-SHA384" },
-  { 0xC03C, "TLS_RSA_WITH_ARIA_128_CBC_SHA256",
-            "ARIA128-SHA256" /* ns */ },
-  { 0xC03D, "TLS_RSA_WITH_ARIA_256_CBC_SHA384",
-            "ARIA256-SHA384" /* ns */ },
-  { 0xC044, "TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256",
-            "DHE-RSA-ARIA128-SHA256" /* ns */ },
-  { 0xC045, "TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384",
-            "DHE-RSA-ARIA256-SHA384" /* ns */ },
-  { 0xC048, "TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256",
-            "ECDHE-ECDSA-ARIA128-SHA256" /* ns */ },
-  { 0xC049, "TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384",
-            "ECDHE-ECDSA-ARIA256-SHA384" /* ns */ },
-  { 0xC04A, "TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256",
-            "ECDH-ECDSA-ARIA128-SHA256" /* ns */ },
-  { 0xC04B, "TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384",
-            "ECDH-ECDSA-ARIA256-SHA384" /* ns */ },
-  { 0xC04C, "TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256",
-            "ECDHE-ARIA128-SHA256" /* ns */ },
-  { 0xC04D, "TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384",
-            "ECDHE-ARIA256-SHA384" /* ns */ },
-  { 0xC04E, "TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256",
-            "ECDH-ARIA128-SHA256" /* ns */ },
-  { 0xC04F, "TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384",
-            "ECDH-ARIA256-SHA384" /* ns */ },
-  { 0xC050, "TLS_RSA_WITH_ARIA_128_GCM_SHA256",
-            "ARIA128-GCM-SHA256" },
-  { 0xC051, "TLS_RSA_WITH_ARIA_256_GCM_SHA384",
-            "ARIA256-GCM-SHA384" },
-  { 0xC052, "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256",
-            "DHE-RSA-ARIA128-GCM-SHA256" },
-  { 0xC053, "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384",
-            "DHE-RSA-ARIA256-GCM-SHA384" },
-  { 0xC05C, "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256",
-            "ECDHE-ECDSA-ARIA128-GCM-SHA256" },
-  { 0xC05D, "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384",
-            "ECDHE-ECDSA-ARIA256-GCM-SHA384" },
-  { 0xC05E, "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256",
-            "ECDH-ECDSA-ARIA128-GCM-SHA256" /* ns */ },
-  { 0xC05F, "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384",
-            "ECDH-ECDSA-ARIA256-GCM-SHA384" /* ns */ },
-  { 0xC060, "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256",
-            "ECDHE-ARIA128-GCM-SHA256" },
-  { 0xC061, "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384",
-            "ECDHE-ARIA256-GCM-SHA384" },
-  { 0xC062, "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256",
-            "ECDH-ARIA128-GCM-SHA256" /* ns */ },
-  { 0xC063, "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384",
-            "ECDH-ARIA256-GCM-SHA384" /* ns */ },
-  { 0xC064, "TLS_PSK_WITH_ARIA_128_CBC_SHA256",
-            "PSK-ARIA128-SHA256" /* ns */ },
-  { 0xC065, "TLS_PSK_WITH_ARIA_256_CBC_SHA384",
-            "PSK-ARIA256-SHA384" /* ns */ },
-  { 0xC066, "TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256",
-            "DHE-PSK-ARIA128-SHA256" /* ns */ },
-  { 0xC067, "TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384",
-            "DHE-PSK-ARIA256-SHA384" /* ns */ },
-  { 0xC068, "TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256",
-            "RSA-PSK-ARIA128-SHA256" /* ns */ },
-  { 0xC069, "TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384",
-            "RSA-PSK-ARIA256-SHA384" /* ns */ },
-  { 0xC06A, "TLS_PSK_WITH_ARIA_128_GCM_SHA256",
-            "PSK-ARIA128-GCM-SHA256" },
-  { 0xC06B, "TLS_PSK_WITH_ARIA_256_GCM_SHA384",
-            "PSK-ARIA256-GCM-SHA384" },
-  { 0xC06C, "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256",
-            "DHE-PSK-ARIA128-GCM-SHA256" },
-  { 0xC06D, "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384",
-            "DHE-PSK-ARIA256-GCM-SHA384" },
-  { 0xC06E, "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256",
-            "RSA-PSK-ARIA128-GCM-SHA256" },
-  { 0xC06F, "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384",
-            "RSA-PSK-ARIA256-GCM-SHA384" },
-  { 0xC070, "TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256",
-            "ECDHE-PSK-ARIA128-SHA256" /* ns */ },
-  { 0xC071, "TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384",
-            "ECDHE-PSK-ARIA256-SHA384" /* ns */ },
-  { 0xC072, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
-            "ECDHE-ECDSA-CAMELLIA128-SHA256" },
-  { 0xC073, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
-            "ECDHE-ECDSA-CAMELLIA256-SHA384" },
-  { 0xC074, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
-            "ECDH-ECDSA-CAMELLIA128-SHA256" /* ns */ },
-  { 0xC075, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
-            "ECDH-ECDSA-CAMELLIA256-SHA384" /* ns */ },
-  { 0xC076, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
-            "ECDHE-RSA-CAMELLIA128-SHA256" },
-  { 0xC077, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384",
-            "ECDHE-RSA-CAMELLIA256-SHA384" },
-  { 0xC078, "TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256",
-            "ECDH-CAMELLIA128-SHA256" /* ns */ },
-  { 0xC079, "TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384",
-            "ECDH-CAMELLIA256-SHA384" /* ns */ },
-  { 0xC07A, "TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256",
-            "CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC07B, "TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384",
-            "CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC07C, "TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
-            "DHE-RSA-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC07D, "TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
-            "DHE-RSA-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC086, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
-            "ECDHE-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC087, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
-            "ECDHE-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC088, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
-            "ECDH-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC089, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
-            "ECDH-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC08A, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
-            "ECDHE-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC08B, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
-            "ECDHE-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC08C, "TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256",
-            "ECDH-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC08D, "TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384",
-            "ECDH-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC08E, "TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256",
-            "PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC08F, "TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384",
-            "PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC090, "TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256",
-            "DHE-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC091, "TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384",
-            "DHE-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC092, "TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256",
-            "RSA-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
-  { 0xC093, "TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384",
-            "RSA-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
-  { 0xC094, "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256",
-            "PSK-CAMELLIA128-SHA256" },
-  { 0xC095, "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384",
-            "PSK-CAMELLIA256-SHA384" },
-  { 0xC096, "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
-            "DHE-PSK-CAMELLIA128-SHA256" },
-  { 0xC097, "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
-            "DHE-PSK-CAMELLIA256-SHA384" },
-  { 0xC098, "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256",
-            "RSA-PSK-CAMELLIA128-SHA256" },
-  { 0xC099, "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384",
-            "RSA-PSK-CAMELLIA256-SHA384" },
-  { 0xC09A, "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
-            "ECDHE-PSK-CAMELLIA128-SHA256" },
-  { 0xC09B, "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
-            "ECDHE-PSK-CAMELLIA256-SHA384" },
-  { 0xC09E, "TLS_DHE_RSA_WITH_AES_128_CCM",
-            "DHE-RSA-AES128-CCM" },
-  { 0xC09F, "TLS_DHE_RSA_WITH_AES_256_CCM",
-            "DHE-RSA-AES256-CCM" },
-  { 0xC0A2, "TLS_DHE_RSA_WITH_AES_128_CCM_8",
-            "DHE-RSA-AES128-CCM8" },
-  { 0xC0A3, "TLS_DHE_RSA_WITH_AES_256_CCM_8",
-            "DHE-RSA-AES256-CCM8" },
-  { 0xC0A4, "TLS_PSK_WITH_AES_128_CCM",
-            "PSK-AES128-CCM" },
-  { 0xC0A5, "TLS_PSK_WITH_AES_256_CCM",
-            "PSK-AES256-CCM" },
-  { 0xC0A6, "TLS_DHE_PSK_WITH_AES_128_CCM",
-            "DHE-PSK-AES128-CCM" },
-  { 0xC0A7, "TLS_DHE_PSK_WITH_AES_256_CCM",
-            "DHE-PSK-AES256-CCM" },
-  { 0xC0A8, "TLS_PSK_WITH_AES_128_CCM_8",
-            "PSK-AES128-CCM8" },
-  { 0xC0A9, "TLS_PSK_WITH_AES_256_CCM_8",
-            "PSK-AES256-CCM8" },
-  { 0xC0AA, "TLS_PSK_DHE_WITH_AES_128_CCM_8",
-            "DHE-PSK-AES128-CCM8" },
-  { 0xC0AB, "TLS_PSK_DHE_WITH_AES_256_CCM_8",
-            "DHE-PSK-AES256-CCM8" },
-  { 0xCCAA, "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
-            "DHE-RSA-CHACHA20-POLY1305" },
-  { 0xCCAC, "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
-            "ECDHE-PSK-CHACHA20-POLY1305" },
-  { 0xCCAD, "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
-            "DHE-PSK-CHACHA20-POLY1305" },
-  { 0xCCAE, "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256",
-            "RSA-PSK-CHACHA20-POLY1305" },
+    { 0x002F, "TLS_RSA_WITH_AES_128_CBC_SHA",
+              "AES128-SHA" },
+    { 0x0035, "TLS_RSA_WITH_AES_256_CBC_SHA",
+              "AES256-SHA" },
+    { 0x003C, "TLS_RSA_WITH_AES_128_CBC_SHA256",
+              "AES128-SHA256" },
+    { 0x003D, "TLS_RSA_WITH_AES_256_CBC_SHA256",
+              "AES256-SHA256" },
+    { 0x009C, "TLS_RSA_WITH_AES_128_GCM_SHA256",
+              "AES128-GCM-SHA256" },
+    { 0x009D, "TLS_RSA_WITH_AES_256_GCM_SHA384",
+              "AES256-GCM-SHA384" },
+    { 0xC004, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
+              "ECDH-ECDSA-AES128-SHA" },
+    { 0xC005, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
+              "ECDH-ECDSA-AES256-SHA" },
+    { 0xC009, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
+              "ECDHE-ECDSA-AES128-SHA" },
+    { 0xC00A, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
+              "ECDHE-ECDSA-AES256-SHA" },
+    { 0xC00E, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
+              "ECDH-RSA-AES128-SHA" },
+    { 0xC00F, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
+              "ECDH-RSA-AES256-SHA" },
+    { 0xC013, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
+              "ECDHE-RSA-AES128-SHA" },
+    { 0xC014, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
+              "ECDHE-RSA-AES256-SHA" },
+    { 0xC023, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
+              "ECDHE-ECDSA-AES128-SHA256" },
+    { 0xC024, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
+              "ECDHE-ECDSA-AES256-SHA384" },
+    { 0xC025, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
+              "ECDH-ECDSA-AES128-SHA256" },
+    { 0xC026, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
+              "ECDH-ECDSA-AES256-SHA384" },
+    { 0xC027, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
+              "ECDHE-RSA-AES128-SHA256" },
+    { 0xC028, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
+              "ECDHE-RSA-AES256-SHA384" },
+    { 0xC029, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
+              "ECDH-RSA-AES128-SHA256" },
+    { 0xC02A, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
+              "ECDH-RSA-AES256-SHA384" },
+    { 0xC02D, "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",
+              "ECDH-ECDSA-AES128-GCM-SHA256" },
+    { 0xC02E, "TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384",
+              "ECDH-ECDSA-AES256-GCM-SHA384" },
+    { 0xC031, "TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256",
+              "ECDH-RSA-AES128-GCM-SHA256" },
+    { 0xC032, "TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384",
+              "ECDH-RSA-AES256-GCM-SHA384" },
+    { 0x0001, "TLS_RSA_WITH_NULL_MD5",
+              "NULL-MD5" },
+    { 0x0002, "TLS_RSA_WITH_NULL_SHA",
+              "NULL-SHA" },
+    { 0x002C, "TLS_PSK_WITH_NULL_SHA",
+              "PSK-NULL-SHA" },
+    { 0x002D, "TLS_DHE_PSK_WITH_NULL_SHA",
+              "DHE-PSK-NULL-SHA" },
+    { 0x002E, "TLS_RSA_PSK_WITH_NULL_SHA",
+              "RSA-PSK-NULL-SHA" },
+    { 0x0033, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
+              "DHE-RSA-AES128-SHA" },
+    { 0x0039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
+              "DHE-RSA-AES256-SHA" },
+    { 0x003B, "TLS_RSA_WITH_NULL_SHA256",
+              "NULL-SHA256" },
+    { 0x0067, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
+              "DHE-RSA-AES128-SHA256" },
+    { 0x006B, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
+              "DHE-RSA-AES256-SHA256" },
+    { 0x008C, "TLS_PSK_WITH_AES_128_CBC_SHA",
+              "PSK-AES128-CBC-SHA" },
+    { 0x008D, "TLS_PSK_WITH_AES_256_CBC_SHA",
+              "PSK-AES256-CBC-SHA" },
+    { 0x0090, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA",
+              "DHE-PSK-AES128-CBC-SHA" },
+    { 0x0091, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA",
+              "DHE-PSK-AES256-CBC-SHA" },
+    { 0x0094, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA",
+              "RSA-PSK-AES128-CBC-SHA" },
+    { 0x0095, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA",
+              "RSA-PSK-AES256-CBC-SHA" },
+    { 0x009E, "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
+              "DHE-RSA-AES128-GCM-SHA256" },
+    { 0x009F, "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
+              "DHE-RSA-AES256-GCM-SHA384" },
+    { 0x00A8, "TLS_PSK_WITH_AES_128_GCM_SHA256",
+              "PSK-AES128-GCM-SHA256" },
+    { 0x00A9, "TLS_PSK_WITH_AES_256_GCM_SHA384",
+              "PSK-AES256-GCM-SHA384" },
+    { 0x00AA, "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256",
+              "DHE-PSK-AES128-GCM-SHA256" },
+    { 0x00AB, "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384",
+              "DHE-PSK-AES256-GCM-SHA384" },
+    { 0x00AC, "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256",
+              "RSA-PSK-AES128-GCM-SHA256" },
+    { 0x00AD, "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384",
+              "RSA-PSK-AES256-GCM-SHA384" },
+    { 0x00AE, "TLS_PSK_WITH_AES_128_CBC_SHA256",
+              "PSK-AES128-CBC-SHA256" },
+    { 0x00AF, "TLS_PSK_WITH_AES_256_CBC_SHA384",
+              "PSK-AES256-CBC-SHA384" },
+    { 0x00B0, "TLS_PSK_WITH_NULL_SHA256",
+              "PSK-NULL-SHA256" },
+    { 0x00B1, "TLS_PSK_WITH_NULL_SHA384",
+              "PSK-NULL-SHA384" },
+    { 0x00B2, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256",
+              "DHE-PSK-AES128-CBC-SHA256" },
+    { 0x00B3, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384",
+              "DHE-PSK-AES256-CBC-SHA384" },
+    { 0x00B4, "TLS_DHE_PSK_WITH_NULL_SHA256",
+              "DHE-PSK-NULL-SHA256" },
+    { 0x00B5, "TLS_DHE_PSK_WITH_NULL_SHA384",
+              "DHE-PSK-NULL-SHA384" },
+    { 0x00B6, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256",
+              "RSA-PSK-AES128-CBC-SHA256" },
+    { 0x00B7, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384",
+              "RSA-PSK-AES256-CBC-SHA384" },
+    { 0x00B8, "TLS_RSA_PSK_WITH_NULL_SHA256",
+              "RSA-PSK-NULL-SHA256" },
+    { 0x00B9, "TLS_RSA_PSK_WITH_NULL_SHA384",
+              "RSA-PSK-NULL-SHA384" },
+    { 0xC001, "TLS_ECDH_ECDSA_WITH_NULL_SHA",
+              "ECDH-ECDSA-NULL-SHA" },
+    { 0xC006, "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
+              "ECDHE-ECDSA-NULL-SHA" },
+    { 0xC00B, "TLS_ECDH_RSA_WITH_NULL_SHA",
+              "ECDH-RSA-NULL-SHA" },
+    { 0xC010, "TLS_ECDHE_RSA_WITH_NULL_SHA",
+              "ECDHE-RSA-NULL-SHA" },
+    { 0xC035, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA",
+              "ECDHE-PSK-AES128-CBC-SHA" },
+    { 0xC036, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA",
+              "ECDHE-PSK-AES256-CBC-SHA" },
+    { 0xCCAB, "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256",
+              "PSK-CHACHA20-POLY1305" },
+    { 0xC09C, "TLS_RSA_WITH_AES_128_CCM",
+              "AES128-CCM" },
+    { 0xC09D, "TLS_RSA_WITH_AES_256_CCM",
+              "AES256-CCM" },
+    { 0xC0A0, "TLS_RSA_WITH_AES_128_CCM_8",
+              "AES128-CCM8" },
+    { 0xC0A1, "TLS_RSA_WITH_AES_256_CCM_8",
+              "AES256-CCM8" },
+    { 0xC0AC, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM",
+              "ECDHE-ECDSA-AES128-CCM" },
+    { 0xC0AD, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM",
+              "ECDHE-ECDSA-AES256-CCM" },
+    { 0xC0AE, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8",
+              "ECDHE-ECDSA-AES128-CCM8" },
+    { 0xC0AF, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8",
+              "ECDHE-ECDSA-AES256-CCM8" },
+    /* entries marked ns are non-"standard", they are not in OpenSSL */
+    { 0x0041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA",
+              "CAMELLIA128-SHA" },
+    { 0x0045, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA",
+              "DHE-RSA-CAMELLIA128-SHA" },
+    { 0x0084, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA",
+              "CAMELLIA256-SHA" },
+    { 0x0088, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA",
+              "DHE-RSA-CAMELLIA256-SHA" },
+    { 0x00BA, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+              "CAMELLIA128-SHA256" },
+    { 0x00BE, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+              "DHE-RSA-CAMELLIA128-SHA256" },
+    { 0x00C0, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256",
+              "CAMELLIA256-SHA256" },
+    { 0x00C4, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256",
+              "DHE-RSA-CAMELLIA256-SHA256" },
+    { 0xC037, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256",
+              "ECDHE-PSK-AES128-CBC-SHA256" },
+    { 0xC038, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384",
+              "ECDHE-PSK-AES256-CBC-SHA384" },
+    { 0xC039, "TLS_ECDHE_PSK_WITH_NULL_SHA",
+              "ECDHE-PSK-NULL-SHA" },
+    { 0xC03A, "TLS_ECDHE_PSK_WITH_NULL_SHA256",
+              "ECDHE-PSK-NULL-SHA256" },
+    { 0xC03B, "TLS_ECDHE_PSK_WITH_NULL_SHA384",
+              "ECDHE-PSK-NULL-SHA384" },
+    { 0xC03C, "TLS_RSA_WITH_ARIA_128_CBC_SHA256",
+              "ARIA128-SHA256" /* ns */ },
+    { 0xC03D, "TLS_RSA_WITH_ARIA_256_CBC_SHA384",
+              "ARIA256-SHA384" /* ns */ },
+    { 0xC044, "TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256",
+              "DHE-RSA-ARIA128-SHA256" /* ns */ },
+    { 0xC045, "TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384",
+              "DHE-RSA-ARIA256-SHA384" /* ns */ },
+    { 0xC048, "TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256",
+              "ECDHE-ECDSA-ARIA128-SHA256" /* ns */ },
+    { 0xC049, "TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384",
+              "ECDHE-ECDSA-ARIA256-SHA384" /* ns */ },
+    { 0xC04A, "TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256",
+              "ECDH-ECDSA-ARIA128-SHA256" /* ns */ },
+    { 0xC04B, "TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384",
+              "ECDH-ECDSA-ARIA256-SHA384" /* ns */ },
+    { 0xC04C, "TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256",
+              "ECDHE-ARIA128-SHA256" /* ns */ },
+    { 0xC04D, "TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384",
+              "ECDHE-ARIA256-SHA384" /* ns */ },
+    { 0xC04E, "TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256",
+              "ECDH-ARIA128-SHA256" /* ns */ },
+    { 0xC04F, "TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384",
+              "ECDH-ARIA256-SHA384" /* ns */ },
+    { 0xC050, "TLS_RSA_WITH_ARIA_128_GCM_SHA256",
+              "ARIA128-GCM-SHA256" },
+    { 0xC051, "TLS_RSA_WITH_ARIA_256_GCM_SHA384",
+              "ARIA256-GCM-SHA384" },
+    { 0xC052, "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256",
+              "DHE-RSA-ARIA128-GCM-SHA256" },
+    { 0xC053, "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384",
+              "DHE-RSA-ARIA256-GCM-SHA384" },
+    { 0xC05C, "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256",
+              "ECDHE-ECDSA-ARIA128-GCM-SHA256" },
+    { 0xC05D, "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384",
+              "ECDHE-ECDSA-ARIA256-GCM-SHA384" },
+    { 0xC05E, "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256",
+              "ECDH-ECDSA-ARIA128-GCM-SHA256" /* ns */ },
+    { 0xC05F, "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384",
+              "ECDH-ECDSA-ARIA256-GCM-SHA384" /* ns */ },
+    { 0xC060, "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256",
+              "ECDHE-ARIA128-GCM-SHA256" },
+    { 0xC061, "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384",
+              "ECDHE-ARIA256-GCM-SHA384" },
+    { 0xC062, "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256",
+              "ECDH-ARIA128-GCM-SHA256" /* ns */ },
+    { 0xC063, "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384",
+              "ECDH-ARIA256-GCM-SHA384" /* ns */ },
+    { 0xC064, "TLS_PSK_WITH_ARIA_128_CBC_SHA256",
+              "PSK-ARIA128-SHA256" /* ns */ },
+    { 0xC065, "TLS_PSK_WITH_ARIA_256_CBC_SHA384",
+              "PSK-ARIA256-SHA384" /* ns */ },
+    { 0xC066, "TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256",
+              "DHE-PSK-ARIA128-SHA256" /* ns */ },
+    { 0xC067, "TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384",
+              "DHE-PSK-ARIA256-SHA384" /* ns */ },
+    { 0xC068, "TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256",
+              "RSA-PSK-ARIA128-SHA256" /* ns */ },
+    { 0xC069, "TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384",
+              "RSA-PSK-ARIA256-SHA384" /* ns */ },
+    { 0xC06A, "TLS_PSK_WITH_ARIA_128_GCM_SHA256",
+              "PSK-ARIA128-GCM-SHA256" },
+    { 0xC06B, "TLS_PSK_WITH_ARIA_256_GCM_SHA384",
+              "PSK-ARIA256-GCM-SHA384" },
+    { 0xC06C, "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256",
+              "DHE-PSK-ARIA128-GCM-SHA256" },
+    { 0xC06D, "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384",
+              "DHE-PSK-ARIA256-GCM-SHA384" },
+    { 0xC06E, "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256",
+              "RSA-PSK-ARIA128-GCM-SHA256" },
+    { 0xC06F, "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384",
+              "RSA-PSK-ARIA256-GCM-SHA384" },
+    { 0xC070, "TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256",
+              "ECDHE-PSK-ARIA128-SHA256" /* ns */ },
+    { 0xC071, "TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384",
+              "ECDHE-PSK-ARIA256-SHA384" /* ns */ },
+    { 0xC072, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
+              "ECDHE-ECDSA-CAMELLIA128-SHA256" },
+    { 0xC073, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
+              "ECDHE-ECDSA-CAMELLIA256-SHA384" },
+    { 0xC074, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256",
+              "ECDH-ECDSA-CAMELLIA128-SHA256" /* ns */ },
+    { 0xC075, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384",
+              "ECDH-ECDSA-CAMELLIA256-SHA384" /* ns */ },
+    { 0xC076, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+              "ECDHE-RSA-CAMELLIA128-SHA256" },
+    { 0xC077, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384",
+              "ECDHE-RSA-CAMELLIA256-SHA384" },
+    { 0xC078, "TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256",
+              "ECDH-CAMELLIA128-SHA256" /* ns */ },
+    { 0xC079, "TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384",
+              "ECDH-CAMELLIA256-SHA384" /* ns */ },
+    { 0xC07A, "TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+              "CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC07B, "TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+              "CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC07C, "TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+              "DHE-RSA-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC07D, "TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+              "DHE-RSA-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC086, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
+              "ECDHE-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC087, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
+              "ECDHE-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC088, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256",
+              "ECDH-ECDSA-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC089, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384",
+              "ECDH-ECDSA-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC08A, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+              "ECDHE-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC08B, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+              "ECDHE-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC08C, "TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256",
+              "ECDH-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC08D, "TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384",
+              "ECDH-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC08E, "TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256",
+              "PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC08F, "TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384",
+              "PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC090, "TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256",
+              "DHE-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC091, "TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384",
+              "DHE-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC092, "TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256",
+              "RSA-PSK-CAMELLIA128-GCM-SHA256" /* ns */ },
+    { 0xC093, "TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384",
+              "RSA-PSK-CAMELLIA256-GCM-SHA384" /* ns */ },
+    { 0xC094, "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+              "PSK-CAMELLIA128-SHA256" },
+    { 0xC095, "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+              "PSK-CAMELLIA256-SHA384" },
+    { 0xC096, "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+              "DHE-PSK-CAMELLIA128-SHA256" },
+    { 0xC097, "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+              "DHE-PSK-CAMELLIA256-SHA384" },
+    { 0xC098, "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+              "RSA-PSK-CAMELLIA128-SHA256" },
+    { 0xC099, "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+              "RSA-PSK-CAMELLIA256-SHA384" },
+    { 0xC09A, "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256",
+              "ECDHE-PSK-CAMELLIA128-SHA256" },
+    { 0xC09B, "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384",
+              "ECDHE-PSK-CAMELLIA256-SHA384" },
+    { 0xC09E, "TLS_DHE_RSA_WITH_AES_128_CCM",
+              "DHE-RSA-AES128-CCM" },
+    { 0xC09F, "TLS_DHE_RSA_WITH_AES_256_CCM",
+              "DHE-RSA-AES256-CCM" },
+    { 0xC0A2, "TLS_DHE_RSA_WITH_AES_128_CCM_8",
+              "DHE-RSA-AES128-CCM8" },
+    { 0xC0A3, "TLS_DHE_RSA_WITH_AES_256_CCM_8",
+              "DHE-RSA-AES256-CCM8" },
+    { 0xC0A4, "TLS_PSK_WITH_AES_128_CCM",
+              "PSK-AES128-CCM" },
+    { 0xC0A5, "TLS_PSK_WITH_AES_256_CCM",
+              "PSK-AES256-CCM" },
+    { 0xC0A6, "TLS_DHE_PSK_WITH_AES_128_CCM",
+              "DHE-PSK-AES128-CCM" },
+    { 0xC0A7, "TLS_DHE_PSK_WITH_AES_256_CCM",
+              "DHE-PSK-AES256-CCM" },
+    { 0xC0A8, "TLS_PSK_WITH_AES_128_CCM_8",
+              "PSK-AES128-CCM8" },
+    { 0xC0A9, "TLS_PSK_WITH_AES_256_CCM_8",
+              "PSK-AES256-CCM8" },
+    { 0xC0AA, "TLS_PSK_DHE_WITH_AES_128_CCM_8",
+              "DHE-PSK-AES128-CCM8" },
+    { 0xC0AB, "TLS_PSK_DHE_WITH_AES_256_CCM_8",
+              "DHE-PSK-AES256-CCM8" },
+    { 0xCCAA, "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
+              "DHE-RSA-CHACHA20-POLY1305" },
+    { 0xCCAC, "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
+              "ECDHE-PSK-CHACHA20-POLY1305" },
+    { 0xCCAD, "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256",
+              "DHE-PSK-CHACHA20-POLY1305" },
+    { 0xCCAE, "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256",
+              "RSA-PSK-CHACHA20-POLY1305" },
 #endif
-};
+  };
 
-static const char *cs_test_string =
-  "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:"
-  "TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:"
-  "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:"
-  "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:"
-  "ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:"
-  "DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:"
-  "ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:"
-  "ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:"
-  "ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:"
-  "DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:"
-  "AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:"
-  "DES-CBC3-SHA:"
-  ":: GIBBERISH ::"
-;
+  static const char *cs_test_string =
+    "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:"
+    "TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:"
+    "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:"
+    "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:"
+    "ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:"
+    "DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:"
+    "ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:"
+    "ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:"
+    "ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:"
+    "DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:"
+    "AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:"
+    "DES-CBC3-SHA:"
+    ":: GIBBERISH ::"
+  ;
 
-struct test_str_entry {
-  uint16_t id;
-  const char *str;
-};
-static const struct test_str_entry test_str_list[] = {
-#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
-  { 0x1301, "TLS_AES_128_GCM_SHA256"},
-  { 0x1302, "TLS_AES_256_GCM_SHA384"},
-  { 0x1303, "TLS_CHACHA20_POLY1305_SHA256"},
-#else
-  { 0x0000, "TLS_AES_128_GCM_SHA256"},
-  { 0x0000, "TLS_AES_256_GCM_SHA384"},
-  { 0x0000, "TLS_CHACHA20_POLY1305_SHA256"},
-#endif
-  { 0xC02B, "ECDHE-ECDSA-AES128-GCM-SHA256"},
-  { 0xC02F, "ECDHE-RSA-AES128-GCM-SHA256"},
-  { 0xC02C, "ECDHE-ECDSA-AES256-GCM-SHA384"},
-  { 0xC030, "ECDHE-RSA-AES256-GCM-SHA384"},
-  { 0xCCA9, "ECDHE-ECDSA-CHACHA20-POLY1305"},
-  { 0xCCA8, "ECDHE-RSA-CHACHA20-POLY1305"},
+  struct test_str_entry {
+    uint16_t id;
+    const char *str;
+  };
+  static const struct test_str_entry test_str_list[] = {
+    { 0x1301, "TLS_AES_128_GCM_SHA256"},
+    { 0x1302, "TLS_AES_256_GCM_SHA384"},
+    { 0x1303, "TLS_CHACHA20_POLY1305_SHA256"},
+    { 0xC02B, "ECDHE-ECDSA-AES128-GCM-SHA256"},
+    { 0xC02F, "ECDHE-RSA-AES128-GCM-SHA256"},
+    { 0xC02C, "ECDHE-ECDSA-AES256-GCM-SHA384"},
+    { 0xC030, "ECDHE-RSA-AES256-GCM-SHA384"},
+    { 0xCCA9, "ECDHE-ECDSA-CHACHA20-POLY1305"},
+    { 0xCCA8, "ECDHE-RSA-CHACHA20-POLY1305"},
 #if defined(USE_MBEDTLS)
-  { 0x009E, "DHE-RSA-AES128-GCM-SHA256"},
-  { 0x009F, "DHE-RSA-AES256-GCM-SHA384"},
+    { 0x009E, "DHE-RSA-AES128-GCM-SHA256"},
+    { 0x009F, "DHE-RSA-AES256-GCM-SHA384"},
 #else
-  { 0x0000, "DHE-RSA-AES128-GCM-SHA256"},
-  { 0x0000, "DHE-RSA-AES256-GCM-SHA384"},
+    { 0x0000, "DHE-RSA-AES128-GCM-SHA256"},
+    { 0x0000, "DHE-RSA-AES256-GCM-SHA384"},
 #endif
 #if defined(USE_MBEDTLS)
-  { 0xCCAA, "DHE-RSA-CHACHA20-POLY1305"},
+    { 0xCCAA, "DHE-RSA-CHACHA20-POLY1305"},
 #else
-  { 0x0000, "DHE-RSA-CHACHA20-POLY1305"},
+    { 0x0000, "DHE-RSA-CHACHA20-POLY1305"},
 #endif
 #if defined(USE_MBEDTLS)
-  { 0xC023, "ECDHE-ECDSA-AES128-SHA256" },
-  { 0xC027, "ECDHE-RSA-AES128-SHA256" },
-  { 0xC009, "ECDHE-ECDSA-AES128-SHA" },
-  { 0xC013, "ECDHE-RSA-AES128-SHA" },
-  { 0xC024, "ECDHE-ECDSA-AES256-SHA384" },
-  { 0xC028, "ECDHE-RSA-AES256-SHA384" },
-  { 0xC00A, "ECDHE-ECDSA-AES256-SHA" },
-  { 0xC014, "ECDHE-RSA-AES256-SHA" },
+    { 0xC023, "ECDHE-ECDSA-AES128-SHA256" },
+    { 0xC027, "ECDHE-RSA-AES128-SHA256" },
+    { 0xC009, "ECDHE-ECDSA-AES128-SHA" },
+    { 0xC013, "ECDHE-RSA-AES128-SHA" },
+    { 0xC024, "ECDHE-ECDSA-AES256-SHA384" },
+    { 0xC028, "ECDHE-RSA-AES256-SHA384" },
+    { 0xC00A, "ECDHE-ECDSA-AES256-SHA" },
+    { 0xC014, "ECDHE-RSA-AES256-SHA" },
 #else
-  { 0x0000, "ECDHE-ECDSA-AES128-SHA256" },
-  { 0x0000, "ECDHE-RSA-AES128-SHA256" },
-  { 0x0000, "ECDHE-ECDSA-AES128-SHA" },
-  { 0x0000, "ECDHE-RSA-AES128-SHA" },
-  { 0x0000, "ECDHE-ECDSA-AES256-SHA384" },
-  { 0x0000, "ECDHE-RSA-AES256-SHA384" },
-  { 0x0000, "ECDHE-ECDSA-AES256-SHA" },
-  { 0x0000, "ECDHE-RSA-AES256-SHA" },
+    { 0x0000, "ECDHE-ECDSA-AES128-SHA256" },
+    { 0x0000, "ECDHE-RSA-AES128-SHA256" },
+    { 0x0000, "ECDHE-ECDSA-AES128-SHA" },
+    { 0x0000, "ECDHE-RSA-AES128-SHA" },
+    { 0x0000, "ECDHE-ECDSA-AES256-SHA384" },
+    { 0x0000, "ECDHE-RSA-AES256-SHA384" },
+    { 0x0000, "ECDHE-ECDSA-AES256-SHA" },
+    { 0x0000, "ECDHE-RSA-AES256-SHA" },
 #endif
 #if defined(USE_MBEDTLS)
-  { 0x0067, "DHE-RSA-AES128-SHA256" },
-  { 0x006B, "DHE-RSA-AES256-SHA256" },
+    { 0x0067, "DHE-RSA-AES128-SHA256" },
+    { 0x006B, "DHE-RSA-AES256-SHA256" },
 #else
-  { 0x0000, "DHE-RSA-AES128-SHA256" },
-  { 0x0000, "DHE-RSA-AES256-SHA256" },
+    { 0x0000, "DHE-RSA-AES128-SHA256" },
+    { 0x0000, "DHE-RSA-AES256-SHA256" },
 #endif
 #if defined(USE_MBEDTLS)
-  { 0x009C, "AES128-GCM-SHA256" },
-  { 0x009D, "AES256-GCM-SHA384" },
-  { 0x003C, "AES128-SHA256" },
-  { 0x003D, "AES256-SHA256" },
-  { 0x002F, "AES128-SHA" },
-  { 0x0035, "AES256-SHA" },
+    { 0x009C, "AES128-GCM-SHA256" },
+    { 0x009D, "AES256-GCM-SHA384" },
+    { 0x003C, "AES128-SHA256" },
+    { 0x003D, "AES256-SHA256" },
+    { 0x002F, "AES128-SHA" },
+    { 0x0035, "AES256-SHA" },
 #else
-  { 0x0000, "AES128-GCM-SHA256" },
-  { 0x0000, "AES256-GCM-SHA384" },
-  { 0x0000, "AES128-SHA256" },
-  { 0x0000, "AES256-SHA256" },
-  { 0x0000, "AES128-SHA" },
-  { 0x0000, "AES256-SHA" },
+    { 0x0000, "AES128-GCM-SHA256" },
+    { 0x0000, "AES256-GCM-SHA384" },
+    { 0x0000, "AES128-SHA256" },
+    { 0x0000, "AES256-SHA256" },
+    { 0x0000, "AES128-SHA" },
+    { 0x0000, "AES256-SHA" },
 #endif
-  { 0x0000, "DES-CBC3-SHA" },
-  { 0x0000, "GIBBERISH" },
-  { 0x0000, "" },
-};
+    { 0x0000, "DES-CBC3-SHA" },
+    { 0x0000, "GIBBERISH" },
+    { 0x0000, "" },
+  };
 
-UNITTEST_START
-{
-  for(size_t i = 0; i < CURL_ARRAYSIZE(test_cs_list); i++) {
+  size_t i;
+  for(i = 0; i < CURL_ARRAYSIZE(test_cs_list); i++) {
     const struct test_cs_entry *test = &test_cs_list[i];
     const char *expect;
     char buf[64] = "";
@@ -596,13 +577,13 @@ UNITTEST_START
   /* test Curl_cipher_suite_walk_str() */
   {
     const char *ptr, *end = cs_test_string;
-    int i = 0;
+    int j = 0;
     uint16_t id;
     size_t len;
 
     for(ptr = cs_test_string; ptr[0] != '\0'; ptr = end) {
-      const struct test_str_entry *test = &test_str_list[i];
-      abort_if(i == CURL_ARRAYSIZE(test_str_list), "should have been done");
+      const struct test_str_entry *test = &test_str_list[j];
+      abort_if(j == CURL_ARRAYSIZE(test_str_list), "should have been done");
 
       id = Curl_cipher_suite_walk_str(&ptr, &end);
       len = end - ptr;
@@ -621,15 +602,10 @@ UNITTEST_START
         unitfail++;
         goto unit_test_abort;
       }
-      i++;
+      j++;
     }
   }
-}
-UNITTEST_STOP
-
-#else /* defined(USE_MBEDTLS) */
-
-UNITTEST_START
-UNITTEST_STOP
-
 #endif /* defined(USE_MBEDTLS) || defined(USE_RUSTLS) */
+
+  UNITTEST_END_SIMPLE
+}
index c9c15ca6d59ccc4612dc5435bb4c81ba33ccb827..0cf6565fc92cd8f50e4bd2954f02431641f94aaa 100644 (file)
 #include "uint-bset.h"
 #include "curl_trc.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static unsigned int s1[] = {  /* spread numbers, some at slot edges */
-  0, 1, 4, 17, 63, 64, 65, 66,
-  90, 99,
-};
-static unsigned int s2[] = { /* set with all bits in slot1 set */
-  64, 65, 66, 67, 68, 69, 70, 71,
-  72, 73, 74, 75, 76, 77, 78, 79,
-  80, 81, 82, 83, 84, 85, 86, 87,
-  88, 89, 90, 91, 92, 93, 94, 95,
-  96, 97, 98, 99, 100, 101, 102, 103,
-  104, 105, 106, 107, 108, 109, 110, 111,
-  112, 113, 114, 115, 116, 117, 118, 119,
-  120, 121, 122, 123, 124, 125, 126, 127,
-};
-
 static void check_set(const char *name, unsigned int capacity,
-                      unsigned int *s, size_t slen)
+                      const unsigned int *s, size_t slen)
 {
   struct uint_bset bset;
   size_t i, j;
@@ -140,14 +120,27 @@ static void check_set(const char *name, unsigned int capacity,
   Curl_uint_bset_destroy(&bset);
 }
 
-static void unit_stop(void)
+static CURLcode test_unit3211(char *arg)
 {
-}
-
-
-UNITTEST_START
+  UNITTEST_BEGIN_SIMPLE
+
+  static const unsigned int s1[] = {  /* spread numbers, some at slot edges */
+    0, 1, 4, 17, 63, 64, 65, 66,
+    90, 99,
+  };
+  static const unsigned int s2[] = { /* set with all bits in slot1 set */
+    64, 65, 66, 67, 68, 69, 70, 71,
+    72, 73, 74, 75, 76, 77, 78, 79,
+    80, 81, 82, 83, 84, 85, 86, 87,
+    88, 89, 90, 91, 92, 93, 94, 95,
+    96, 97, 98, 99, 100, 101, 102, 103,
+    104, 105, 106, 107, 108, 109, 110, 111,
+    112, 113, 114, 115, 116, 117, 118, 119,
+    120, 121, 122, 123, 124, 125, 126, 127,
+  };
 
   check_set("s1", 100, s1, CURL_ARRAYSIZE(s1));
   check_set("s2", 1000, s2, CURL_ARRAYSIZE(s2));
 
-UNITTEST_STOP
+  UNITTEST_END_SIMPLE
+}
index 977dccfd4d167c9cebe227668510dd01d7a6bf3a..9ffa85ca4be4e78a7709ee45f47eed56f271b666 100644 (file)
 
 #define TBL_SIZE    100
 
-static struct uint_tbl tbl;
-
-static int dummy;
-
-static CURLcode unit_setup(void)
+static CURLcode t3212_setup(struct uint_tbl *tbl)
 {
-  Curl_uint_tbl_init(&tbl, NULL);
-  return Curl_uint_tbl_resize(&tbl, TBL_SIZE);
+  Curl_uint_tbl_init(tbl, NULL);
+  return Curl_uint_tbl_resize(tbl, TBL_SIZE);
 }
 
-static void unit_stop(void)
+static void t3212_stop(struct uint_tbl *tbl)
 {
-  Curl_uint_tbl_destroy(&tbl);
+  Curl_uint_tbl_destroy(tbl);
 }
 
-static void check3212(void)
+static CURLcode test_unit3212(char *arg)
 {
+  struct uint_tbl tbl;
+  int dummy;
+
+  UNITTEST_BEGIN(t3212_setup(&tbl))
+
   unsigned int i, key, n;
   void *entry;
 
@@ -127,10 +128,6 @@ static void check3212(void)
   Curl_uint_tbl_remove(&tbl, 17);
   fail_unless(Curl_uint_tbl_add(&tbl, &dummy, &key), "failed to add again");
   fail_unless(key == 17, "unexpected key assigned");
-}
-
-UNITTEST_START
 
-check3212();
-
-UNITTEST_STOP
+  UNITTEST_END(t3212_stop(&tbl))
+}
index eb4eaa6c7397946101ba209865e6189f79c74cc8..96c3a564ad6111f20467e10f2e33b458c030bc27 100644 (file)
 #include "uint-spbset.h"
 #include "curl_trc.h"
 
-static CURLcode unit_setup(void)
-{
-  return CURLE_OK;
-}
-
-static unsigned int s1_3213[] = {  /* spread numbers, some at slot edges */
-  0, 1, 4, 17, 63, 64, 65, 66,
-  90, 99,
-};
-static unsigned int s2_3213[] = { /* set with all bits in slot1 set */
-  64, 65, 66, 67, 68, 69, 70, 71,
-  72, 73, 74, 75, 76, 77, 78, 79,
-  80, 81, 82, 83, 84, 85, 86, 87,
-  88, 89, 90, 91, 92, 93, 94, 95,
-  96, 97, 98, 99, 100, 101, 102, 103,
-  104, 105, 106, 107, 108, 109, 110, 111,
-  112, 113, 114, 115, 116, 117, 118, 119,
-  120, 121, 122, 123, 124, 125, 126, 127,
-};
-static unsigned int s3_3213[] = {  /* very spread numbers */
-  2232, 5167, 8204, 8526, 8641, 10056, 10140, 10611,
-  10998, 11626, 13735, 15539, 17947, 24295, 27833, 30318,
-};
-
-static void check_spbset(const char *name, unsigned int *s, size_t slen)
+static void check_spbset(const char *name, const unsigned int *s, size_t slen)
 {
   struct uint_spbset bset;
   size_t i, j;
@@ -113,15 +89,32 @@ static void check_spbset(const char *name, unsigned int *s, size_t slen)
   Curl_uint_spbset_destroy(&bset);
 }
 
-static void unit_stop(void)
+static CURLcode test_unit3213(char *arg)
 {
+  UNITTEST_BEGIN_SIMPLE
+
+  static const unsigned int s1[] = { /* spread numbers, some at slot edges */
+    0, 1, 4, 17, 63, 64, 65, 66,
+    90, 99,
+  };
+  static const unsigned int s2[] = { /* set with all bits in slot1 set */
+    64, 65, 66, 67, 68, 69, 70, 71,
+    72, 73, 74, 75, 76, 77, 78, 79,
+    80, 81, 82, 83, 84, 85, 86, 87,
+    88, 89, 90, 91, 92, 93, 94, 95,
+    96, 97, 98, 99, 100, 101, 102, 103,
+    104, 105, 106, 107, 108, 109, 110, 111,
+    112, 113, 114, 115, 116, 117, 118, 119,
+    120, 121, 122, 123, 124, 125, 126, 127,
+  };
+  static const unsigned int s3[] = {  /* very spread numbers */
+    2232, 5167, 8204, 8526, 8641, 10056, 10140, 10611,
+    10998, 11626, 13735, 15539, 17947, 24295, 27833, 30318,
+  };
+
+  check_spbset("s1", s1, CURL_ARRAYSIZE(s1));
+  check_spbset("s2", s2, CURL_ARRAYSIZE(s2));
+  check_spbset("s3", s3, CURL_ARRAYSIZE(s3));
+
+  UNITTEST_END_SIMPLE
 }
-
-
-UNITTEST_START
-
-  check_spbset("s1", s1_3213, CURL_ARRAYSIZE(s1_3213));
-  check_spbset("s2", s2_3213, CURL_ARRAYSIZE(s2_3213));
-  check_spbset("s3", s3_3213, CURL_ARRAYSIZE(s3_3213));
-
-UNITTEST_STOP