@@ -69,7 +69,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
69
69
70
70
let ( chunk_size, chunk_count) = chunk_info ( self . intrinsics . len ( ) ) ;
71
71
72
- let cpp_compiler = compile:: build_cpp_compilation ( & self . cli_options ) . unwrap ( ) ;
72
+ let cpp_compiler_wrapped = compile:: build_cpp_compilation ( & self . cli_options ) ;
73
73
74
74
let notice = & build_notices ( "// " ) ;
75
75
self . intrinsics
@@ -81,9 +81,11 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
81
81
write_mod_cpp ( & mut file, notice, c_target, platform_headers, chunk) . unwrap ( ) ;
82
82
83
83
// 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
+ }
87
89
88
90
Ok ( ( ) )
89
91
} )
@@ -99,21 +101,25 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
99
101
)
100
102
. unwrap ( ) ;
101
103
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 ( ) {
102
107
// 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
+ }
117
123
118
124
true
119
125
}
0 commit comments