about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-06 16:12:13 +0000
committerbors <bors@rust-lang.org>2020-11-06 16:12:13 +0000
commit7e9a36fa8a4ec06daec581e23f390389e05f25e4 (patch)
treeafe67d3f71142bcd9766b5f6480c994017da6519 /src/tools
parentdc06a36074f04c6a77b5834f2950011d49607898 (diff)
parentaf50c796faaf68adf01eb16afe86f368a64cc906 (diff)
downloadrust-7e9a36fa8a4ec06daec581e23f390389e05f25e4.tar.gz
rust-7e9a36fa8a4ec06daec581e23f390389e05f25e4.zip
Auto merge of #78810 - JohnTitor:rollup-8fhtvxu, r=JohnTitor
Rollup of 15 pull requests

Successful merges:

 - #74979 (`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit)
 - #78006 (Use Intra-doc links for std::io::buffered)
 - #78167 (Fix unreachable sub-branch detection in or-patterns)
 - #78514 (Allow using 1/2/3/4 for `x.py setup` options)
 - #78538 (BTreeMap: document a curious assumption in test cases)
 - #78559 (Add LLVM upgrades from 7 to 10 to RELEASES.md)
 - #78666 (Fix shellcheck error)
 - #78705 (Print a summary of which test suite failed)
 - #78726 (Add link to rust website)
 - #78730 (Expand explanation of reverse_bits)
 - #78760 (`deny(invalid_codeblock_attributes)` for rustc_error_codes)
 - #78771 (inliner: Copy unevaluated constants only after successful inlining)
 - #78794 (rustc_expand: use collect_bang helper instead of manual reimplementation)
 - #78795 (The renumber pass is long gone)
 - #78798 (Fixing Spelling Typos)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/src/common.rs4
-rw-r--r--src/tools/compiletest/src/header/tests.rs1
-rw-r--r--src/tools/compiletest/src/main.rs32
3 files changed, 35 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 2f832b53a90..24ef98cd784 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -224,6 +224,10 @@ pub struct Config {
     /// The test mode, compile-fail, run-fail, ui
     pub mode: Mode,
 
+    /// The test suite (essentially which directory is running, but without the
+    /// directory prefix such as src/test)
+    pub suite: String,
+
     /// The debugger to use in debuginfo mode. Unset otherwise.
     pub debugger: Option<Debugger>,
 
diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs
index 1f82b137ee6..4bcbd89f095 100644
--- a/src/tools/compiletest/src/header/tests.rs
+++ b/src/tools/compiletest/src/header/tests.rs
@@ -39,6 +39,7 @@ fn config() -> Config {
     let args = &[
         "compiletest",
         "--mode=ui",
+        "--suite=ui",
         "--compile-lib-path=",
         "--run-lib-path=",
         "--rustc-path=",
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 2b2a6cfa8bd..2b167ac8e9f 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -70,6 +70,12 @@ pub fn parse_config(args: Vec<String>) -> Config {
             "compile-fail | run-fail | run-pass-valgrind | pretty | debug-info | codegen | rustdoc \
              codegen-units | incremental | run-make | ui | js-doc-test | mir-opt | assembly",
         )
+        .reqopt(
+            "",
+            "suite",
+            "which suite of compile tests to run. used for nicer error reporting.",
+            "SUITE",
+        )
         .optopt(
             "",
             "pass",
@@ -201,6 +207,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
         build_base: opt_path(matches, "build-base"),
         stage_id: matches.opt_str("stage-id").unwrap(),
         mode: matches.opt_str("mode").unwrap().parse().expect("invalid mode"),
+        suite: matches.opt_str("suite").unwrap(),
         debugger: None,
         run_ignored,
         filter: matches.free.first().cloned(),
@@ -340,7 +347,7 @@ pub fn run_tests(config: Config) {
             configs.extend(configure_lldb(&config));
         }
     } else {
-        configs.push(config);
+        configs.push(config.clone());
     };
 
     let mut tests = Vec::new();
@@ -351,11 +358,32 @@ pub fn run_tests(config: Config) {
     let res = test::run_tests_console(&opts, tests);
     match res {
         Ok(true) => {}
-        Ok(false) => panic!("Some tests failed"),
+        Ok(false) => {
+            // We want to report that the tests failed, but we also want to give
+            // some indication of just what tests we were running. Especially on
+            // CI, where there can be cross-compiled tests for a lot of
+            // architectures, without this critical information it can be quite
+            // easy to miss which tests failed, and as such fail to reproduce
+            // the failure locally.
+
+            eprintln!(
+                "Some tests failed in compiletest suite={}{} mode={} host={} target={}",
+                config.suite,
+                config.compare_mode.map(|c| format!(" compare_mode={:?}", c)).unwrap_or_default(),
+                config.mode,
+                config.host,
+                config.target
+            );
+
+            std::process::exit(1);
+        }
         Err(e) => {
             // We don't know if tests passed or not, but if there was an error
             // during testing we don't want to just suceeed (we may not have
             // tested something), so fail.
+            //
+            // This should realistically "never" happen, so don't try to make
+            // this a pretty error message.
             panic!("I/O failure during tests: {:?}", e);
         }
     }