@@ -37,7 +37,7 @@ use filetime::FileTime;
37
37
use getopts:: { optopt, optflag, reqopt} ;
38
38
use common:: Config ;
39
39
use common:: { Pretty , DebugInfoGdb , DebugInfoLldb , Mode } ;
40
- use test:: TestPaths ;
40
+ use test:: { TestPaths , ColorConfig } ;
41
41
use util:: logv;
42
42
43
43
use self :: header:: EarlyProps ;
@@ -90,6 +90,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
90
90
optopt( "" , "target-rustcflags" , "flags to pass to rustc for target" , "FLAGS" ) ,
91
91
optflag( "" , "verbose" , "run tests verbosely, showing all output" ) ,
92
92
optflag( "" , "quiet" , "print one character per test instead of one line" ) ,
93
+ optopt( "" , "color" , "coloring: auto, always, never" , "WHEN" ) ,
93
94
optopt( "" , "logfile" , "file to log test execution to" , "FILE" ) ,
94
95
optopt( "" , "target" , "the target to build for" , "TARGET" ) ,
95
96
optopt( "" , "host" , "the host to build for" , "HOST" ) ,
@@ -147,6 +148,13 @@ pub fn parse_config(args: Vec<String> ) -> Config {
147
148
148
149
let ( gdb, gdb_version, gdb_native_rust) = analyze_gdb ( matches. opt_str ( "gdb" ) ) ;
149
150
151
+ let color = match matches. opt_str ( "color" ) . as_ref ( ) . map ( |x| & * * x) {
152
+ Some ( "auto" ) | None => ColorConfig :: AutoColor ,
153
+ Some ( "always" ) => ColorConfig :: AlwaysColor ,
154
+ Some ( "never" ) => ColorConfig :: NeverColor ,
155
+ Some ( x) => panic ! ( "argument for --color must be auto, always, or never, but found `{}`" , x) ,
156
+ } ;
157
+
150
158
Config {
151
159
compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
152
160
run_lib_path : make_absolute ( opt_path ( matches, "run-lib-path" ) ) ,
@@ -185,6 +193,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
185
193
lldb_python_dir : matches. opt_str ( "lldb-python-dir" ) ,
186
194
verbose : matches. opt_present ( "verbose" ) ,
187
195
quiet : matches. opt_present ( "quiet" ) ,
196
+ color : color,
188
197
remote_test_client : matches. opt_str ( "remote-test-client" ) . map ( PathBuf :: from) ,
189
198
190
199
cc : matches. opt_str ( "cc" ) . unwrap ( ) ,
@@ -332,7 +341,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
332
341
Ok ( val) => & val != "0" ,
333
342
Err ( _) => false
334
343
} ,
335
- color : test :: AutoColor ,
344
+ color : config . color ,
336
345
test_threads : None ,
337
346
skip : vec ! [ ] ,
338
347
list : false ,
0 commit comments