Skip to content

Commit bd7021f

Browse files
committed
Auto merge of #46533 - nikomatsakis:ui-stamp-files, r=alexcrichton
compiletest: account for `ui` reference files when deciding to skip The stamp files for compiletest were ignoring `.stderr` and `.stdout` files. This was driving me crazy. r? @alexcrichton
2 parents d516d5d + 7b456c0 commit bd7021f

File tree

4 files changed

+1177
-762
lines changed

4 files changed

+1177
-762
lines changed

src/tools/compiletest/src/common.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::fmt;
1313
use std::str::FromStr;
1414
use std::path::PathBuf;
1515

16-
use test::ColorConfig;
16+
use test::{ColorConfig, TestPaths};
1717

1818
#[derive(Clone, Copy, PartialEq, Debug)]
1919
pub enum Mode {
@@ -221,3 +221,17 @@ pub struct Config {
221221
pub llvm_cxxflags: String,
222222
pub nodejs: Option<String>,
223223
}
224+
225+
/// Used by `ui` tests to generate things like `foo.stderr` from `foo.rs`.
226+
pub fn expected_output_path(testpaths: &TestPaths, revision: Option<&str>, kind: &str) -> PathBuf {
227+
assert!(UI_EXTENSIONS.contains(&kind));
228+
let extension = match revision {
229+
Some(r) => format!("{}.{}", r, kind),
230+
None => kind.to_string(),
231+
};
232+
testpaths.file.with_extension(extension)
233+
}
234+
235+
pub const UI_EXTENSIONS: &[&str] = &[UI_STDERR, UI_STDOUT];
236+
pub const UI_STDERR: &str = "stderr";
237+
pub const UI_STDOUT: &str = "stdout";

src/tools/compiletest/src/header.rs

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub struct EarlyProps {
2626
pub ignore: bool,
2727
pub should_fail: bool,
2828
pub aux: Vec<String>,
29+
pub revisions: Vec<String>,
2930
}
3031

3132
impl EarlyProps {
@@ -34,6 +35,7 @@ impl EarlyProps {
3435
ignore: false,
3536
should_fail: false,
3637
aux: Vec::new(),
38+
revisions: vec![],
3739
};
3840

3941
iter_header(testfile,
@@ -50,6 +52,10 @@ impl EarlyProps {
5052
props.aux.push(s);
5153
}
5254

55+
if let Some(r) = config.parse_revisions(ln) {
56+
props.revisions.extend(r);
57+
}
58+
5359
props.should_fail = props.should_fail || config.parse_name_directive(ln, "should-fail");
5460
});
5561

0 commit comments

Comments
 (0)