use std::str::FromStr;
use std::path::PathBuf;
-use test::ColorConfig;
+use test::{ColorConfig, TestPaths};
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Mode {
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";
pub ignore: bool,
pub should_fail: bool,
pub aux: Vec<String>,
+ pub revisions: Vec<String>,
}
impl EarlyProps {
ignore: false,
should_fail: false,
aux: Vec::new(),
+ revisions: vec![],
};
iter_header(testfile,
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");
});
use getopts::Options;
use common::Config;
use common::{DebugInfoGdb, DebugInfoLldb, Mode, Pretty};
+use common::{expected_output_path, UI_EXTENSIONS};
use test::{ColorConfig, TestPaths};
use util::logv;
inputs.push(mtime(&rustdoc_path));
inputs.push(mtime(&rust_src_dir.join("src/etc/htmldocck.py")));
}
+
+ // UI test files.
+ for extension in UI_EXTENSIONS {
+ for revision in &props.revisions {
+ let path = &expected_output_path(testpaths, Some(revision), extension);
+ inputs.push(mtime(path));
+ }
+
+ if props.revisions.is_empty() {
+ let path = &expected_output_path(testpaths, None, extension);
+ inputs.push(mtime(path));
+ }
+ }
+
inputs.iter().any(|input| *input > stamp)
}
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
use common::{Codegen, CodegenUnits, DebugInfoGdb, DebugInfoLldb, Rustdoc};
use common::{Incremental, MirOpt, RunMake, Ui};
+use common::{expected_output_path, UI_STDERR, UI_STDOUT};
use diff;
use errors::{self, Error, ErrorKind};
use filetime::FileTime;
let proc_res = self.compile_test();
- let expected_stderr_path = self.expected_output_path("stderr");
+ let expected_stderr_path = self.expected_output_path(UI_STDERR);
let expected_stderr = self.load_expected_output(&expected_stderr_path);
- let expected_stdout_path = self.expected_output_path("stdout");
+ let expected_stdout_path = self.expected_output_path(UI_STDOUT);
let expected_stdout = self.load_expected_output(&expected_stdout_path);
let normalized_stdout =
}
fn expected_output_path(&self, kind: &str) -> PathBuf {
- let extension = match self.revision {
- Some(r) => format!("{}.{}", r, kind),
- None => kind.to_string(),
- };
- self.testpaths.file.with_extension(extension)
+ expected_output_path(&self.testpaths, self.revision, kind)
}
fn load_expected_output(&self, path: &Path) -> String {