Skip to content

Invert status output of tests (suffix instead of prefix) #28544

Closed
@emidoots

Description

@emidoots

As it is currently running some tests looks like this:

test vec4::eq_1 ... ok
test vec4::is_zero_0 ... ok
test vec4::fmt_0 ... ok
test vec4::length_sq_0 ... ok
test vec4::is_nan_0 ... ok
test vec4::lerp_0 ... ok
test vec4::length_0 ... ok
test vec4::max_0 ... ok
test vec4::mul_0 ... ok
test vec4::mul_scalar_0 ... ok
test vec4::min_0 ... ok
test vec4::one_1 ... ok
test vec4::one_0 ... ok
test vec4::neg_0 ... ok
test vec4::partial_cmp_0 ... failed
test vec4::normalize_0 ... ok
test vec4::sub_0 ... ok
test vec4::project_0 ... ok
test vec4::round_0 ... ok
test vec4::zero_0 ... failed
test vec4::sub_scalar_0 ... ok

test result: ok. 19 passed; 2 failed; 0 ignored; 0 measured

Because the names are not the most important aspect of the message (the ok/failure status is), I believe it may make sense to invert the status output like so:

[ok] test vec4::eq_1
[ok] test vec4::is_zero_0
[ok] test vec4::fmt_0
[ok] test vec4::length_sq_0
[ok] test vec4::is_nan_0
[ok] test vec4::lerp_0
[ok] test vec4::length_0
[ok] test vec4::max_0
[ok] test vec4::mul_0
[ok] test vec4::mul_scalar_0
[ok] test vec4::min_0
[ok] test vec4::one_1
[ok] test vec4::one_0
[ok] test vec4::neg_0
[failed] test vec4::partial_cmp_0
[ok] test vec4::normalize_0
[ok] test vec4::sub_0
[ok] test vec4::project_0
[ok] test vec4::round_0
[failed] test vec4::zero_0
[ok] test vec4::sub_scalar_0

test result: ok. 19 passed; 2 failed; 0 ignored; 0 measured

Note that:

  1. This makes it easier to identify which tests failed or not, because the status is not offset by a name of arbitrary length.
  2. This might not make sense if printing the test name is important prior to the status (e.g. if the output is not fully buffered, or if test programs may sometimes hang and the testing framework can't catch this).

Moved here from rust-lang/cargo#1985

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsuiteArea: The testsuite used to check the correctness of rustcP-lowLow priorityT-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions