@@ -114,6 +114,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
114
114
)
115
115
. optflag ( "" , "quiet" , "print one character per test instead of one line" )
116
116
. optopt ( "" , "color" , "coloring: auto, always, never" , "WHEN" )
117
+ . optflag ( "" , "json" , "emit json output instead of plaintext output" )
117
118
. optopt ( "" , "logfile" , "file to log test execution to" , "FILE" )
118
119
. optopt ( "" , "target" , "the target to build for" , "TARGET" )
119
120
. optopt ( "" , "host" , "the host to build for" , "HOST" )
@@ -281,7 +282,12 @@ pub fn parse_config(args: Vec<String>) -> Config {
281
282
&& !opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . is_empty ( ) ,
282
283
lldb_python_dir : matches. opt_str ( "lldb-python-dir" ) ,
283
284
verbose : matches. opt_present ( "verbose" ) ,
284
- quiet : matches. opt_present ( "quiet" ) ,
285
+ format : match ( matches. opt_present ( "quiet" ) , matches. opt_present ( "json" ) ) {
286
+ ( true , true ) => panic ! ( "--quiet and --json are incompatible" ) ,
287
+ ( true , false ) => test:: OutputFormat :: Terse ,
288
+ ( false , true ) => test:: OutputFormat :: Json ,
289
+ ( false , false ) => test:: OutputFormat :: Pretty ,
290
+ } ,
285
291
only_modified : matches. opt_present ( "only-modified" ) ,
286
292
color,
287
293
remote_test_client : matches. opt_str ( "remote-test-client" ) . map ( PathBuf :: from) ,
@@ -339,7 +345,7 @@ pub fn log_config(config: &Config) {
339
345
logv ( c, format ! ( "ar: {}" , config. ar) ) ;
340
346
logv ( c, format ! ( "linker: {:?}" , config. linker) ) ;
341
347
logv ( c, format ! ( "verbose: {}" , config. verbose) ) ;
342
- logv ( c, format ! ( "quiet : {}" , config. quiet ) ) ;
348
+ logv ( c, format ! ( "format : {:? }" , config. format ) ) ;
343
349
logv ( c, "\n " . to_string ( ) ) ;
344
350
}
345
351
@@ -501,7 +507,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
501
507
filters : config. filters . clone ( ) ,
502
508
filter_exact : config. filter_exact ,
503
509
run_ignored : if config. run_ignored { test:: RunIgnored :: Yes } else { test:: RunIgnored :: No } ,
504
- format : if config. quiet { test :: OutputFormat :: Terse } else { test :: OutputFormat :: Pretty } ,
510
+ format : config. format ,
505
511
logfile : config. logfile . clone ( ) ,
506
512
run_tests : true ,
507
513
bench_benchmarks : true ,
0 commit comments