Skip to content

communicate the error when a test fails in release mode #14972

Open
@andrewrk

Description

@andrewrk

Extracted from #14647.

Running unit tests via the build system in release mode with a failure currently looks like this:

const std = @import("std");

test "oops" {
    try std.testing.expect(false);
}
andy@ark ~/t/abc [1]> zig build test -Doptimize=ReleaseFast
run test: error: 'test.oops' failed
run test: error: the following test command failed:
/home/andy/tmp/abc/zig-cache/o/a12abb147b3c725378efb29b200da6fa/test --listen=- 
Build Summary: 1/3 steps succeeded; 1 failed; 0/1 tests passed; 1 failed (disable with -fno-summary)
test transitive failure
└─ run test 0/1 passed, 1 failed
   └─ zig test ReleaseFast native success 6s MaxRSS:171M
error: the following build command failed with exit code 1:
/home/andy/tmp/abc/zig-cache/o/689850d0ce8aa0fb1a06ce5b6bf02f7b/build /home/andy/Downloads/zig/build-release/stage3/bin/zig /home/andy/tmp/abc /home/andy/tmp/abc/zig-cache /home/andy/.cache/zig test -Doptimize=ReleaseFast

There is one piece of information that is lost, which is the fact that the test failed with error.TestUnexpectedResult. This information could be communicated via the TestResult message over test protocol, or the test runner could simply print the error name to stderr before reporting a failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions