aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
Commit message (Collapse)AuthorAgeFilesLines
* ssl: handle session ID cache lock failureMounir IDRASSI4 days2-0/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | SSL_has_matching_session_id() returns 0 both when no matching session exists and when the cache lock cannot be acquired. Its use in the built-in generator's retry loop and the final uniqueness check can therefore treat a lock failure as proof that no conflict exists. Add an internal tri-state lookup. The final uniqueness check uses it as a backstop for IDs produced by both built-in and application callbacks, recording an internal fatal error when the cache cannot be checked. The retry loop also uses it to prevent the built-in generator from returning an ID after its own lookup failed, through the existing callback failure path. Preserve the public API's boolean contract. Correct the callback-selection cache lock failure reason from SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED to ERR_R_INTERNAL_ERROR. Remove a redundant caller-side SSLfatal() that appended a generic ERR_R_INTERNAL_ERROR after the specific error already recorded. Add a deterministic unit test for final cache lookup failure. Fixes #32358 Assisted-by: Codex:gpt-5.6-sol Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Dmitry Belyavskiy <[email protected]> Merge-date: Wed Oct 21 16:25:29 2026 Merged-from: https://github.com/openssl/openssl/pull/32359
* Bring recent comments into line with the STYLE.md comment rulesBob Beck2026-10-021-2/+1
| | | | | | | | | | | | | | | | Comments added by AI-assisted commits over the last three months often narrate the change rather than describe the code: the behaviour being replaced, the alternative not taken, or the bug the test was written for. STYLE.md now says that a comment states what the code does and the constraint it satisfies, and that the reasoning behind a change does not belong in one. Reword those comments to that standard. Reviewed-by: Milan Broz <[email protected]> Reviewed-by: Neil Horman <[email protected]> Merge-date: Fri Oct 2 08:06:12 2026 Merged-from: https://github.com/openssl/openssl/pull/32779
* test: add unit test for the buffering BIOJakub Zelenka2026-09-292-0/+1173
| | | | | | | | | | | | | | | Test BIO_f_buffer through a fake next BIO whose callbacks are cmocka mocks, covering the partial-write and retry handling on flush, the direct read/write paths for oversized requests, the ctrl operations, and the datagram peer recording and sendmmsg-based flushing used by DTLS listener connections. Wrapping the address allocation functions additionally covers the peer recording failure branches. Assisted-by: Claude:claude-fable-5 Reviewed-by: Daniel Kubec <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> Merge-date: Tue Sep 29 16:36:57 2026 Merged-from: https://github.com/openssl/openssl/pull/32642
* test: forward real stdio calls in bss_file unit test mocksJakub Zelenka2026-08-201-0/+42
| | | | | | | | | | | | | | | The --wrap link option rewrites the stdio symbols of everything linked into the test binary. In --coverage builds libgcov reads and writes the .gcda files at process exit through fread/fwrite/fseek/ftell/fclose, which then hit the cmocka mocks with no expectations queued and make the binary exit with 255 after all tests have passed. Forward calls on any stream other than the fake test pointers to the real functions. Assisted-by: Claude:claude-fable-5 Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Bob Beck <[email protected]> Merge-date: Thu Aug 20 07:50:12 2026 Merged-from: https://github.com/openssl/openssl/pull/32431
* Add BIO bss_file testJakub Zelenka2026-08-083-0/+1632
| | | | | | | | | | | | | | | | Add a cmocka based unit test for the file BIO covering BIO_new_file, BIO_new_fp and the file method callbacks, with stdio and openssl_fopen. Additionally add a Windows-only Detours based side test for the Windows specific branches. Assisted-by: Claude:claude-fable-5 Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> Reviewed-by: Andrew Dinh <[email protected]> MergeDate: Sat Aug 8 15:26:34 2026 (Merged from https://github.com/openssl/openssl/pull/31991)
* mkwraps: resolve system (libc) functions via compiler include pathsJakub Zelenka2026-07-201-1/+7
| | | | | | | | | | | | | | | | | | | | WRAP[] lists mix OpenSSL functions with libc/POSIX ones such as read() or socket(), which mkwraps.pl reported as "declaration not found" since it only searched the project's INCLUDE[] directories. Fall back to the C compiler's default include search paths for functions missing from the project headers. They are queried lazily, only on such a miss, so the all-OpenSSL case still does not walk /usr/include. Parse the glibc trailing attribute macros (__THROW, __wur, ...) and restrict qualifier, and add --cc and --no-system. Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> Reviewed-by: Paul Dale <[email protected]> MergeDate: Mon Jul 20 07:00:57 2026 (Merged from https://github.com/openssl/openssl/pull/31936)
* test: add Windows unit tests setup and initial dgram testJakub Zelenka2026-07-152-50/+537
| | | | | | | | | | | | | | | | | This adds an initial setup for unit testing on Windows that allows mocking of system functions using Detour library. This works only for library functions and not object function like wrap so it is a bit limited but it is still useful for BIO mocking. An initial BIO bss_dgram test is added covering the Windows specific parts. Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Igor Ustinov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Wed Jul 15 16:00:35 2026 (Merged from https://github.com/openssl/openssl/pull/31915)
* Add BIO bio_sock2 testJakub Zelenka2026-07-092-0/+793
| | | | | | | | | Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:25 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bio_sock testJakub Zelenka2026-07-092-0/+545
| | | | | | | | | Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:24 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bss_socket testJakub Zelenka2026-07-092-0/+536
| | | | | | | | | Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:22 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bss_dgram testJakub Zelenka2026-07-092-0/+779
| | | | | | | | | Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:21 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bss_acpt testJakub Zelenka2026-07-092-0/+1062
| | | | | | | | | Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:20 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bss_conn testJakub Zelenka2026-07-092-0/+1598
| | | | | | | | | Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:19 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bio_addr testJakub Zelenka2026-07-092-0/+1161
| | | | | | | | | Assisted-by: Claude:claude-opus-4-7 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:18 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add BIO bss_fd testJakub Zelenka2026-07-092-0/+650
| | | | | | | | | Assisted-by: Claude:claude-opus-4-7 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:17 2026 (Merged from https://github.com/openssl/openssl/pull/30788)
* Add unit testing cmocka based frameworkJakub Zelenka2026-07-093-0/+572
This adds the unit testing framework that extends the build so it can be enabled and tests are built. It is executed as part of the test using a recipe which executes all unit tests. The documentation is added with more info about writing the unit tests. Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jul 9 17:39:14 2026 (Merged from https://github.com/openssl/openssl/pull/30788)