File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ pub struct TestProps {
9494 // Extra flags to pass to the compiler
9595 pub compile_flags : Vec < String > ,
9696 // Extra flags to pass when the compiled code is run (such as --bench)
97- pub run_flags : Option < String > ,
97+ pub run_flags : Vec < String > ,
9898 // If present, the name of a file that this test should match when
9999 // pretty-printed
100100 pub pp_exact : Option < PathBuf > ,
@@ -262,7 +262,7 @@ impl TestProps {
262262 error_patterns : vec ! [ ] ,
263263 regex_error_patterns : vec ! [ ] ,
264264 compile_flags : vec ! [ ] ,
265- run_flags : None ,
265+ run_flags : vec ! [ ] ,
266266 pp_exact : None ,
267267 aux_builds : vec ! [ ] ,
268268 aux_bins : vec ! [ ] ,
@@ -399,7 +399,9 @@ impl TestProps {
399399
400400 config. parse_and_update_revisions ( ln, & mut self . revisions ) ;
401401
402- config. set_name_value_directive ( ln, RUN_FLAGS , & mut self . run_flags , |r| r) ;
402+ if let Some ( flags) = config. parse_name_value_directive ( ln, RUN_FLAGS ) {
403+ self . run_flags . extend ( split_flags ( & flags) ) ;
404+ }
403405
404406 if self . pp_exact . is_none ( ) {
405407 self . pp_exact = config. parse_pp_exact ( ln, testfile) ;
Original file line number Diff line number Diff line change @@ -2355,7 +2355,7 @@ impl<'test> TestCx<'test> {
23552355 args. push ( exe_file. into_os_string ( ) ) ;
23562356
23572357 // Add the arguments in the run_flags directive
2358- args. extend ( self . split_maybe_args ( & self . props . run_flags ) ) ;
2358+ args. extend ( self . props . run_flags . iter ( ) . map ( OsString :: from ) ) ;
23592359
23602360 let prog = args. remove ( 0 ) ;
23612361 ProcArgs { prog, args }
@@ -4174,10 +4174,12 @@ impl<'test> TestCx<'test> {
41744174 }
41754175
41764176 fn normalize_output ( & self , output : & str , custom_rules : & [ ( String , String ) ] ) -> String {
4177- let rflags = self . props . run_flags . as_ref ( ) ;
4177+ // Crude heuristic to detect when the output should have JSON-specific
4178+ // normalization steps applied.
4179+ let rflags = self . props . run_flags . join ( " " ) ;
41784180 let cflags = self . props . compile_flags . join ( " " ) ;
4179- let json = rflags
4180- . map_or ( false , |s| s . contains ( "--format json" ) || s . contains ( "--format =json") )
4181+ let json = rflags. contains ( "--format json" )
4182+ || rflags . contains ( "--format=json" )
41814183 || cflags. contains ( "--error-format json" )
41824184 || cflags. contains ( "--error-format pretty-json" )
41834185 || cflags. contains ( "--error-format=json" )
Original file line number Diff line number Diff line change @@ -123,9 +123,7 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse
123123 cargo. env ( "RUSTDOCFLAGS" , test_props. compile_flags . join ( " " ) ) ;
124124 }
125125
126- if let Some ( flags) = & test_props. run_flags {
127- cargo. arg ( flags) ;
128- }
126+ cargo. args ( & test_props. run_flags ) ;
129127 }
130128
131129 if try_run ( & mut cargo, config. verbose ) . is_err ( ) {
You can’t perform that action at this time.
0 commit comments