about summary refs log tree commit diff
path: root/src/compiletest
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-03-15 12:58:49 -0700
committerbors <bors@rust-lang.org>2016-03-15 12:58:49 -0700
commit74dfc1ddd9d6a9f541bc526c3401b92bcd16bd2b (patch)
treed950290c3d93779e86005b4dcafa2194912a5aad /src/compiletest
parent1efa752ea694f7ae125cdaf7911ad44b8e6b0e33 (diff)
parentd23fd711eb1af9ba505e239552fd691c32807a31 (diff)
downloadrust-74dfc1ddd9d6a9f541bc526c3401b92bcd16bd2b.tar.gz
rust-74dfc1ddd9d6a9f541bc526c3401b92bcd16bd2b.zip
Auto merge of #31887 - SimonSapin:quiet-test, r=alexcrichton
Shorter output for `rustc --test` binaries.

Until now, a program created with `rustc --test` prints at least one line per test. This can be very verbose, especially with [data-driven tests](https://internals.rust-lang.org/t/test-and-external-test-harnesses/3145) when hundreds or thousands of tests is not rare.

This changes the default output to one character per test (except metrics and benchmarks results which have additional data to show):

```
     Running target/debug/wpt-75c594dc1e6e6187

running 314 tests
..............................................................................
..............................................................................
..............................................................................
..............................................................................
..
test result: ok. 314 passed; 0 failed; 0 ignored; 0 measured
```

<s>The previous behavior is available by passing `--verbose` to the test program. Maybe `cargo test --verbose` could be changed to do that?</s> **Edit:** the default is now unchanged, `-q` or `--quiet` enables the new output.
Diffstat (limited to 'src/compiletest')
-rw-r--r--src/compiletest/common.rs5
-rw-r--r--src/compiletest/compiletest.rs4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index e66094dc395..33ec974c527 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -155,5 +155,8 @@ pub struct Config {
     pub lldb_python_dir: Option<String>,
 
     // Explain what's going on
-    pub verbose: bool
+    pub verbose: bool,
+
+    // Print one character per test instead of one line
+    pub quiet: bool,
 }
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 458a3a8c739..cf467e60fe3 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -77,6 +77,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
           optopt("", "host-rustcflags", "flags to pass to rustc for host", "FLAGS"),
           optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS"),
           optflag("", "verbose", "run tests verbosely, showing all output"),
+          optflag("", "quiet", "print one character per test instead of one line"),
           optopt("", "logfile", "file to log test execution to", "FILE"),
           optopt("", "target", "the target to build for", "TARGET"),
           optopt("", "host", "the host to build for", "HOST"),
@@ -151,6 +152,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
             !opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
         lldb_python_dir: matches.opt_str("lldb-python-dir"),
         verbose: matches.opt_present("verbose"),
+        quiet: matches.opt_present("quiet"),
     }
 }
 
@@ -184,6 +186,7 @@ pub fn log_config(config: &Config) {
     logv(c, format!("adb_device_status: {}",
                     config.adb_device_status));
     logv(c, format!("verbose: {}", config.verbose));
+    logv(c, format!("quiet: {}", config.quiet));
     logv(c, format!("\n"));
 }
 
@@ -247,6 +250,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
     test::TestOpts {
         filter: config.filter.clone(),
         run_ignored: config.run_ignored,
+        quiet: config.quiet,
         logfile: config.logfile.clone(),
         run_tests: true,
         bench_benchmarks: true,