about summary refs log tree commit diff
path: root/src/libtest
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2016-09-20 14:27:48 -0500
committerJorge Aparicio <japaricious@gmail.com>2016-09-20 14:27:48 -0500
commitadf85d35c70916297729a157f93df08d0c15be6c (patch)
tree661b3dd1abb072e349c01d2d98eb9bd47dc6d618 /src/libtest
parent2c2552b712386dd01a9d620aff960b98cddb4098 (diff)
downloadrust-adf85d35c70916297729a157f93df08d0c15be6c.tar.gz
rust-adf85d35c70916297729a157f93df08d0c15be6c.zip
libtest: add a --skip flag to the test runner
This flag takes a FILTER argument and instructs the test runner to skip
the tests whose names contain the word FILTER. --skip can be used
several times.
Diffstat (limited to 'src/libtest')
-rw-r--r--src/libtest/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 2b4193306dd..3b97246ea14 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -303,6 +303,7 @@ pub struct TestOpts {
     pub color: ColorConfig,
     pub quiet: bool,
     pub test_threads: Option<usize>,
+    pub skip: Vec<String>,
 }
 
 impl TestOpts {
@@ -318,6 +319,7 @@ impl TestOpts {
             color: AutoColor,
             quiet: false,
             test_threads: None,
+            skip: vec![],
         }
     }
 }
@@ -337,6 +339,8 @@ fn optgroups() -> Vec<getopts::OptGroup> {
                                          task, allow printing directly"),
       getopts::optopt("", "test-threads", "Number of threads used for running tests \
                                            in parallel", "n_threads"),
+      getopts::optmulti("", "skip", "Skip tests whose names contain FILTER (this flag can \
+                                     be used multiple times)","FILTER"),
       getopts::optflag("q", "quiet", "Display one character per test instead of one line"),
       getopts::optopt("", "color", "Configure coloring of output:
             auto   = colorize if stdout is a tty and tests are run on serially (default);
@@ -446,6 +450,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
         color: color,
         quiet: quiet,
         test_threads: test_threads,
+        skip: matches.opt_strs("skip"),
     };
 
     Some(Ok(test_opts))
@@ -1095,6 +1100,11 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
         }
     };
 
+    // Skip tests that match any of the skip filters
+    filtered = filtered.into_iter()
+        .filter(|t| !opts.skip.iter().any(|sf| t.desc.name.as_slice().contains(&sf[..])))
+        .collect();
+
     // Maybe pull out the ignored test and unignore them
     filtered = if !opts.run_ignored {
         filtered