rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.6k stars 12.62k forks source link

`tests/ui/meta/revision-bad.rs#foo` test failure on `master` #130996

Open onkoe opened 2 weeks ago

onkoe commented 2 weeks ago

Hey there! I'm experiencing a weird issue where the tests/ui/meta/revision-bad.rs#foo test fails on the latest master branch commit when I run ./x test. The issue has occurred for me since at least 1b6d674 and still occurs now (e6eb451).

barrett@farts ~/D/p/c/rust (master)> ./x test tests/ui/meta/revision-bad.rs --verbose
# (snip)
running 2 tests
test [ui] tests/ui/meta/revision-bad.rs#bar ... ok
test [ui] tests/ui/meta/revision-bad.rs#foo ... FAILED

failures:

---- [ui] tests/ui/meta/revision-bad.rs#foo stdout ----

executing env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/barrett/Documents/projects/contributions/rust/tests/ui/meta/revision-bad.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/barrett/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/barrett/Documents/projects/contributions/rust/vendor" "--sysroot" "/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--cfg" "foo" "--check-cfg" "cfg(FALSE,foo,bar)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/test/ui/meta/revision-bad.foo/a" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/test/ui/meta/revision-bad.foo/auxiliary"
------stdout------------------------------

------stderr------------------------------

------------------------------------------
executing cd "/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/test/ui/meta/revision-bad.foo" && RUSTC="/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" RUST_TEST_THREADS="16" "/home/barrett/Documents/projects/contributions/rust/build/x86_64-unknown-linux-gnu/test/ui/meta/revision-bad.foo/a"
------stdout------------------------------

------stderr------------------------------
thread 'main' panicked at /home/barrett/Documents/projects/contributions/rust/tests/ui/meta/revision-bad.rs:13:5:
foo
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

------------------------------------------

NOTE: test did not panic as expected

failures:
    [ui] tests/ui/meta/revision-bad.rs#foo

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 17696 filtered out; finished in 206.56ms

Here are the logs:

It feels like the test harness is failing to detect the panic - you can see in stderr that the panic occurs as expected, but the test asserts that it didn't! Oddly enough, revision-bad.rs#bar is detected correctly.

jieyouxu commented 23 hours ago

It feels like the test harness is failing to detect the panic - you can see in stderr that the panic occurs as expected, but the test asserts that it didn't! Oddly enough, revision-bad.rs#bar is detected correctly.

It's actually because your username barrett contains bar, which the foo revision is explicitly checking to make sure that it is not present in test run stderr. But that is present in the panic backtrace of test stderr because the panic backtrace contains a path including your username. In #131579 I'm fixing it by remapping the path prefix so the panic backtrace paths are predictable and does not include username info or intermediate folders.