@@ -1780,71 +1780,28 @@ impl<'test> TestCx<'test> {
17801780 proc_res. fatal ( None , || on_failure ( * self ) ) ;
17811781 }
17821782
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-
18271783 // codegen tests (using FileCheck)
18281784
18291785 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" ) ;
18311787 let input_file = & self . testpaths . file ;
18321788 let rustc = self . make_compile_args (
18331789 input_file,
1834- output_file ,
1790+ TargetLocation :: ThisFile ( output_path . clone ( ) ) ,
18351791 Emit :: LlvmIr ,
18361792 AllowUnused :: No ,
18371793 LinkToAux :: Yes ,
18381794 Vec :: new ( ) ,
18391795 ) ;
18401796
18411797 let proc_res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
1842- let output_path = self . get_filecheck_file ( "ll" ) ;
18431798 ( proc_res, output_path)
18441799 }
18451800
18461801 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" ) ;
18481805 let input_file = & self . testpaths . file ;
18491806
18501807 let mut emit = Emit :: None ;
@@ -1867,15 +1824,14 @@ impl<'test> TestCx<'test> {
18671824
18681825 let rustc = self . make_compile_args (
18691826 input_file,
1870- output_file ,
1827+ TargetLocation :: ThisFile ( output_path . clone ( ) ) ,
18711828 emit,
18721829 AllowUnused :: No ,
18731830 LinkToAux :: Yes ,
18741831 Vec :: new ( ) ,
18751832 ) ;
18761833
18771834 let proc_res = self . compose_and_run_compiler ( rustc, None , self . testpaths ) ;
1878- let output_path = self . get_filecheck_file ( "s" ) ;
18791835 ( proc_res, output_path)
18801836 }
18811837
0 commit comments