Skip to content

test: print assertion backtraces #3057

Open
@camshaft

Description

@camshaft

Problem:

In the test assertions we only print the stacktrace from s2n if it encountered any errors. This doesn't apply to EXPECT_TRUE, `EXPECT_EQ, etc. When using these macros inside of functions, it makes it difficult to know exactly why the assertion failed.

Solution:

The FAIL_MSG_PRINT should be updated to include the stack trace of the actual assertion. We can use the same backtrace function as the library:

s2n-tls/error/s2n_errno.c

Lines 390 to 391 in 1ff0aa8

tl_stacktrace.trace_size = backtrace(array, MAX_BACKTRACE_DEPTH);
tl_stacktrace.trace = backtrace_symbols(array, tl_stacktrace.trace_size);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions