diff options
| author | Kenjiro Nakayama <nakayamakenjiro@gmail.com> | 2026-07-18 15:19:03 +0900 |
|---|---|---|
| committer | Kenjiro Nakayama <nakayamakenjiro@gmail.com> | 2026-07-18 15:38:45 +0900 |
| commit | bb72ae26c912e28ea828891ee1a721b831c10d59 (patch) | |
| tree | e5c4c02a6a45a79c3bf2f9522dd0baa2e438e132 | |
| parent | f3df640db86aa89a5bc3239e3b7c5db90bfc2aa3 (diff) | |
| download | portable-bb72ae26c912e28ea828891ee1a721b831c10d59.tar.gz portable-bb72ae26c912e28ea828891ee1a721b831c10d59.tar.bz2 portable-bb72ae26c912e28ea828891ee1a721b831c10d59.zip | |
Run x509_verify only when perl is available
The x509_verify wrapper uses make-dir-roots.pl to prepare the
hashed CApath roots directory. This introduced a perl dependency
for running the test suite from release tarballs.
Detect perl during configure and CMake configuration, and only
register x509_verify when perl is available.
| -rw-r--r-- | CMakeLists.txt | 1 | ||||
| -rw-r--r-- | configure.ac | 3 | ||||
| -rw-r--r-- | tests/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | tests/Makefile.am | 3 | ||||
| -rwxr-xr-x | tests/x509_verify.sh | 6 |
5 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a7e97d9..3a23b98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -32,6 +32,7 @@ include(cmake_export_symbol) | |||
| 32 | include(GNUInstallDirs) | 32 | include(GNUInstallDirs) |
| 33 | 33 | ||
| 34 | enable_testing() | 34 | enable_testing() |
| 35 | find_program(PERL_EXECUTABLE perl perl5) | ||
| 35 | 36 | ||
| 36 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/ssl/VERSION SSL_VERSION) | 37 | file(READ ${CMAKE_CURRENT_SOURCE_DIR}/ssl/VERSION SSL_VERSION) |
| 37 | string(STRIP ${SSL_VERSION} SSL_VERSION) | 38 | string(STRIP ${SSL_VERSION} SSL_VERSION) |
diff --git a/configure.ac b/configure.ac index c0ad033..9012535 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -32,6 +32,9 @@ AC_PROG_CC([cc gcc]) | |||
| 32 | AM_PROG_CC_C_O | 32 | AM_PROG_CC_C_O |
| 33 | LT_INIT([pic-only]) | 33 | LT_INIT([pic-only]) |
| 34 | 34 | ||
| 35 | AC_CHECK_PROGS([PERL], [perl perl5]) | ||
| 36 | AM_CONDITIONAL([HAVE_PERL], [test "x$PERL" != x]) | ||
| 37 | |||
| 35 | CHECK_OS_OPTIONS | 38 | CHECK_OS_OPTIONS |
| 36 | 39 | ||
| 37 | CHECK_C_HARDENING_OPTIONS | 40 | CHECK_C_HARDENING_OPTIONS |
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c1f32a4..5aaebd9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt | |||
| @@ -935,11 +935,11 @@ add_platform_test(valid_handshakes_terminate valid_handshakes_terminate) | |||
| 935 | add_executable(x509_verify x509_verify.c) | 935 | add_executable(x509_verify x509_verify.c) |
| 936 | target_link_libraries(x509_verify ${OPENSSL_TEST_LIBS}) | 936 | target_link_libraries(x509_verify ${OPENSSL_TEST_LIBS}) |
| 937 | add_dependencies(x509_verify openssl) | 937 | add_dependencies(x509_verify openssl) |
| 938 | if(NOT WIN32 AND NOT EMSCRIPTEN) | 938 | if(NOT WIN32 AND NOT EMSCRIPTEN AND PERL_EXECUTABLE) |
| 939 | add_test(NAME x509_verify COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/x509_verify.sh | 939 | add_test(NAME x509_verify COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/x509_verify.sh |
| 940 | $<TARGET_FILE:x509_verify> $<TARGET_FILE:openssl>) | 940 | $<TARGET_FILE:x509_verify> $<TARGET_FILE:openssl>) |
| 941 | set_tests_properties(x509_verify PROPERTIES | 941 | set_tests_properties(x509_verify PROPERTIES |
| 942 | ENVIRONMENT "srcdir=${TEST_SOURCE_DIR}" | 942 | ENVIRONMENT "srcdir=${TEST_SOURCE_DIR};PERL=${PERL_EXECUTABLE}" |
| 943 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | 943 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) |
| 944 | # This test depends on certificate times that can exceed 32-bit time_t | 944 | # This test depends on certificate times that can exceed 32-bit time_t |
| 945 | # range, so match the existing time tests and expect failure there. | 945 | # range, so match the existing time tests and expect failure there. |
diff --git a/tests/Makefile.am b/tests/Makefile.am index 6373934..96a850f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am | |||
| @@ -94,6 +94,7 @@ libtest_la_SOURCES = empty.c | |||
| 94 | 94 | ||
| 95 | LDADD = libtest.la $(PLATFORM_LDADD) $(PROG_LDADD) | 95 | LDADD = libtest.la $(PLATFORM_LDADD) $(PROG_LDADD) |
| 96 | 96 | ||
| 97 | TESTS_ENVIRONMENT = PERL='$(PERL)' | ||
| 97 | TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh | 98 | TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh |
| 98 | 99 | ||
| 99 | TESTS = | 100 | TESTS = |
| @@ -919,6 +920,7 @@ check_PROGRAMS += valid_handshakes_terminate | |||
| 919 | valid_handshakes_terminate_SOURCES = valid_handshakes_terminate.c | 920 | valid_handshakes_terminate_SOURCES = valid_handshakes_terminate.c |
| 920 | 921 | ||
| 921 | # x509_verify | 922 | # x509_verify |
| 923 | if HAVE_PERL | ||
| 922 | # This test depends on certificate times that can exceed 32-bit time_t | 924 | # This test depends on certificate times that can exceed 32-bit time_t |
| 923 | # range, so match the existing time tests and expect failure there. | 925 | # range, so match the existing time tests and expect failure there. |
| 924 | if SMALL_TIME_T | 926 | if SMALL_TIME_T |
| @@ -926,6 +928,7 @@ XFAIL_TESTS += x509_verify.sh | |||
| 926 | endif | 928 | endif |
| 927 | TESTS += x509_verify.sh | 929 | TESTS += x509_verify.sh |
| 928 | check_PROGRAMS += x509_verify | 930 | check_PROGRAMS += x509_verify |
| 931 | endif | ||
| 929 | x509_verify_SOURCES = x509_verify.c | 932 | x509_verify_SOURCES = x509_verify.c |
| 930 | EXTRA_DIST += x509_verify.sh | 933 | EXTRA_DIST += x509_verify.sh |
| 931 | EXTRA_DIST += make-dir-roots.pl | 934 | EXTRA_DIST += make-dir-roots.pl |
diff --git a/tests/x509_verify.sh b/tests/x509_verify.sh index cc5446c..b43063f 100755 --- a/tests/x509_verify.sh +++ b/tests/x509_verify.sh | |||
| @@ -20,6 +20,10 @@ if [ -z "$srcdir" ]; then | |||
| 20 | srcdir=. | 20 | srcdir=. |
| 21 | fi | 21 | fi |
| 22 | 22 | ||
| 23 | if [ -z "$PERL" ]; then | ||
| 24 | PERL=perl | ||
| 25 | fi | ||
| 26 | |||
| 23 | case "$srcdir" in | 27 | case "$srcdir" in |
| 24 | /*) | 28 | /*) |
| 25 | certs_path="$srcdir/certs" | 29 | certs_path="$srcdir/certs" |
| @@ -69,7 +73,7 @@ trap cleanup EXIT | |||
| 69 | rm -rf "$workdir" | 73 | rm -rf "$workdir" |
| 70 | mkdir "$workdir" | 74 | mkdir "$workdir" |
| 71 | 75 | ||
| 72 | perl "$make_dir_roots" "$certs_path" "$workdir" | 76 | "$PERL" "$make_dir_roots" "$certs_path" "$workdir" |
| 73 | 77 | ||
| 74 | ( | 78 | ( |
| 75 | cd "$workdir" | 79 | cd "$workdir" |
