@@ -70,7 +70,7 @@ 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 ( "// " ) ;
7676 fs:: create_dir_all ( "c_programs" ) . unwrap ( ) ;
@@ -82,10 +82,15 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
8282 let mut file = File :: create ( & c_filename) . unwrap ( ) ;
8383 write_mod_cpp ( & mut file, notice, c_target, platform_headers, chunk) . unwrap ( ) ;
8484
85- // compile this cpp file into a .o file
86- let output = cpp_compiler
87- . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
88- assert ! ( output. status. success( ) , "{output:?}" ) ;
85+ // compile this cpp file into a .o file.
86+ //
87+ // This is done because `cpp_compiler_wrapped` is None when
88+ // the --generate-only flag is passed
89+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
90+ let output = cpp_compiler
91+ . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
92+ assert ! ( output. status. success( ) , "{output:?}" ) ;
93+ }
8994
9095 Ok ( ( ) )
9196 } )
@@ -101,21 +106,25 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
101106 )
102107 . unwrap ( ) ;
103108
104- // compile this cpp file into a .o file
105- info ! ( "compiling main.cpp" ) ;
106- let output = cpp_compiler
107- . compile_object_file ( "main.cpp" , "intrinsic-test-programs.o" )
108- . unwrap ( ) ;
109- assert ! ( output. status. success( ) , "{output:?}" ) ;
110-
111- let object_files = ( 0 ..chunk_count)
112- . map ( |i| format ! ( "mod_{i}.o" ) )
113- . chain ( [ "intrinsic-test-programs.o" . to_owned ( ) ] ) ;
114-
115- let output = cpp_compiler
116- . link_executable ( object_files, "intrinsic-test-programs" )
117- . unwrap ( ) ;
118- assert ! ( output. status. success( ) , "{output:?}" ) ;
109+ // This is done because `cpp_compiler_wrapped` is None when
110+ // the --generate-only flag is passed
111+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
112+ // compile this cpp file into a .o file
113+ info ! ( "compiling main.cpp" ) ;
114+ let output = cpp_compiler
115+ . compile_object_file ( "main.cpp" , "intrinsic-test-programs.o" )
116+ . unwrap ( ) ;
117+ assert ! ( output. status. success( ) , "{output:?}" ) ;
118+
119+ let object_files = ( 0 ..chunk_count)
120+ . map ( |i| format ! ( "mod_{i}.o" ) )
121+ . chain ( [ "intrinsic-test-programs.o" . to_owned ( ) ] ) ;
122+
123+ let output = cpp_compiler
124+ . link_executable ( object_files, "intrinsic-test-programs" )
125+ . unwrap ( ) ;
126+ assert ! ( output. status. success( ) , "{output:?}" ) ;
127+ }
119128
120129 true
121130 }
0 commit comments