Skip to content

Commit

Permalink
Auto merge of #45748 - petrochenkov:short, r=alexcrichton
Browse files Browse the repository at this point in the history
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 rust-lang/rust#45103 (comment).

If we look at the object file path in rust-lang/rust#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 rust-lang/rust@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?
  • Loading branch information
bors committed Nov 5, 2017
2 parents 730ce44 + eed7108 commit 2b4b0e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ pub enum Mode {
MirOpt,
}

impl Mode {
pub fn disambiguator(self) -> &'static str {
// Run-pass and pretty run-pass tests could run concurrently, and if they do,
// they need to keep their output segregated. Same is true for debuginfo tests that
// can be run both on gdb and lldb.
match self {
Pretty => ".pretty",
DebugInfoGdb => ".gdb",
DebugInfoLldb => ".lldb",
_ => "",
}
}
}

impl FromStr for Mode {
type Err = ();
fn from_str(s: &str) -> Result<Mode, ()> {
Expand Down
2 changes: 1 addition & 1 deletion src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ actual:\n\
fn aux_output_dir_name(&self) -> PathBuf {
let f = self.output_base_name();
let mut fname = f.file_name().unwrap().to_os_string();
fname.push(&format!(".{}.libaux", self.config.mode));
fname.push(&format!("{}.aux", self.config.mode.disambiguator()));
f.with_file_name(&fname)
}

Expand Down

0 comments on commit 2b4b0e9

Please sign in to comment.