Skip to content

Commit 16e9b9f

Browse files
committed
Auto merge of #45748 - petrochenkov:short, r=alexcrichton
Shorten paths to auxiliary files created by tests I'm hitting issues with long file paths to object files created by the test suite, similar to #45103 (comment). If we look at the object file path in #45103 we can see that the patch contains of few components: ``` specialization-cross-crate-defaults.stage2-x86_64-pc-windows-gnu.run-pass.libaux\specialization_cross_crate_defaults.specialization_cross_crate_defaults0.rust-cgu.o ``` => 1. specialization-cross-crate-defaults // test name, required 2. stage2 // stage disambiguator, required 3. x86_64-pc-windows-gnu // target disambiguator, required 4. run-pass // mode disambiguator, rarely required 5. libaux // suffix, can be shortened 6. specialization_cross_crate_defaults // required, there may be several libraries in the directory 7. specialization_cross_crate_defaults0 // codegen unit name, can be shortened? 8. rust-cgu // suffix, can be shortened? 9. o // object file extension This patch addresses items `4`, `5` and `8`. `libaux` is shortened to `aux`, `rust-cgu` is shortened to `rcgu`, mode disambiguator is omitted unless it's necessary (for pretty-printing and debuginfo tests, see 38d26d8) I haven't touched names of codegen units though (`specialization_cross_crate_defaults0`). Is it useful for them to have descriptive names including the crate name, as opposed to just `0` or `cgu0` or something?
2 parents 44183f5 + d588f93 commit 16e9b9f

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

src/librustc/session/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl_stable_hash_for!(struct self::OutputFilenames {
410410
outputs
411411
});
412412

413-
pub const RUST_CGU_EXT: &str = "rust-cgu";
413+
pub const RUST_CGU_EXT: &str = "rcgu";
414414

415415
impl OutputFilenames {
416416
pub fn path(&self, flavor: OutputType) -> PathBuf {

src/librustc_trans/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ fn add_upstream_rust_crates(cmd: &mut Linker,
12221222
let canonical = f.replace("-", "_");
12231223
let canonical_name = name.replace("-", "_");
12241224

1225-
// Look for `.rust-cgu.o` at the end of the filename to conclude
1225+
// Look for `.rcgu.o` at the end of the filename to conclude
12261226
// that this is a Rust-related object file.
12271227
fn looks_like_rust(s: &str) -> bool {
12281228
let path = Path::new(s);

src/test/run-make/extra-filename-with-temp-outputs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
all:
44
$(RUSTC) -C extra-filename=bar foo.rs -C save-temps
5-
rm $(TMPDIR)/foobar.foo0.rust-cgu.o
5+
rm $(TMPDIR)/foobar.foo0.rcgu.o
66
rm $(TMPDIR)/$(call BIN,foobar)

src/tools/compiletest/src/common.rs

+14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ pub enum Mode {
3434
MirOpt,
3535
}
3636

37+
impl Mode {
38+
pub fn disambiguator(self) -> &'static str {
39+
// Run-pass and pretty run-pass tests could run concurrently, and if they do,
40+
// they need to keep their output segregated. Same is true for debuginfo tests that
41+
// can be run both on gdb and lldb.
42+
match self {
43+
Pretty => ".pretty",
44+
DebugInfoGdb => ".gdb",
45+
DebugInfoLldb => ".lldb",
46+
_ => "",
47+
}
48+
}
49+
}
50+
3751
impl FromStr for Mode {
3852
type Err = ();
3953
fn from_str(s: &str) -> Result<Mode, ()> {

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ actual:\n\
15651565
fn aux_output_dir_name(&self) -> PathBuf {
15661566
let f = self.output_base_name();
15671567
let mut fname = f.file_name().unwrap().to_os_string();
1568-
fname.push(&format!(".{}.libaux", self.config.mode));
1568+
fname.push(&format!("{}.aux", self.config.mode.disambiguator()));
15691569
f.with_file_name(&fname)
15701570
}
15711571

0 commit comments

Comments
 (0)