@@ -5,7 +5,7 @@ mod intrinsic;
55mod json_parser;
66mod types;
77
8- use std:: fs:: File ;
8+ use std:: fs;
99
1010use rayon:: prelude:: * ;
1111
@@ -70,28 +70,31 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
7070
7171 let ( chunk_size, chunk_count) = chunk_info ( self . intrinsics . len ( ) ) ;
7272
73- let cpp_compiler = compile:: build_cpp_compilation ( & self . cli_options ) . unwrap ( ) ;
73+ let cpp_compiler_wrapped = compile:: build_cpp_compilation ( & self . cli_options ) ;
7474
7575 let notice = & build_notices ( "// " ) ;
76+ fs:: create_dir_all ( "c_programs" ) . unwrap ( ) ;
7677 self . intrinsics
7778 . par_chunks ( chunk_size)
7879 . enumerate ( )
7980 . map ( |( i, chunk) | {
8081 let c_filename = format ! ( "c_programs/mod_{i}.cpp" ) ;
81- let mut file = File :: create ( & c_filename) . unwrap ( ) ;
82+ let mut file = fs :: File :: create ( & c_filename) . unwrap ( ) ;
8283 write_mod_cpp ( & mut file, notice, c_target, platform_headers, chunk) . unwrap ( ) ;
8384
8485 // compile this cpp file into a .o file
85- let output = cpp_compiler
86- . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
87- assert ! ( output. status. success( ) , "{output:?}" ) ;
86+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
87+ let output = cpp_compiler
88+ . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
89+ assert ! ( output. status. success( ) , "{output:?}" ) ;
90+ }
8891
8992 Ok ( ( ) )
9093 } )
9194 . collect :: < Result < ( ) , std:: io:: Error > > ( )
9295 . unwrap ( ) ;
9396
94- let mut file = File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
97+ let mut file = fs :: File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
9598 write_main_cpp (
9699 & mut file,
97100 c_target,
@@ -101,20 +104,22 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
101104 . unwrap ( ) ;
102105
103106 // compile this cpp file into a .o file
104- info ! ( "compiling main.cpp" ) ;
105- let output = cpp_compiler
106- . compile_object_file ( "main.cpp" , "intrinsic-test-programs.o" )
107- . unwrap ( ) ;
108- assert ! ( output. status. success( ) , "{output:?}" ) ;
109-
110- let object_files = ( 0 ..chunk_count)
111- . map ( |i| format ! ( "mod_{i}.o" ) )
112- . chain ( [ "intrinsic-test-programs.o" . to_owned ( ) ] ) ;
113-
114- let output = cpp_compiler
115- . link_executable ( object_files, "intrinsic-test-programs" )
116- . unwrap ( ) ;
117- assert ! ( output. status. success( ) , "{output:?}" ) ;
107+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
108+ info ! ( "compiling main.cpp" ) ;
109+ let output = cpp_compiler
110+ . compile_object_file ( "main.cpp" , "intrinsic-test-programs.o" )
111+ . unwrap ( ) ;
112+ assert ! ( output. status. success( ) , "{output:?}" ) ;
113+
114+ let object_files = ( 0 ..chunk_count)
115+ . map ( |i| format ! ( "mod_{i}.o" ) )
116+ . chain ( [ "intrinsic-test-programs.o" . to_owned ( ) ] ) ;
117+
118+ let output = cpp_compiler
119+ . link_executable ( object_files, "intrinsic-test-programs" )
120+ . unwrap ( ) ;
121+ assert ! ( output. status. success( ) , "{output:?}" ) ;
122+ }
118123
119124 true
120125 }
@@ -173,7 +178,11 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
173178 . collect :: < Result < ( ) , std:: io:: Error > > ( )
174179 . unwrap ( ) ;
175180
176- compile_rust_programs ( toolchain, target, linker)
181+ if self . cli_options . toolchain . is_some ( ) {
182+ compile_rust_programs ( toolchain, target, linker)
183+ } else {
184+ true
185+ }
177186 }
178187
179188 fn compare_outputs ( & self ) -> bool {
0 commit comments