aboutsummaryrefslogtreecommitdiffstats
path: root/test/testutil
Commit message (Collapse)AuthorAgeFilesLines
* mfail: add sampled and count-only modes to test driverJakub Zelenka2026-07-131-3/+25
| | | | | | | | | | | | | | Sampled tests cap allocation-failure injection at a fixed number of sampled points, running exhaustively when the allocation count is below that. Non-sampled tests fall back to counting only on non-cached-fetch builds, where exhaustive injection is impractical. Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Nikola Pajkovsky <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Mon Jul 13 09:43:50 2026 (Merged from https://github.com/openssl/openssl/pull/31780)
* Simplify printf-attribute guards in bio.h.in and test/testutil/output.h.Bob Beck2026-07-101-22/+9
| | | | | | | | | | | | | | | | Now that C99 is the base level, and we are no longer supporting old GCC's, The ossl_bio__printf__ / ossl_test__printf__ indirection only existed to pick the gnu_printf attribute over the printf attribute for MinGW's MS-CRT printf, but MinGW is already excluded by the outer guard, so we can use the modern attribute everywhere this code runs. Spotted by idrassi on review, thanks!. Reviewed-by: Milan Broz <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Neil Horman <[email protected]> MergeDate: Fri Jul 10 11:47:19 2026 (Merged from https://github.com/openssl/openssl/pull/31677)
* mfail: add hard failure return code for failing even for NO_CHECKJakub Zelenka2026-06-111-1/+6
| | | | | | | | | | The hard failure return code is meant for NO_CHECK variants to fail if there is some failure that should never happen and likely signal a bug. Reviewed-by: Norbert Pocs <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jun 11 16:00:15 2026 (Merged from https://github.com/openssl/openssl/pull/31356)
* mfail: do not count allocations for no file when checkedJakub Zelenka2026-06-111-1/+1
| | | | | | | | | This skips some debug and error allocations that cannot be handled Reviewed-by: Norbert Pocs <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jun 11 16:00:14 2026 (Merged from https://github.com/openssl/openssl/pull/31356)
* mfail: add all tests iterable variantsJakub Zelenka2026-06-111-11/+26
| | | | | | | | | | It adds ADD_MFAIL_ALL_TESTS and ADD_MFAIL_ALL_NO_CHECK_TESTS that work in similar way as ADD_ALL_TESTS but with mfail testing. Reviewed-by: Norbert Pocs <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jun 11 16:00:12 2026 (Merged from https://github.com/openssl/openssl/pull/31356)
* Split mfail output into counting and injection subtestsJakub Zelenka2026-05-281-37/+60
| | | | | | | | | | | Counting now always runs and is always checked, including when hooks are not installed or skip-all is set. Only injection is skipped in those cases. Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Matt Caswell <[email protected]> MergeDate: Thu May 28 07:33:05 2026 (Merged from https://github.com/openssl/openssl/pull/31219)
* Extend and separate mfail test frameworkJakub Zelenka2026-05-184-213/+71
| | | | | | | | | | | | | | | | | | | | | Separate the mfail framework so it can be used beyond testutil. Specifically, this is a step toward using it in fuzzing. This change also improves the way mfail tests are executed. It first counts the number of allocations and then iterates through them. This has a couple of advantages: - It allows removal of MFAIL_SLOW_TEST by identifying slow tests based on the number of allocations. - It allows non-failing tests to be ignored. In addition, it adds a new environment variable to print a backtrace on memory failure. Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> MergeDate: Mon May 18 07:23:52 2026 (Merged from https://github.com/openssl/openssl/pull/31144)
* CRL: Refactoring and tests for extensions, entries, and serial number duplicatesDaniel Kubec2026-05-131-0/+21
| | | | | | | | | | | | | | | Refactoring and added tests for extensions, entries, and serial number duplicates. The tests intentionally reflect the current behavior and existing error states, which are not always clearly distinguished (e.g., duplicate extensions vs. parsing errors). This serves as a baseline; follow-up work may improve error handling or explicitly mark some cases as wontfix. Signed-off-by: Daniel Kubec <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Matt Caswell <[email protected]> MergeDate: Wed May 13 07:36:49 2026 (Merged from https://github.com/openssl/openssl/pull/30349)
* Add memory allocation failure testing frameworkJakub Zelenka2026-04-234-2/+231
| | | | | | | | | | | | | | | | | | | | | | | Introduce ADD_MFAIL_TEST for exhaustive testing of allocation failure handling in individual functions. The framework repeatedly calls the test function, each time failing one allocation later within the section bracketed by mfail_start() and mfail_end(), verifying that every failure path returns 0 without crashing or leaking. Custom allocators are installed once at startup via CRYPTO_set_mem_functions(). When not armed, they pass through to malloc/realloc/free. Installation can be disabled by setting OPENSSL_TEST_MFAIL_DISABLE for tests that need the default allocator (e.g. those using OPENSSL_MALLOC_FAILURES). Additional environment variables control test execution: OPENSSL_TEST_MFAIL_SKIP_ALL, OPENSSL_TEST_MFAIL_SKIP_SLOW, OPENSSL_TEST_MFAIL_POINT, and OPENSSL_TEST_MFAIL_START. Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Matt Caswell <[email protected]> MergeDate: Thu Apr 23 20:23:34 2026 (Merged from https://github.com/openssl/openssl/pull/30871)
* fix BIO_vsnprintf() with NULL string arg crash on Solaris 10Alexandr Nedvedicky2026-04-101-2/+4
| | | | | | | | | | | Issue was kindly reported and fixes suggested by @rainerjung Fixes #30402 Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Fri Apr 10 12:22:44 2026 (Merged from https://github.com/openssl/openssl/pull/30596)
* Copyright year updatesopenssl-machine2026-03-103-3/+3
| | | | | | | Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Eugene Syromiatnikov <[email protected]> MergeDate: Tue Mar 10 14:37:54 2026 Release: yes
* Allow testing the valgrind suppression file in CIBob Beck2026-02-101-0/+27
| | | | | | | | | | | | | | | Skip the OPENSSL_cleanup() call from the openssl app and in tests when OSSL_USE_VALGRIND environment variable is set. This can be used in the CI to test the valgrind suppressions. Builds upon https://github.com/openssl/openssl/pull/29573 Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Tue Feb 10 14:00:54 2026 (Merged from https://github.com/openssl/openssl/pull/29575)
* Fix const spec in testMilan Broz2026-02-051-2/+2
| | | | | | | | | | | | | This patch fixes several const specifiers and unneeded casts (visible with non-default const-qual warning). Signed-off-by: Milan Broz <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> MergeDate: Thu Feb 5 09:13:46 2026 (Merged from https://github.com/openssl/openssl/pull/29800)
* ASN.1: Raise additional errors in crl_set_issuers()Daniel Kubec2026-02-032-19/+93
| | | | | | | | | | Additional ASN.1 parsing errors are now raised to the error stack, allowing invalid CRLs to be rejected early with detailed error messages. Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Tue Feb 3 09:02:15 2026 (Merged from https://github.com/openssl/openssl/pull/29750)
* test: get rid of the TEST_strn2_ functionsPauli2026-01-151-8/+8
| | | | | | | | | | Their semantics are poorly defined and they are rarely used. The _ne version being completely unused & tricky to define properly. Reviewed-by: Norbert Pocs <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> Reviewed-by: Frederik Wedel-Heinen <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29627)
* Update NEWS.mdSashan2025-12-191-0/+2
| | | | | | | | Co-authored-by: Matt Caswell <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29385)
* ASN1: Reject negative BIGNUM componentsDaniel Kubec2025-12-121-0/+19
| | | | | | | | | | | | | In the ASN.1 structures we define the BIGNUM as positive and enforce this during parsing. If the encoded value is negative, we raise an error and reject the material. Fixes #29210 Fixes #27407 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29370)
* 4.0-POST-CLANG-FORMAT-WEBKIT4.0-POST-CLANG-FORMAT-WEBKITBob Beck2025-12-0915-301/+296
| | | | | | | Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29242)
* apps: Remove opt_legacy_okay functionNorbert Pocs2025-12-041-7/+0
| | | | | | | | | | | | | | | | The function used to check for ENGINEs to determine if a legacy code path is available, but it makes no sense to keep it after the ENGINE removal, as the legacy path will always fail. Signed-off-by: Norbert Pocs <[email protected]> Reviewed-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/29305)
* Adapt the tests to not care about failures from platform gmtime()Bob Beck2025-10-211-69/+17
| | | | | | | | | | | | | | | | | | | | | Now that we don't use gmtime, timegm and friends from the platform we should be able to handle all values the same on any platform with no concerns other than what the platform has decided to use for time_t. The hpux #ifdef is removed, as looking at f5e3115361f shows this was added due to a gmtime() failure on the platform. This then clears out all the platform specific chaos in helper.c as an example of why the public API being added is actually generally useful, as it has been noticed that users of OpenSSL frequently end up dealing with the same issues in the same really awful ways in their own software as were were doing in that file in the tests. Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28748)
* Move handy test functions to testutilNikola Pajkovsky2025-10-161-0/+54
| | | | | | | | Signed-off-by: Nikola Pajkovsky <[email protected]> Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28599)
* Updated SSL Trace to display the name for all MLKEM-based groupsRyan Hooper2025-09-181-0/+88
| | | | | | | | | | | Make SSL Trace to display the name of the MLKEM512, MLKEM768, MLKEM1024 and SecP384r1MLKEM1024 groups. Fixes #28476 Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28499)
* apps: introduce app_malloc_array()Eugene Syromiatnikov2025-09-071-0/+15
| | | | | | | | | | | | Similar to app_malloc(), provides a wrapper for OPENSSL_malloc_array() that bails out when a NULL pointer is returned. Signed-off-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28444)
* Copyright year updatesopenssl-machine2025-09-024-4/+4
| | | | | | Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Release: yes
* test/testutil/main.c: move global_init before test_open_streamsEugene Syromiatnikov2025-08-081-1/+4
| | | | | | | | | | | | | | So it is possible to change the allocator implementation, as it must be before the first malloc call. Suggested-by: Matt Caswell <[email protected]> Signed-off-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28059)
* test: use array memory (re)allocation routinesEugene Syromiatnikov2025-08-081-1/+1
| | | | | | | | | | Signed-off-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/28059)
* Fixes for build failures on OS X 10.4 TigerGAlvare2025-08-081-1/+3
| | | | | | | | | | | Also added darwin8-ppc-cc and darwin8-ppc64-cc build configurations for handling OS X 10.4 PowerPC specific configuration options, specifically disabling async by default. Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Bernd Edlinger <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/27578)
* test: Silence warnings on Win64 buildsTomas Mraz2025-07-022-7/+9
| | | | | | Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from https://github.com/openssl/openssl/pull/27806)
* test/testutil/testutil_init.c: Add OPENSSL_free() to avoid memory leakJiashengJiang2025-05-131-0/+1
| | | | | | | | | | | Free trace_data if error occurs to avoid memory leak. Fixes: d73458d17a ("Add tracing capability in test utilities") Signed-off-by: JiashengJiang <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/27600)
* Copyright year updatesopenssl-machine2025-03-123-3/+3
| | | | | | Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Release: yes
* testutil: increase the line length for reading stanzasPauli2025-02-201-6/+7
| | | | | | | | PQC algorithms and SLH-DSA in particular have very long lines of data. Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Shane Lontis <[email protected]> (Merged from https://github.com/openssl/openssl/pull/26750)
* testutil: Allow overriding output BIOs thread-locallyHugo Landau2025-02-171-4/+113
| | | | | | Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/23487)
* Fix test failure in 30-test_evp_pkey_provided.tBernd Edlinger2025-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | In this test there is a random test output corruption. `make test TESTS=test_evp_pkey_provided V=1` has some random output, that can with a certain probability start a line with "ok" or so: # Setting up a OSSL_ENCODER context with passphrase # Testing with no encryption jLixONcRPi/m64CGie4KKKDuGeTjtYwfima3BNYCGlgbLGeK3yYxBfZb9JjviOJ4 # nHaNsRsONTAKyg== This happens because large random data is output to bio_out but some data remains buffered, and then test_note() is used to print some comments on the bio_err file. This causes output corruption that confuses the TAP parser. Fix that by flushing any pending output with test_flush_stdout() first. Fixes #23992 Reviewed-by: Saša Nedvědický <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/26383)
* Copyright year updatesTomas Mraz2024-09-052-2/+2
| | | | | Reviewed-by: Neil Horman <[email protected]> Release: yes
* Add FIPS DSA Keygen testsslontis2024-08-061-5/+3
| | | | | | | | | | | Adjust the existing tests to disable DSA keygen in FIPS mode. Allow evp_test to load DSA 'KeyParams' that can then be used to perform a DSA KeyGen. Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from https://github.com/openssl/openssl/pull/24978)
* Move ossl_asn1_string_to_time_t() to libtestutilshridhar kalavagunta2024-05-071-0/+90
| | | | | | | | | | | It is not used anywhere else than in tests. Fixes #22965 Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Tom Cosgrove <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/23269)
* Copyright year updatesMatt Caswell2023-09-282-2/+2
| | | | | Reviewed-by: Richard Levitte <[email protected]> Release: yes
* Enable the ability to seed the test RNG without randomising test orderingMatt Caswell2023-09-201-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Numerous tests use the test_random() function to get a random number. If a test fails then the seed that was used for the test RNG is displayed. Setting the seed to the same value in a future run is supposed to cause the same random numbers to be generated again. The way to set the RNG seed again is to use the `OPENSSL_TEST_RAND_ORDER` environment variable. However setting this environment variable *also* randomises the test ordering as well as seeding the RNG. This in itself calls test_random() so, in fact, when the test finally runs it gets different random numbers to when it originally run (defeating the repeatability objective). This means that only way repeatability can be obtained is if the test was originally run with `OPENSSL_TEST_RAND_ORDER` set to 0. If that wasn't done then the seed printed when the test failed is not useful. We introduce a new environment variable `OPENSSL_TEST_RAND_SEED` which can be used to independently seed the test RNG without randomising the test ordering. This can be used to get repeatability in cases where test ordering randomisation was not done in the first place. Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/22118)
* Fix new typos found by codespellDimitri Papadopoulos2023-09-181-1/+1
| | | | | | | Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/22098)
* Copyright year updatesMatt Caswell2023-09-074-4/+4
| | | | | Reviewed-by: Richard Levitte <[email protected]> Release: yes
* testutil: allow a failure return from setup_tests that doesn't print helpPauli2023-08-041-2/+3
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Shane Lontis <[email protected]> (Merged from https://github.com/openssl/openssl/pull/21621)
* Cast the argument to unsigned char when calling isspace()Michael Baentsch2023-06-091-2/+2
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/21151)
* Cast the argument to unsigned char when calling isdigit()Michael Baentsch2023-06-061-1/+1
| | | | | | | | | Fixes #21123 Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/21127)
* Resolve a djgpp function name conflictHugo Landau2023-05-241-18/+18
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/20856)
* Make testutil text output functions thread safe (tsan)Hugo Landau2023-05-241-8/+85
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/20856)
* Replaced '{ 0, NULL }' with OSSL_DISPATCH_END in OSSL_DISPATCH arraysIrak Rigia2023-04-211-2/+2
| | | | | | | | | Fixes #20710 Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/20745)
* test_get_libctx(): prevent crash when called with NULL provider argDr. David von Oheimb2023-02-081-1/+1
| | | | | | Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/20190)
* Cleanup : directly include of `internal/nelem.h` when required.FdaSilvaYY2022-11-232-2/+0
| | | | | | | | And so clean a few useless includes Reviewed-by: Paul Dale <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/19721)
* test: add two comparision options to fips version test utility codePauli2022-11-151-1/+39
| | | | | | Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from https://github.com/openssl/openssl/pull/19666)
* tests: clear error queue before executing a testcaseTomas Mraz2022-10-271-0/+2
| | | | | | | | | | | | | | There can be errors in the queue from previous tests and we look at it to verify we do not add spurious errors in some testcases. Fixes #19477 Reviewed-by: Dmitry Belyavskiy <[email protected]> Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/19483) (cherry picked from commit 4bae06d47ae26b37a948d31f11884e1813f6d669)