about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-03-13 00:54:30 +0800
committerGitHub <noreply@github.com>2018-03-13 00:54:30 +0800
commit3d2db9bba873bd8b7d526a5c8b45fb45addda41b (patch)
tree22fea032fdbc6d44b7cebe23f6c2424695409fe6 /src/tools
parent5d0918908acb996e5a44a4873532fc9293f630f1 (diff)
parentc1a73d2f4a8ef0003b93c4307930438be4aae9a5 (diff)
downloadrust-3d2db9bba873bd8b7d526a5c8b45fb45addda41b.tar.gz
rust-3d2db9bba873bd8b7d526a5c8b45fb45addda41b.zip
Rollup merge of #48880 - petrochenkov:badstderr, r=kennytm
tidy: Add a check for stray `.stderr` and `.stdout` files in UI test directories
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tidy/src/lib.rs1
-rw-r--r--src/tools/tidy/src/main.rs1
-rw-r--r--src/tools/tidy/src/ui_tests.rs26
3 files changed, 28 insertions, 0 deletions
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index c927ff19b27..06eb055f68e 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -51,6 +51,7 @@ pub mod features;
 pub mod cargo;
 pub mod pal;
 pub mod deps;
+pub mod ui_tests;
 pub mod unstable_book;
 
 fn filter_dirs(path: &Path) -> bool {
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index afa3ebd1983..24974192795 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -45,6 +45,7 @@ fn main() {
         deps::check(&path, &mut bad);
     }
     deps::check_whitelist(&path, &cargo, &mut bad);
+    ui_tests::check(&path, &mut bad);
 
     if bad {
         eprintln!("some tidy checks failed");
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
new file mode 100644
index 00000000000..f7fec2e667a
--- /dev/null
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -0,0 +1,26 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Tidy check to ensure that there are no stray `.stderr` files in UI test directories.
+
+use std::path::Path;
+
+pub fn check(path: &Path, bad: &mut bool) {
+    super::walk_many(&[&path.join("test/ui"), &path.join("test/ui-fulldeps")],
+                     &mut |_| false,
+                     &mut |file_path| {
+        if let Some(ext) = file_path.extension() {
+            if (ext == "stderr" || ext == "stdout") && !file_path.with_extension("rs").exists() {
+                println!("Stray file with UI testing output: {:?}", file_path);
+                *bad = true;
+            }
+        }
+    });
+}