File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 2 files changed +11
-7
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 }
@@ -4173,10 +4173,12 @@ impl<'test> TestCx<'test> {
41734173 }
41744174
41754175 fn normalize_output ( & self , output : & str , custom_rules : & [ ( String , String ) ] ) -> String {
4176- let rflags = self . props . run_flags . as_ref ( ) ;
4176+ // Crude heuristic to detect when the output should have JSON-specific
4177+ // normalization steps applied.
4178+ let rflags = self . props . run_flags . join ( " " ) ;
41774179 let cflags = self . props . compile_flags . join ( " " ) ;
4178- let json = rflags
4179- . map_or ( false , |s| s . contains ( "--format json" ) || s . contains ( "--format =json") )
4180+ let json = rflags. contains ( "--format json" )
4181+ || rflags . contains ( "--format=json" )
41804182 || cflags. contains ( "--error-format json" )
41814183 || cflags. contains ( "--error-format pretty-json" )
41824184 || cflags. contains ( "--error-format=json" )
You can’t perform that action at this time.
0 commit comments