@@ -1780,71 +1780,28 @@ impl<'test> TestCx<'test> {
1780
1780
proc_res.fatal(None, || on_failure(*self));
1781
1781
}
1782
1782
1783
- fn get_output_file(&self, extension: &str) -> TargetLocation {
1784
- let thin_lto = self.props.compile_flags.iter().any(|s| s.ends_with("lto=thin"));
1785
- if thin_lto {
1786
- TargetLocation::ThisDirectory(self.output_base_dir())
1787
- } else {
1788
- // This works with both `--emit asm` (as default output name for the assembly)
1789
- // and `ptx-linker` because the latter can write output at requested location.
1790
- let output_path = self.output_base_name().with_extension(extension);
1791
-
1792
- TargetLocation::ThisFile(output_path.clone())
1793
- }
1794
- }
1795
-
1796
- fn get_filecheck_file(&self, extension: &str) -> PathBuf {
1797
- let thin_lto = self.props.compile_flags.iter().any(|s| s.ends_with("lto=thin"));
1798
- if thin_lto {
1799
- let name = self.testpaths.file.file_stem().unwrap().to_str().unwrap();
1800
- let canonical_name = name.replace('-', "_");
1801
- let mut output_file = None;
1802
- for entry in self.output_base_dir().read_dir().unwrap() {
1803
- if let Ok(entry) = entry {
1804
- let entry_path = entry.path();
1805
- let entry_file = entry_path.file_name().unwrap().to_str().unwrap();
1806
- if entry_file.starts_with(&format!("{}.{}", name, canonical_name))
1807
- && entry_file.ends_with(extension)
1808
- {
1809
- assert!(
1810
- output_file.is_none(),
1811
- "thinlto doesn't support multiple cgu tests"
1812
- );
1813
- output_file = Some(entry_file.to_string());
1814
- }
1815
- }
1816
- }
1817
- if let Some(output_file) = output_file {
1818
- self.output_base_dir().join(output_file)
1819
- } else {
1820
- self.output_base_name().with_extension(extension)
1821
- }
1822
- } else {
1823
- self.output_base_name().with_extension(extension)
1824
- }
1825
- }
1826
-
1827
1783
// codegen tests (using FileCheck)
1828
1784
1829
1785
fn compile_test_and_save_ir(&self) -> (ProcRes, PathBuf) {
1830
- let output_file = self.get_output_file ("ll");
1786
+ let output_path = self.output_base_name().with_extension ("ll");
1831
1787
let input_file = &self.testpaths.file;
1832
1788
let rustc = self.make_compile_args(
1833
1789
input_file,
1834
- output_file ,
1790
+ TargetLocation::ThisFile(output_path.clone()) ,
1835
1791
Emit::LlvmIr,
1836
1792
AllowUnused::No,
1837
1793
LinkToAux::Yes,
1838
1794
Vec::new(),
1839
1795
);
1840
1796
1841
1797
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
1842
- let output_path = self.get_filecheck_file("ll");
1843
1798
(proc_res, output_path)
1844
1799
}
1845
1800
1846
1801
fn compile_test_and_save_assembly(&self) -> (ProcRes, PathBuf) {
1847
- let output_file = self.get_output_file("s");
1802
+ // This works with both `--emit asm` (as default output name for the assembly)
1803
+ // and `ptx-linker` because the latter can write output at requested location.
1804
+ let output_path = self.output_base_name().with_extension("s");
1848
1805
let input_file = &self.testpaths.file;
1849
1806
1850
1807
let mut emit = Emit::None;
@@ -1867,15 +1824,14 @@ impl<'test> TestCx<'test> {
1867
1824
1868
1825
let rustc = self.make_compile_args(
1869
1826
input_file,
1870
- output_file ,
1827
+ TargetLocation::ThisFile(output_path.clone()) ,
1871
1828
emit,
1872
1829
AllowUnused::No,
1873
1830
LinkToAux::Yes,
1874
1831
Vec::new(),
1875
1832
);
1876
1833
1877
1834
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
1878
- let output_path = self.get_filecheck_file("s");
1879
1835
(proc_res, output_path)
1880
1836
}
1881
1837
0 commit comments