@@ -5,7 +5,7 @@ mod intrinsic;
5
5
mod json_parser;
6
6
mod types;
7
7
8
- use std:: fs:: File ;
8
+ use std:: fs;
9
9
10
10
use rayon:: prelude:: * ;
11
11
@@ -70,28 +70,31 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
70
70
71
71
let ( chunk_size, chunk_count) = chunk_info ( self . intrinsics . len ( ) ) ;
72
72
73
- let cpp_compiler = compile:: build_cpp_compilation ( & self . cli_options ) . unwrap ( ) ;
73
+ let cpp_compiler_wrapped = compile:: build_cpp_compilation ( & self . cli_options ) ;
74
74
75
75
let notice = & build_notices ( "// " ) ;
76
+ fs:: create_dir_all ( "c_programs" ) . unwrap ( ) ;
76
77
self . intrinsics
77
78
. par_chunks ( chunk_size)
78
79
. enumerate ( )
79
80
. map ( |( i, chunk) | {
80
81
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 ( ) ;
82
83
write_mod_cpp ( & mut file, notice, c_target, platform_headers, chunk) . unwrap ( ) ;
83
84
84
85
// 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
+ }
88
91
89
92
Ok ( ( ) )
90
93
} )
91
94
. collect :: < Result < ( ) , std:: io:: Error > > ( )
92
95
. unwrap ( ) ;
93
96
94
- let mut file = File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
97
+ let mut file = fs :: File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
95
98
write_main_cpp (
96
99
& mut file,
97
100
c_target,
@@ -101,20 +104,22 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
101
104
. unwrap ( ) ;
102
105
103
106
// 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
+ }
118
123
119
124
true
120
125
}
@@ -173,7 +178,11 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
173
178
. collect :: < Result < ( ) , std:: io:: Error > > ( )
174
179
. unwrap ( ) ;
175
180
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
+ }
177
186
}
178
187
179
188
fn compare_outputs ( & self ) -> bool {
0 commit comments