Skip to content

Fix backtrace test on some linux versions#5142

Merged
SirTyson merged 1 commit intostellar:masterfrom
SirTyson:fix-backtrace-test
Feb 17, 2026
Merged

Fix backtrace test on some linux versions#5142
SirTyson merged 1 commit intostellar:masterfrom
SirTyson:fix-backtrace-test

Conversation

@SirTyson
Copy link
Contributor

Description

Fixes "backtraces work" tests.

It looks like this test is too brittle. On my laptop, I get correct backtraces that are formatted like this:

backtrace:
   0: stellar::printCurrentBacktrace()
             at src/util/Backtrace.cpp:27:22
   1: C_A_T_C_H_T_E_S_T_0
             at src/util/test/BacktraceTests.cpp:15:5
   2: invoke
             at src/../lib/catch.hpp:14169:15
      invokeActiveTestCase
             at src/../lib/catch.hpp:13025:27
      runCurrentTest
             at src/../lib/catch.hpp:12998:17
   3: runTest
             at src/../lib/catch.hpp:12759:13
   4: execute
             at src/../lib/catch.hpp:13352:45
      runInternal
             at src/../lib/catch.hpp:13562:39
   5: run
             at src/../lib/catch.hpp:13518:24
   6: runTest
             at src/test/test.cpp:488:22
   7: operator()
             at /usr/lib/llvm-20/bin/../include/c++/v1/__functional/function.h:436:12
      operator()
             at /usr/lib/llvm-20/bin/../include/c++/v1/__functional/function.h:995:10
      run
             at src/main/CommandLine.cpp:554:12
      handleCommandLine
             at src/main/CommandLine.cpp:2195:25
   8: main
             at src/main/main.cpp:382:15

While the backtrace is working, the test fails, since we look for a very specific string Catch::TestCase::invoke, which may not exist depending on what format you get based on your version matrix. It looks like Catch automatically generates test functions with the name C_A_T_C_H_T_E_S_T, so this string should appear no matter what formatting we get on the backtrace.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a brittle backtrace test that was failing on some Linux versions due to platform-specific formatting differences in backtrace output. The test was searching for a very specific string Catch::TestCase::invoke which doesn't always appear in backtraces depending on the compiler and system version. The fix replaces this with a more robust check for C_A_T_C_H, which is part of the test function name that Catch2 automatically generates for all test cases.

Changes:

  • Replace brittle backtrace string matching with a more platform-independent check
  • Add defensive empty check for backtrace output

@SirTyson SirTyson added this pull request to the merge queue Feb 17, 2026
Merged via the queue into stellar:master with commit c47b371 Feb 17, 2026
67 checks passed
@SirTyson SirTyson deleted the fix-backtrace-test branch February 17, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants