Skip to content
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