Skip to content

Commit b5825e3

Browse files
Rollup merge of rust-lang#48880 - petrochenkov:badstderr, r=kennytm
tidy: Add a check for stray `.stderr` and `.stdout` files in UI test directories
2 parents 29d5b73 + c1a73d2 commit b5825e3

File tree

7 files changed

+28
-140
lines changed

7 files changed

+28
-140
lines changed

Diff for: src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr

-19
This file was deleted.

Diff for: src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr

-45
This file was deleted.

Diff for: src/test/ui/resolve-error.stderr

-62
This file was deleted.

Diff for: src/test/ui/span/loan-extend.stderr

-14
This file was deleted.

Diff for: src/tools/tidy/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub mod features;
5151
pub mod cargo;
5252
pub mod pal;
5353
pub mod deps;
54+
pub mod ui_tests;
5455
pub mod unstable_book;
5556

5657
fn filter_dirs(path: &Path) -> bool {

Diff for: src/tools/tidy/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ fn main() {
4545
deps::check(&path, &mut bad);
4646
}
4747
deps::check_whitelist(&path, &cargo, &mut bad);
48+
ui_tests::check(&path, &mut bad);
4849

4950
if bad {
5051
eprintln!("some tidy checks failed");

Diff for: src/tools/tidy/src/ui_tests.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Tidy check to ensure that there are no stray `.stderr` files in UI test directories.
12+
13+
use std::path::Path;
14+
15+
pub fn check(path: &Path, bad: &mut bool) {
16+
super::walk_many(&[&path.join("test/ui"), &path.join("test/ui-fulldeps")],
17+
&mut |_| false,
18+
&mut |file_path| {
19+
if let Some(ext) = file_path.extension() {
20+
if (ext == "stderr" || ext == "stdout") && !file_path.with_extension("rs").exists() {
21+
println!("Stray file with UI testing output: {:?}", file_path);
22+
*bad = true;
23+
}
24+
}
25+
});
26+
}

0 commit comments

Comments
 (0)