about summary refs log tree commit diff
path: root/src/compiletest
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2013-08-23 15:30:23 -0700
committerGraydon Hoare <graydon@mozilla.com>2013-08-23 15:30:23 -0700
commit2fb5c49abbab97820f24b8574e574dde1f344249 (patch)
tree0c1d9e5b9e2a99f608c0f0f76c605f23c9b808ab /src/compiletest
parent2c0f9bd35493def5e23f0f43ddeba54da9d788b4 (diff)
downloadrust-2fb5c49abbab97820f24b8574e574dde1f344249.tar.gz
rust-2fb5c49abbab97820f24b8574e574dde1f344249.zip
test: add support for sharding testsuite by passing --test-shard=a.b
Diffstat (limited to 'src/compiletest')
-rw-r--r--src/compiletest/common.rs5
-rw-r--r--src/compiletest/compiletest.rs7
2 files changed, 12 insertions, 0 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index bc5741de2b9..3ae3600cf88 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -68,6 +68,11 @@ pub struct config {
     // Percent change in metrics to consider noise
     ratchet_noise_percent: Option<f64>,
 
+    // "Shard" of the testsuite to run: this has the form of
+    // two numbers (a,b), and causes only those tests with
+    // positional order equal to a mod b to run.
+    test_shard: Option<(uint,uint)>,
+
     // A command line to prefix program execution with,
     // for running under valgrind
     runtool: Option<~str>,
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 4262aba9a85..8de79749b54 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -75,6 +75,7 @@ pub fn parse_config(args: ~[~str]) -> config {
           optopt("", "target", "the target to build for", "TARGET"),
           optopt("", "adb-path", "path to the android debugger", "PATH"),
           optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
+          optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"),
           optflag("h", "help", "show this message"),
          ];
 
@@ -148,6 +149,7 @@ pub fn parse_config(args: ~[~str]) -> config {
                     ~"") { true }
                 else { false }
             } else { false },
+        test_shard: test::opt_shard(getopts::opt_maybe_str(matches, "test-shard")),
         verbose: getopts::opt_present(matches, "verbose")
     }
 }
@@ -172,6 +174,10 @@ pub fn log_config(config: &config) {
     logv(c, fmt!("adb_path: %s", config.adb_path));
     logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
     logv(c, fmt!("adb_device_status: %b", config.adb_device_status));
+    match config.test_shard {
+        None => logv(c, ~"test_shard: (all)"),
+        Some((a,b)) => logv(c, fmt!("test_shard: %u.%u", a, b))
+    }
     logv(c, fmt!("verbose: %b", config.verbose));
     logv(c, fmt!("\n"));
 }
@@ -234,6 +240,7 @@ pub fn test_opts(config: &config) -> test::TestOpts {
         ratchet_metrics: config.ratchet_metrics.clone(),
         ratchet_noise_percent: config.ratchet_noise_percent.clone(),
         save_metrics: config.save_metrics.clone(),
+        test_shard: config.test_shard.clone()
     }
 }