From 2d4852af83c9e8c4db979a9f0d328f253ad64c0b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 9 Dec 2024 01:57:32 +0100 Subject: [PATCH] build: fix tests when documentation/manual is disabled - build: fix to exclude 'documentation' tests when building the documentation is explicitly disabled. Both for cmake and `./configure`. Reported-by: Daniel Engberg Fixes #15703 - test481, test482: fix for builds with no manual. Reported-by: Daniel Engberg Fixes #15703 - configure: fix to always detect Perl. Running tests require it when run. Before this patch Perl wasn't detected when documentation/manual/embedded-CA were all disabled, making tests fail to start. - test1177: add keyword `documentation`. It depends no `curl_version_info.3`. - GHA/linux: test cmake and `./configure` with docs and manual disabled and tests run. Closes #15704 --- .github/workflows/linux.yml | 4 ++-- configure.ac | 8 ++++---- tests/CMakeLists.txt | 3 +++ tests/Makefile.am | 5 +++++ tests/data/test1177 | 1 + tests/data/test481 | 4 ++++ tests/data/test482 | 4 ++++ 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a169a0f747..ee06e069eb 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -119,7 +119,7 @@ jobs: - name: mbedtls-pkg install_packages: libnghttp2-dev libmbedtls-dev - generate: -DCURL_USE_MBEDTLS=ON -DENABLE_DEBUG=ON + generate: -DCURL_USE_MBEDTLS=ON -DENABLE_DEBUG=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF - name: mbedtls-pkg !pc install_packages: libnghttp2-dev libmbedtls-dev @@ -167,7 +167,7 @@ jobs: - name: openssl clang krb5 install_packages: zlib1g-dev libkrb5-dev clang - configure: CC=clang --with-openssl --with-gssapi --enable-debug + configure: CC=clang --with-openssl --with-gssapi --enable-debug --disable-docs --disable-manual - name: openssl clang krb5 install_packages: zlib1g-dev libkrb5-dev clang diff --git a/configure.ac b/configure.ac index fa6c6198a2..e3ecf00c61 100644 --- a/configure.ac +++ b/configure.ac @@ -4215,11 +4215,11 @@ fi CURL_CHECK_NONBLOCKING_SOCKET -if test "x$BUILD_DOCS" != "x0" -o "x$USE_MANUAL" != "x0" -o "x$CURL_CA_EMBED" != "x"; then - AC_PATH_PROG(PERL, perl,, - $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin) - AC_SUBST(PERL) +AC_PATH_PROG(PERL, perl,, + $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin) +AC_SUBST(PERL) +if test "x$BUILD_DOCS" != "x0" -o "x$USE_MANUAL" != "x0" -o "x$CURL_CA_EMBED" != "x"; then if test -z "$PERL"; then AC_MSG_ERROR([perl was not found, needed for docs, manual and CA embed]) fi diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 165b49dfef..0e40b2e192 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -43,6 +43,9 @@ function(add_runtests _targetname _test_flags) if(CURL_TEST_BUNDLES) set(_test_flags "${_test_flags} -bundle") endif() + if(NOT BUILD_LIBCURL_DOCS) + set(_test_flags "${_test_flags} !documentation") + endif() # Skip walking through dependent targets before running tests in CI. # This avoids: GNU Make doing a slow re-evaluation of all targets and # skipping them, MSBuild doing a re-evaluation, and actually rebuilding them. diff --git a/tests/Makefile.am b/tests/Makefile.am index 56329f4a8a..46d58fed85 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -128,6 +128,11 @@ if USE_TEST_BUNDLES TEST_COMMON += -bundle endif +if BUILD_DOCS +else +TEST_COMMON += !documentation +endif + TEST = srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl $(TEST_COMMON) TEST_Q = -a -s TEST_AM = -a -am diff --git a/tests/data/test1177 b/tests/data/test1177 index 6cc94a5b1d..c1f6d661c8 100644 --- a/tests/data/test1177 +++ b/tests/data/test1177 @@ -3,6 +3,7 @@ source analysis CURL_VERSION +documentation diff --git a/tests/data/test481 b/tests/data/test481 index f59fec2f9f..33e7734bcf 100644 --- a/tests/data/test481 +++ b/tests/data/test481 @@ -39,7 +39,11 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER --no-clobber -C 1 -o "%LOGDIR/%TESTNUMBER" curl: --continue-at is mutually exclusive with --no-clobber curl: option -C: is badly used here +%if manual curl: try 'curl --help' or 'curl --manual' for more information +%else +curl: try 'curl --help' for more information +%endif diff --git a/tests/data/test482 b/tests/data/test482 index ce7f8f2b41..9b34ca9c4b 100644 --- a/tests/data/test482 +++ b/tests/data/test482 @@ -35,7 +35,11 @@ http://non-existing-host.haxx.se. --remove-on-error -C 1 -o "%LOGDIR/%TESTNUMBER curl: --continue-at is mutually exclusive with --remove-on-error curl: option -C: is badly used here +%if manual curl: try 'curl --help' or 'curl --manual' for more information +%else +curl: try 'curl --help' for more information +%endif