@@ -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
@@ -69,28 +69,31 @@ 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
+ fs:: create_dir_all ( "c_programs" ) . unwrap ( ) ;
75
76
self . intrinsics
76
77
. par_chunks ( chunk_size)
77
78
. enumerate ( )
78
79
. map ( |( i, chunk) | {
79
80
let c_filename = format ! ( "c_programs/mod_{i}.cpp" ) ;
80
- let mut file = File :: create ( & c_filename) . unwrap ( ) ;
81
+ let mut file = fs :: File :: create ( & c_filename) . unwrap ( ) ;
81
82
write_mod_cpp ( & mut file, notice, c_target, platform_headers, chunk) . unwrap ( ) ;
82
83
83
84
// 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:?}" ) ;
85
+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
86
+ let output = cpp_compiler
87
+ . compile_object_file ( & format ! ( "mod_{i}.cpp" ) , & format ! ( "mod_{i}.o" ) ) ?;
88
+ assert ! ( output. status. success( ) , "{output:?}" ) ;
89
+ }
87
90
88
91
Ok ( ( ) )
89
92
} )
90
93
. collect :: < Result < ( ) , std:: io:: Error > > ( )
91
94
. unwrap ( ) ;
92
95
93
- let mut file = File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
96
+ let mut file = fs :: File :: create ( "c_programs/main.cpp" ) . unwrap ( ) ;
94
97
write_main_cpp (
95
98
& mut file,
96
99
c_target,
@@ -100,20 +103,22 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
100
103
. unwrap ( ) ;
101
104
102
105
// 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:?}" ) ;
106
+ if let Some ( cpp_compiler) = cpp_compiler_wrapped. as_ref ( ) {
107
+ info ! ( "compiling main.cpp" ) ;
108
+ let output = cpp_compiler
109
+ . compile_object_file ( "main.cpp" , "intrinsic-test-programs.o" )
110
+ . unwrap ( ) ;
111
+ assert ! ( output. status. success( ) , "{output:?}" ) ;
112
+
113
+ let object_files = ( 0 ..chunk_count)
114
+ . map ( |i| format ! ( "mod_{i}.o" ) )
115
+ . chain ( [ "intrinsic-test-programs.o" . to_owned ( ) ] ) ;
116
+
117
+ let output = cpp_compiler
118
+ . link_executable ( object_files, "intrinsic-test-programs" )
119
+ . unwrap ( ) ;
120
+ assert ! ( output. status. success( ) , "{output:?}" ) ;
121
+ }
117
122
118
123
true
119
124
}
@@ -138,7 +143,11 @@ impl SupportedArchitectureTest for ArmArchitectureTest {
138
143
AARCH_CONFIGURATIONS ,
139
144
) ;
140
145
141
- compile_rust_programs ( intrinsics_name_list, toolchain, target, linker)
146
+ if self . cli_options . toolchain . is_some ( ) {
147
+ compile_rust_programs ( intrinsics_name_list, toolchain, target, linker)
148
+ } else {
149
+ true
150
+ }
142
151
}
143
152
144
153
fn compare_outputs ( & self ) -> bool {
0 commit comments