Skip to content

Test backtrace does not get cleaned #3368

Description

@BWindey

A while ago, the backtraces on Linux were improved so that they did not include function calls inside the backtrace code itself. However, this culling of "clutter-lines" does not happen when backtraces get printed during tests.

The below code shows the difference by first running c3c compile-run, then c3c compile-test:

faultdef OOPSIE;
fn void test() @test {
	OOPSIE~!!;
}

fn void main() {
	OOPSIE~!!;
}
  • compile-run:
$ c3c compile-run -q backtrace.c3

ERROR: 'Unexpected fault 'backtrace::OOPSIE' was unwrapped!'
  in backtrace.main (/home/bram/tmp/backtrace.c3:7) [/home/bram/tmp/backtrace] [inline]
  • compile-test:
$ c3c compile-test -q backtrace.c3 
------------ TESTS ------------
Testing backtrace::test .. [FAIL]

ERROR: 'Unexpected fault 'backtrace::OOPSIE' was unwrapped!'
  in std.os.posix.backtrace (.../lib/std/os/posix/process.c3:91) [~/tmp/testrun] [inline]
  in std.os.backtrace.capture_current (.../lib/std/os/backtrace.c3:87) [~/tmp/testrun] [inline]
  in std.core.builtin.print_backtrace (.../lib/std/core/builtin.c3:227) [~/tmp/testrun] [inline]
  in std.core.runtime.panic_test.30603 (.../lib/std/core/runtime_test.c3:117) [~/tmp/testrun] [inline]
  in std.core.runtime.test_panic.30598 (.../lib/std/core/runtime_test.c3:105) [~/tmp/testrun] [inline]
  in std.core.builtin.panicf (.../lib/std/core/builtin.c3:345) [~/tmp/testrun] [inline]
  in backtrace.test (~/tmp/backtrace.c3:3) [~/tmp/testrun] [inline]
  in std.core.runtime.run_tests (.../lib/std/core/runtime_test.c3:333) [~/tmp/testrun] [inline]
  in std.core.runtime.default_test_runner (.../lib/std/core/runtime_test.c3:386) [~/tmp/testrun] [inline]



Test failed ^^^ ( backtrace.c3:3 ) Unexpected fault 'backtrace::OOPSIE' was unwrapped!

1 test run.

Test Result: FAILED: 0 passed, 1 failed, 0 skipped.

Note

When running benchmarks, the backtrace does get cleaned up.

Metadata

Metadata

Assignees

Labels

Fields

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions