Skip to content

Commit

Permalink
Auto merge of #46533 - nikomatsakis:ui-stamp-files, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Dec 7, 2017
2 parents d516d5d + 7b456c0 commit bd7021f
Show file tree
Hide file tree
Showing 4 changed files with 1,177 additions and 762 deletions.
16 changes: 15 additions & 1 deletion src/tools/compiletest/src/common.rs
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
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

0 comments on commit bd7021f

Please sign in to comment.