@@ -69,7 +69,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
6969
7070 let ( chunk_size, chunk_count) = chunk_info ( self . intrinsics . len ( ) ) ;
7171
72- let cpp_compiler = compile:: build_cpp_compilation ( & self . cli_options ) . unwrap ( ) ;
72+ let cpp_compiler_wrapped = compile:: build_cpp_compilation ( & self . cli_options ) ;
7373
7474 let notice = & build_notices ( "// " ) ;
7575 self . intrinsics
@@ -81,9 +81,11 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
8181 write_mod_cpp ( & mut file, notice, c_target, platform_headers, chunk) . unwrap ( ) ;
8282
8383 // compile this cpp file into a .o file
84- let output = cpp_compiler
85- . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
86- assert ! ( output. status. success( ) , "{output:?}" ) ;
84+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
85+ let output = cpp_compiler
86+ . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
87+ assert ! ( output. status. success( ) , "{output:?}" ) ;
88+ }
8789
8890 Ok ( ( ) )
8991 } )
@@ -99,21 +101,25 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
99101 )
100102 . unwrap ( ) ;
101103
104+ // This is done because `cpp_compiler_wrapped` is None when
105+ // the --generate-only flag is passed
106+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
102107 // compile this cpp file into a .o file
103- info ! ( "compiling main.cpp" ) ;
104- let output = cpp_compiler
105- . compile_object_file ( "main.cpp" , "intrinsic-test-programs.o" )
106- . unwrap ( ) ;
107- assert ! ( output. status. success( ) , "{output:?}" ) ;
108-
109- let object_files = ( 0 ..chunk_count)
110- . map ( |i| format ! ( "mod_{i}.o" ) )
111- . chain ( [ "intrinsic-test-programs.o" . to_owned ( ) ] ) ;
112-
113- let output = cpp_compiler
114- . link_executable ( object_files, "intrinsic-test-programs" )
115- . unwrap ( ) ;
116- assert ! ( output. status. success( ) , "{output:?}" ) ;
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+ }
117123
118124 true
119125 }
0 commit comments