show all invalid directives errors rather than just the first one
This commit is contained in:
@@ -851,6 +851,7 @@ pub fn make_test_description<R: Read>(
|
|||||||
path: &Path,
|
path: &Path,
|
||||||
src: R,
|
src: R,
|
||||||
cfg: Option<&str>,
|
cfg: Option<&str>,
|
||||||
|
poisoned: &mut bool,
|
||||||
) -> test::TestDesc {
|
) -> test::TestDesc {
|
||||||
let mut ignore = false;
|
let mut ignore = false;
|
||||||
let mut ignore_message = None;
|
let mut ignore_message = None;
|
||||||
@@ -875,7 +876,8 @@ pub fn make_test_description<R: Read>(
|
|||||||
}
|
}
|
||||||
IgnoreDecision::Error { message } => {
|
IgnoreDecision::Error { message } => {
|
||||||
eprintln!("error: {}: {message}", path.display());
|
eprintln!("error: {}: {message}", path.display());
|
||||||
panic!();
|
*poisoned = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
IgnoreDecision::Continue => {}
|
IgnoreDecision::Continue => {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
|
use std::io::Read;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::common::{Config, Debugger};
|
use crate::common::{Config, Debugger};
|
||||||
use crate::header::{make_test_description, parse_normalization_string, EarlyProps};
|
use crate::header::{parse_normalization_string, EarlyProps};
|
||||||
|
|
||||||
|
fn make_test_description<R: Read>(
|
||||||
|
config: &Config,
|
||||||
|
name: test::TestName,
|
||||||
|
path: &Path,
|
||||||
|
src: R,
|
||||||
|
cfg: Option<&str>,
|
||||||
|
) -> test::TestDesc {
|
||||||
|
let mut poisoned = false;
|
||||||
|
let test = crate::header::make_test_description(config, name, path, src, cfg, &mut poisoned);
|
||||||
|
if poisoned {
|
||||||
|
panic!("poisoned!");
|
||||||
|
}
|
||||||
|
test
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_normalization_string() {
|
fn test_parse_normalization_string() {
|
||||||
|
|||||||
@@ -555,6 +555,8 @@ pub fn make_tests(
|
|||||||
let modified_tests = modified_tests(&config, &config.src_base).unwrap_or_else(|err| {
|
let modified_tests = modified_tests(&config, &config.src_base).unwrap_or_else(|err| {
|
||||||
panic!("modified_tests got error from dir: {}, error: {}", config.src_base.display(), err)
|
panic!("modified_tests got error from dir: {}, error: {}", config.src_base.display(), err)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let mut poisoned = false;
|
||||||
collect_tests_from_dir(
|
collect_tests_from_dir(
|
||||||
config.clone(),
|
config.clone(),
|
||||||
&config.src_base,
|
&config.src_base,
|
||||||
@@ -563,8 +565,14 @@ pub fn make_tests(
|
|||||||
tests,
|
tests,
|
||||||
found_paths,
|
found_paths,
|
||||||
&modified_tests,
|
&modified_tests,
|
||||||
|
&mut poisoned,
|
||||||
)
|
)
|
||||||
.unwrap_or_else(|_| panic!("Could not read tests from {}", config.src_base.display()));
|
.unwrap_or_else(|_| panic!("Could not read tests from {}", config.src_base.display()));
|
||||||
|
|
||||||
|
if poisoned {
|
||||||
|
eprintln!();
|
||||||
|
panic!("there are errors in tests");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a stamp constructed from input files common to all test cases.
|
/// Returns a stamp constructed from input files common to all test cases.
|
||||||
@@ -634,6 +642,7 @@ fn collect_tests_from_dir(
|
|||||||
tests: &mut Vec<test::TestDescAndFn>,
|
tests: &mut Vec<test::TestDescAndFn>,
|
||||||
found_paths: &mut BTreeSet<PathBuf>,
|
found_paths: &mut BTreeSet<PathBuf>,
|
||||||
modified_tests: &Vec<PathBuf>,
|
modified_tests: &Vec<PathBuf>,
|
||||||
|
poisoned: &mut bool,
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
// Ignore directories that contain a file named `compiletest-ignore-dir`.
|
// Ignore directories that contain a file named `compiletest-ignore-dir`.
|
||||||
if dir.join("compiletest-ignore-dir").exists() {
|
if dir.join("compiletest-ignore-dir").exists() {
|
||||||
@@ -645,7 +654,7 @@ fn collect_tests_from_dir(
|
|||||||
file: dir.to_path_buf(),
|
file: dir.to_path_buf(),
|
||||||
relative_dir: relative_dir_path.parent().unwrap().to_path_buf(),
|
relative_dir: relative_dir_path.parent().unwrap().to_path_buf(),
|
||||||
};
|
};
|
||||||
tests.extend(make_test(config, &paths, inputs));
|
tests.extend(make_test(config, &paths, inputs, poisoned));
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,7 +680,7 @@ fn collect_tests_from_dir(
|
|||||||
let paths =
|
let paths =
|
||||||
TestPaths { file: file_path, relative_dir: relative_dir_path.to_path_buf() };
|
TestPaths { file: file_path, relative_dir: relative_dir_path.to_path_buf() };
|
||||||
|
|
||||||
tests.extend(make_test(config.clone(), &paths, inputs))
|
tests.extend(make_test(config.clone(), &paths, inputs, poisoned))
|
||||||
} else if file_path.is_dir() {
|
} else if file_path.is_dir() {
|
||||||
let relative_file_path = relative_dir_path.join(file.file_name());
|
let relative_file_path = relative_dir_path.join(file.file_name());
|
||||||
if &file_name != "auxiliary" {
|
if &file_name != "auxiliary" {
|
||||||
@@ -684,6 +693,7 @@ fn collect_tests_from_dir(
|
|||||||
tests,
|
tests,
|
||||||
found_paths,
|
found_paths,
|
||||||
modified_tests,
|
modified_tests,
|
||||||
|
poisoned,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -710,6 +720,7 @@ fn make_test(
|
|||||||
config: Arc<Config>,
|
config: Arc<Config>,
|
||||||
testpaths: &TestPaths,
|
testpaths: &TestPaths,
|
||||||
inputs: &Stamp,
|
inputs: &Stamp,
|
||||||
|
poisoned: &mut bool,
|
||||||
) -> Vec<test::TestDescAndFn> {
|
) -> Vec<test::TestDescAndFn> {
|
||||||
let test_path = if config.mode == Mode::RunMake {
|
let test_path = if config.mode == Mode::RunMake {
|
||||||
// Parse directives in the Makefile
|
// Parse directives in the Makefile
|
||||||
@@ -726,6 +737,7 @@ fn make_test(
|
|||||||
} else {
|
} else {
|
||||||
early_props.revisions.iter().map(Some).collect()
|
early_props.revisions.iter().map(Some).collect()
|
||||||
};
|
};
|
||||||
|
|
||||||
revisions
|
revisions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|revision| {
|
.map(|revision| {
|
||||||
@@ -733,7 +745,8 @@ fn make_test(
|
|||||||
std::fs::File::open(&test_path).expect("open test file to parse ignores");
|
std::fs::File::open(&test_path).expect("open test file to parse ignores");
|
||||||
let cfg = revision.map(|v| &**v);
|
let cfg = revision.map(|v| &**v);
|
||||||
let test_name = crate::make_test_name(&config, testpaths, revision);
|
let test_name = crate::make_test_name(&config, testpaths, revision);
|
||||||
let mut desc = make_test_description(&config, test_name, &test_path, src_file, cfg);
|
let mut desc =
|
||||||
|
make_test_description(&config, test_name, &test_path, src_file, cfg, poisoned);
|
||||||
// Ignore tests that already run and are up to date with respect to inputs.
|
// Ignore tests that already run and are up to date with respect to inputs.
|
||||||
if !config.force_rerun {
|
if !config.force_rerun {
|
||||||
desc.ignore |= is_up_to_date(
|
desc.ignore |= is_up_to_date(
|
||||||
|
|||||||
Reference in New Issue
Block a user