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