Merge remote-tracking branch 'origin/master' into frewsxcv-san
This commit is contained in:
commit
d482de30ea
1600 changed files with 29527 additions and 21534 deletions
|
|
@ -10,8 +10,6 @@ use test::ColorConfig;
|
|||
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub enum Mode {
|
||||
CompileFail,
|
||||
RunFail,
|
||||
RunPassValgrind,
|
||||
Pretty,
|
||||
DebugInfo,
|
||||
|
|
@ -42,8 +40,6 @@ impl FromStr for Mode {
|
|||
type Err = ();
|
||||
fn from_str(s: &str) -> Result<Mode, ()> {
|
||||
match s {
|
||||
"compile-fail" => Ok(CompileFail),
|
||||
"run-fail" => Ok(RunFail),
|
||||
"run-pass-valgrind" => Ok(RunPassValgrind),
|
||||
"pretty" => Ok(Pretty),
|
||||
"debuginfo" => Ok(DebugInfo),
|
||||
|
|
@ -65,8 +61,6 @@ impl FromStr for Mode {
|
|||
impl fmt::Display for Mode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let s = match *self {
|
||||
CompileFail => "compile-fail",
|
||||
RunFail => "run-fail",
|
||||
RunPassValgrind => "run-pass-valgrind",
|
||||
Pretty => "pretty",
|
||||
DebugInfo => "debuginfo",
|
||||
|
|
@ -127,6 +121,8 @@ pub enum CompareMode {
|
|||
Nll,
|
||||
Polonius,
|
||||
Chalk,
|
||||
SplitDwarf,
|
||||
SplitDwarfSingle,
|
||||
}
|
||||
|
||||
impl CompareMode {
|
||||
|
|
@ -135,6 +131,8 @@ impl CompareMode {
|
|||
CompareMode::Nll => "nll",
|
||||
CompareMode::Polonius => "polonius",
|
||||
CompareMode::Chalk => "chalk",
|
||||
CompareMode::SplitDwarf => "split-dwarf",
|
||||
CompareMode::SplitDwarfSingle => "split-dwarf-single",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +141,8 @@ impl CompareMode {
|
|||
"nll" => CompareMode::Nll,
|
||||
"polonius" => CompareMode::Polonius,
|
||||
"chalk" => CompareMode::Chalk,
|
||||
"split-dwarf" => CompareMode::SplitDwarf,
|
||||
"split-dwarf-single" => CompareMode::SplitDwarfSingle,
|
||||
x => panic!("unknown --compare-mode option: {}", x),
|
||||
}
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ pub struct Config {
|
|||
/// The name of the stage being built (stage1, etc)
|
||||
pub stage_id: String,
|
||||
|
||||
/// The test mode, compile-fail, run-fail, ui
|
||||
/// The test mode, e.g. ui or debuginfo.
|
||||
pub mode: Mode,
|
||||
|
||||
/// The test suite (essentially which directory is running, but without the
|
||||
|
|
@ -327,6 +327,9 @@ pub struct Config {
|
|||
/// created in `/<build_base>/rustfix_missing_coverage.txt`
|
||||
pub rustfix_coverage: bool,
|
||||
|
||||
/// whether to run `tidy` when a rustdoc test fails
|
||||
pub has_tidy: bool,
|
||||
|
||||
// Configuration for various run-make tests frobbing things like C compilers
|
||||
// or querying about various LLVM component information.
|
||||
pub cc: String,
|
||||
|
|
|
|||
|
|
@ -542,10 +542,7 @@ impl TestProps {
|
|||
}
|
||||
|
||||
if self.failure_status == -1 {
|
||||
self.failure_status = match config.mode {
|
||||
Mode::RunFail => 101,
|
||||
_ => 1,
|
||||
};
|
||||
self.failure_status = 1;
|
||||
}
|
||||
if self.should_ice {
|
||||
self.failure_status = 101;
|
||||
|
|
@ -852,6 +849,8 @@ impl Config {
|
|||
Some(CompareMode::Nll) => name == "compare-mode-nll",
|
||||
Some(CompareMode::Polonius) => name == "compare-mode-polonius",
|
||||
Some(CompareMode::Chalk) => name == "compare-mode-chalk",
|
||||
Some(CompareMode::SplitDwarf) => name == "compare-mode-split-dwarf",
|
||||
Some(CompareMode::SplitDwarfSingle) => name == "compare-mode-split-dwarf-single",
|
||||
None => false,
|
||||
} ||
|
||||
(cfg!(debug_assertions) && name == "debug") ||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use std::ffi::OsString;
|
|||
use std::fs;
|
||||
use std::io::{self, ErrorKind};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::time::SystemTime;
|
||||
use test::ColorConfig;
|
||||
use tracing::*;
|
||||
|
|
@ -43,6 +43,10 @@ fn main() {
|
|||
panic!("Can't find Valgrind to run Valgrind tests");
|
||||
}
|
||||
|
||||
if !config.has_tidy && config.mode == Mode::Rustdoc {
|
||||
eprintln!("warning: `tidy` is not installed; generated diffs will be harder to read");
|
||||
}
|
||||
|
||||
log_config(&config);
|
||||
run_tests(config);
|
||||
}
|
||||
|
|
@ -67,7 +71,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
"",
|
||||
"mode",
|
||||
"which sort of compile tests to run",
|
||||
"compile-fail | run-fail | run-pass-valgrind | pretty | debug-info | codegen | rustdoc \
|
||||
"run-pass-valgrind | pretty | debug-info | codegen | rustdoc \
|
||||
| rustdoc-json | codegen-units | incremental | run-make | ui | js-doc-test | mir-opt | assembly",
|
||||
)
|
||||
.reqopt(
|
||||
|
|
@ -189,6 +193,11 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
|
||||
let src_base = opt_path(matches, "src-base");
|
||||
let run_ignored = matches.opt_present("ignored");
|
||||
let has_tidy = Command::new("tidy")
|
||||
.arg("--version")
|
||||
.stdout(Stdio::null())
|
||||
.status()
|
||||
.map_or(false, |status| status.success());
|
||||
Config {
|
||||
bless: matches.opt_present("bless"),
|
||||
compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")),
|
||||
|
|
@ -244,6 +253,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
|||
remote_test_client: matches.opt_str("remote-test-client").map(PathBuf::from),
|
||||
compare_mode: matches.opt_str("compare-mode").map(CompareMode::parse),
|
||||
rustfix_coverage: matches.opt_present("rustfix-coverage"),
|
||||
has_tidy,
|
||||
|
||||
cc: matches.opt_str("cc").unwrap(),
|
||||
cxx: matches.opt_str("cxx").unwrap(),
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ use crate::common::{output_base_dir, output_base_name, output_testname_unique};
|
|||
use crate::common::{Assembly, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui};
|
||||
use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc};
|
||||
use crate::common::{CompareMode, FailMode, PassMode};
|
||||
use crate::common::{CompileFail, Pretty, RunFail, RunPassValgrind};
|
||||
use crate::common::{Config, TestPaths};
|
||||
use crate::common::{Pretty, RunPassValgrind};
|
||||
use crate::common::{UI_RUN_STDERR, UI_RUN_STDOUT};
|
||||
use crate::errors::{self, Error, ErrorKind};
|
||||
use crate::header::TestProps;
|
||||
|
|
@ -330,13 +330,11 @@ impl<'test> TestCx<'test> {
|
|||
/// revisions, exactly once, with revision == None).
|
||||
fn run_revision(&self) {
|
||||
if self.props.should_ice {
|
||||
if self.config.mode != CompileFail && self.config.mode != Incremental {
|
||||
if self.config.mode != Incremental {
|
||||
self.fatal("cannot use should-ice in a test that is not cfail");
|
||||
}
|
||||
}
|
||||
match self.config.mode {
|
||||
CompileFail => self.run_cfail_test(),
|
||||
RunFail => self.run_rfail_test(),
|
||||
RunPassValgrind => self.run_valgrind_test(),
|
||||
Pretty => self.run_pretty_test(),
|
||||
DebugInfo => self.run_debuginfo_test(),
|
||||
|
|
@ -377,7 +375,6 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
fn should_compile_successfully(&self, pm: Option<PassMode>) -> bool {
|
||||
match self.config.mode {
|
||||
CompileFail => false,
|
||||
JsDocTest => true,
|
||||
Ui => pm.is_some() || self.props.fail_mode > Some(FailMode::Build),
|
||||
Incremental => {
|
||||
|
|
@ -1537,8 +1534,8 @@ impl<'test> TestCx<'test> {
|
|||
};
|
||||
|
||||
let allow_unused = match self.config.mode {
|
||||
CompileFail | Ui => {
|
||||
// compile-fail and ui tests tend to have tons of unused code as
|
||||
Ui => {
|
||||
// UI tests tend to have tons of unused code as
|
||||
// it's just testing various pieces of the compile, but we don't
|
||||
// want to actually assert warnings about all this code. Instead
|
||||
// let's just ignore unused code warnings by defaults and tests
|
||||
|
|
@ -1940,7 +1937,7 @@ impl<'test> TestCx<'test> {
|
|||
}
|
||||
|
||||
match self.config.mode {
|
||||
CompileFail | Incremental => {
|
||||
Incremental => {
|
||||
// If we are extracting and matching errors in the new
|
||||
// fashion, then you want JSON mode. Old-skool error
|
||||
// patterns still match the raw compiler output.
|
||||
|
|
@ -1975,8 +1972,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
rustc.arg(dir_opt);
|
||||
}
|
||||
RunFail | RunPassValgrind | Pretty | DebugInfo | Codegen | Rustdoc | RustdocJson
|
||||
| RunMake | CodegenUnits | JsDocTest | Assembly => {
|
||||
RunPassValgrind | Pretty | DebugInfo | Codegen | Rustdoc | RustdocJson | RunMake
|
||||
| CodegenUnits | JsDocTest | Assembly => {
|
||||
// do not use JSON output
|
||||
}
|
||||
}
|
||||
|
|
@ -2017,6 +2014,12 @@ impl<'test> TestCx<'test> {
|
|||
Some(CompareMode::Chalk) => {
|
||||
rustc.args(&["-Zchalk"]);
|
||||
}
|
||||
Some(CompareMode::SplitDwarf) => {
|
||||
rustc.args(&["-Zsplit-dwarf=split"]);
|
||||
}
|
||||
Some(CompareMode::SplitDwarfSingle) => {
|
||||
rustc.args(&["-Zsplit-dwarf=single"]);
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
|
|
@ -2394,7 +2397,8 @@ impl<'test> TestCx<'test> {
|
|||
|
||||
let proc_res = new_rustdoc.document(&compare_dir);
|
||||
if !proc_res.status.success() {
|
||||
proc_res.fatal(Some("failed to run nightly rustdoc"), || ());
|
||||
eprintln!("failed to run nightly rustdoc");
|
||||
return;
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
|
|
@ -2408,28 +2412,22 @@ impl<'test> TestCx<'test> {
|
|||
"-modify",
|
||||
];
|
||||
let tidy_dir = |dir| {
|
||||
let tidy = |file: &_| {
|
||||
Command::new("tidy")
|
||||
.args(&tidy_args)
|
||||
.arg(file)
|
||||
.spawn()
|
||||
.unwrap_or_else(|err| {
|
||||
self.fatal(&format!("failed to run tidy - is it installed? - {}", err))
|
||||
})
|
||||
.wait()
|
||||
.unwrap()
|
||||
};
|
||||
for entry in walkdir::WalkDir::new(dir) {
|
||||
let entry = entry.expect("failed to read file");
|
||||
if entry.file_type().is_file()
|
||||
&& entry.path().extension().and_then(|p| p.to_str()) == Some("html".into())
|
||||
{
|
||||
tidy(entry.path());
|
||||
let status =
|
||||
Command::new("tidy").args(&tidy_args).arg(entry.path()).status().unwrap();
|
||||
// `tidy` returns 1 if it modified the file.
|
||||
assert!(status.success() || status.code() == Some(1));
|
||||
}
|
||||
}
|
||||
};
|
||||
tidy_dir(out_dir);
|
||||
tidy_dir(&compare_dir);
|
||||
if self.config.has_tidy {
|
||||
tidy_dir(out_dir);
|
||||
tidy_dir(&compare_dir);
|
||||
}
|
||||
|
||||
let pager = {
|
||||
let output = Command::new("git").args(&["config", "--get", "core.pager"]).output().ok();
|
||||
|
|
@ -2442,7 +2440,8 @@ impl<'test> TestCx<'test> {
|
|||
})
|
||||
};
|
||||
let mut diff = Command::new("diff");
|
||||
diff.args(&["-u", "-r"]).args(&[out_dir, &compare_dir]);
|
||||
// diff recursively, showing context, and excluding .css files
|
||||
diff.args(&["-u", "-r", "-x", "*.css"]).args(&[&compare_dir, out_dir]);
|
||||
|
||||
let output = if let Some(pager) = pager {
|
||||
let diff_pid = diff.stdout(Stdio::piped()).spawn().expect("failed to run `diff`");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue