From: Josh Stone Date: Mon, 8 Apr 2024 22:04:44 +0000 (-0700) Subject: [PATCH] Fix UI tests with dist-vendored dependencies X-Git-Tag: archive/raspbian/1.78.0+dfsg1-2_deb12u3+rpi1~4^2~40 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b3bf75fbad4a93f033313c3414fd039eb8511a7d;p=rustc-web.git [PATCH] Fix UI tests with dist-vendored dependencies There is already a workaround in `compiletest` to deal with custom `CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`. A similar need exists when dependencies come from the local `vendor` directory, which distro builds often use, so now we ignore that too. Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably expecting a version suffix, but the vendored path doesn't include the version. Now that matches `[\\/]hashbrown` instead. Forwarded: yes Gbp-Pq: Topic upstream Gbp-Pq: Name u-avoid-blessing-cargo-deps-s-source-code-in-ui-tests.patch --- diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7be0571b11..5321cdd66d 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2355,6 +2355,11 @@ impl<'test> TestCx<'test> { "ignore-directory-in-diagnostics-source-blocks={}", home::cargo_home().expect("failed to find cargo home").to_str().unwrap() )); + // Similarly, vendored sources shouldn't be shown when running from a dist tarball. + rustc.arg("-Z").arg(format!( + "ignore-directory-in-diagnostics-source-blocks={}", + self.config.find_rust_src_root().unwrap().join("vendor").display(), + )); // Optionally prevent default --sysroot if specified in test compile-flags. if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs index a349253063..9ca9eff417 100644 --- a/tests/ui/issues/issue-21763.rs +++ b/tests/ui/issues/issue-21763.rs @@ -1,6 +1,7 @@ // Regression test for HashMap only impl'ing Send/Sync if its contents do //@ normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION" +//@ normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION" use std::collections::HashMap; use std::rc::Rc;