From 7f39dda15a1232ae253680c07a17a0845c365ef1 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Sat, 25 May 2024 20:10:43 +0200 Subject: Clean up the time_t test mess The RFC 5280 test now passes also with small time_t. The ASN.1 time test now has a test case that makes it fail for small time t. In that case use a wrapper script that prins why the test is expected to fail and makes the test suite fail if it passes. --- tests/CMakeLists.txt | 9 ++++----- tests/Makefile.am | 14 ++++++++------ tests/asn1time_small.test | 10 ++++++++++ tests/rfc5280time_small.test | 10 ---------- 4 files changed, 22 insertions(+), 21 deletions(-) create mode 100755 tests/asn1time_small.test delete mode 100755 tests/rfc5280time_small.test diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6861bd3..3497cb5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -101,6 +101,9 @@ add_test(asn1test asn1test) add_executable(asn1time asn1time.c) target_link_libraries(asn1time ${OPENSSL_TEST_LIBS}) add_test(asn1time asn1time) +if(SMALL_TIME_T) + set_property(TEST asn1time PROPERTY WILL_FAIL TRUE) +endif() # asn1x509 add_executable(asn1x509 asn1x509.c) @@ -584,11 +587,7 @@ add_test(rfc3779 rfc3779) # rfc5280time add_executable(rfc5280time rfc5280time.c) target_link_libraries(rfc5280time ${OPENSSL_TEST_LIBS}) -if(SMALL_TIME_T) - add_test(rfc5280time ${CMAKE_CURRENT_SOURCE_DIR}/rfc5280time_small.test) -else() - add_test(rfc5280time rfc5280time) -endif() +add_test(rfc5280time rfc5280time) # rmd_test add_executable(rmd_test rmd_test.c) diff --git a/tests/Makefile.am b/tests/Makefile.am index 57e2acf..0e19106 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,6 +32,7 @@ LDADD = libtest.la $(PLATFORM_LDADD) $(PROG_LDADD) TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh TESTS = +XFAIL_TESTS = check_PROGRAMS = EXTRA_DIST = CMakeLists.txt DISTCLEANFILES = pidwraptest.txt @@ -119,9 +120,15 @@ check_PROGRAMS += asn1test asn1test_SOURCES = asn1test.c # asn1time -TESTS += asn1time check_PROGRAMS += asn1time asn1time_SOURCES = asn1time.c +if SMALL_TIME_T +TESTS += asn1time_small.test +XFAIL_TESTS += asn1time_small.test +else +TESTS += asn1time +endif +EXTRA_DIST += asn1time_small.test # asn1x509 TESTS += asn1x509 @@ -617,12 +624,7 @@ rfc3779_SOURCES = rfc3779.c # rfc5280time check_PROGRAMS += rfc5280time rfc5280time_SOURCES = rfc5280time.c -if SMALL_TIME_T -TESTS += rfc5280time_small.test -else TESTS += rfc5280time -endif -EXTRA_DIST += rfc5280time_small.test # rmd_test TESTS += rmd_test diff --git a/tests/asn1time_small.test b/tests/asn1time_small.test new file mode 100755 index 0000000..94fbebf --- /dev/null +++ b/tests/asn1time_small.test @@ -0,0 +1,10 @@ +#!/bin/sh +echo 1..1 +TEST=./asn1time +if [ -e ./asn1time.exe ]; then + TEST=./asn1time.exe +fi + +# map test failure to XFAIL and success to XPASS +$TEST || echo -n "not " +echo "ok # this system is unable to represent times past 2038" diff --git a/tests/rfc5280time_small.test b/tests/rfc5280time_small.test deleted file mode 100755 index 3730597..0000000 --- a/tests/rfc5280time_small.test +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e -echo 1..2 -TEST=./rfc5280time -if [ -e ./rfc5280time.exe ]; then - TEST=./rfc5280time.exe -fi -$TEST -echo "ok 1" -echo "ok 2 - rfc5280time_64-bit # SKIP this system is unable to represent times past 2038" -- cgit v1.2.3-55-g6feb