-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange indentation in libtest output #104092
Comments
Cc @thomcc any idea which change might have caused this? I think this must be fairly recent but haven't tried bisecting yet. |
Is this still reproducable? |
With #108659 this can no longer be tested using x.py, since bootstrap now does test output formatting itself. So this now needs a little cargo project with a test and a benchmark, to check what libtest actually does. |
It is because benches are dynamic, and they always use padding (and tests are static): I'm not sure why padding is different for static vs dynamic. Here is a repro: #![feature(test)]
extern crate test;
#[test]
fn foo() {}
#[bench]
fn short_name(b: &mut test::Bencher) {
b.iter(|| 1);
}
#[bench]
fn this_is_a_really_long_name(b: &mut test::Bencher) {
b.iter(|| 1);
} |
Seems like that could use context if the bench is only being run as a test, then don't pad. The padding is desirable for benchmark output so the numeric values line up, for easier visual comparison. You could argue either way about tests -- maybe ok/FAILED would stand out even more with padded alignment. |
PR with regression tests and a fix (in that order): #118548 |
libtest: Fix padding of benchmarks run as tests ### Summary The first commit adds regression tests for libtest padding. The second commit fixes padding for benches run as tests and updates the blessed output of the regression tests to make it clear what effect the fix has on padding. Closes rust-lang#104092 which is **E-help-wanted** and **regression-from-stable-to-stable** ### More details Before this fix we applied padding _before_ manually doing what `convert_benchmarks_to_tests()` does which affects padding calculations. Instead use `convert_benchmarks_to_tests()` first if applicable and then apply padding afterwards so it becomes correct. Benches should only be padded when run as benches to make it easy to compare the benchmark numbers. Not when run as tests. r? `@ghost` until CI passes.
libtest output recently started indenting some but not all test results:
Seems like benchmarks are indented but regular tests are not.
The text was updated successfully, but these errors were encountered: