Skip to content

compiletest: account for ui reference files when deciding to skip #46533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::fmt;
use std::str::FromStr;
use std::path::PathBuf;

use test::ColorConfig;
use test::{ColorConfig, TestPaths};

#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Mode {
Expand Down Expand Up @@ -221,3 +221,17 @@ pub struct Config {
pub llvm_cxxflags: String,
pub nodejs: Option<String>,
}

/// Used by `ui` tests to generate things like `foo.stderr` from `foo.rs`.
pub fn expected_output_path(testpaths: &TestPaths, revision: Option<&str>, kind: &str) -> PathBuf {
assert!(UI_EXTENSIONS.contains(&kind));
let extension = match revision {
Some(r) => format!("{}.{}", r, kind),
None => kind.to_string(),
};
testpaths.file.with_extension(extension)
}

pub const UI_EXTENSIONS: &[&str] = &[UI_STDERR, UI_STDOUT];
pub const UI_STDERR: &str = "stderr";
pub const UI_STDOUT: &str = "stdout";
6 changes: 6 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct EarlyProps {
pub ignore: bool,
pub should_fail: bool,
pub aux: Vec<String>,
pub revisions: Vec<String>,
}

impl EarlyProps {
Expand All @@ -34,6 +35,7 @@ impl EarlyProps {
ignore: false,
should_fail: false,
aux: Vec::new(),
revisions: vec![],
};

iter_header(testfile,
Expand All @@ -50,6 +52,10 @@ impl EarlyProps {
props.aux.push(s);
}

if let Some(r) = config.parse_revisions(ln) {
props.revisions.extend(r);
}

props.should_fail = props.should_fail || config.parse_name_directive(ln, "should-fail");
});

Expand Down
Loading