@@ -141,7 +141,7 @@ impl TestCase {
141
141
& self ,
142
142
opts : & Opts ,
143
143
bin_path : & Path ,
144
- cli_opts : Option < & str > ,
144
+ cli_opts : & Option < Vec < String > > ,
145
145
) -> Result < Option < Vec < PathBuf > > , TestError > {
146
146
let ( chip_dir, mut process_stderr_paths) = self
147
147
. setup_case ( & opts. output_dir , bin_path, cli_opts)
@@ -175,7 +175,7 @@ impl TestCase {
175
175
& self ,
176
176
output_dir : & Path ,
177
177
svd2rust_bin_path : & Path ,
178
- command : Option < & str > ,
178
+ command : & Option < Vec < String > > ,
179
179
) -> Result < ( PathBuf , Vec < PathBuf > ) , TestError > {
180
180
let user = match std:: env:: var ( "USER" ) {
181
181
Ok ( val) => val,
@@ -211,10 +211,6 @@ impl TestCase {
211
211
. capture_outputs ( true , "cargo init" , None , None , & [ ] )
212
212
. with_context ( || "Failed to cargo init" ) ?;
213
213
214
- let command_split = command
215
- . map ( |cmd| shell_words:: split ( cmd) . context ( "unable to split command into args" ) )
216
- . transpose ( ) ?;
217
-
218
214
self . prepare_chip_test_toml ( & chip_dir, command) ?;
219
215
let chip_svd = self . prepare_svd_file ( & chip_dir) ?;
220
216
self . prepare_rust_toolchain_file ( & chip_dir) ?;
@@ -228,7 +224,7 @@ impl TestCase {
228
224
& chip_dir,
229
225
& lib_rs_file,
230
226
& svd2rust_err_file,
231
- & command_split ,
227
+ command ,
232
228
) ?;
233
229
process_stderr_paths. push ( svd2rust_err_file) ;
234
230
match self . arch {
@@ -331,7 +327,11 @@ impl TestCase {
331
327
Ok ( ( ) )
332
328
}
333
329
334
- fn prepare_chip_test_toml ( & self , chip_dir : & Path , opts : Option < & str > ) -> Result < ( ) , TestError > {
330
+ fn prepare_chip_test_toml (
331
+ & self ,
332
+ chip_dir : & Path ,
333
+ opts : & Option < Vec < String > > ,
334
+ ) -> Result < ( ) , TestError > {
335
335
let svd_toml = path_helper_base ( chip_dir, & [ "Cargo.toml" ] ) ;
336
336
let mut file = OpenOptions :: new ( )
337
337
. append ( true )
@@ -348,8 +348,12 @@ impl TestCase {
348
348
Target :: XtensaLX => [ ] . iter ( ) ,
349
349
Target :: None => unreachable ! ( ) ,
350
350
} )
351
- . chain ( if opts. unwrap_or_default ( ) . contains ( "--atomics" ) {
352
- CRATES_ATOMICS . iter ( )
351
+ . chain ( if let Some ( opts) = opts {
352
+ if opts. iter ( ) . find ( |v| v. contains ( "atomics" ) ) . is_some ( ) {
353
+ CRATES_ATOMICS . iter ( )
354
+ } else {
355
+ [ ] . iter ( )
356
+ }
353
357
} else {
354
358
[ ] . iter ( )
355
359
} )
0 commit comments