Fix build tests failing in CI.

--deny=warnings changes the error message for the tests too.
This commit is contained in:
Samuel Guerra 2024-03-31 19:49:50 -03:00
parent f154cf7f8b
commit 91a5177ea2
3 changed files with 9 additions and 7 deletions

View File

@ -8,7 +8,7 @@ on:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: '--codegen=debuginfo=0 --deny=warnings'
RUSTFLAGS: '--codegen=debuginfo=0'
jobs:
test:

View File

@ -277,18 +277,20 @@ fn test(mut args: Vec<&str>) {
)],
);
let mut changes = 0;
let mut changes = vec![];
for m in util::git_modified() {
if let Some(ext) = m.extension() {
if ext == "stderr" && m.starts_with("tests/build/cases") {
changes += 1;
error(format!("build test `{}` modified", m.display()));
util::print_git_diff(&m);
changes.push(m);
}
}
}
if changes > 0 {
fatal(format!("{changes} build tests modified, review and commit"));
if !changes.is_empty() {
for m in &changes {
util::print_git_diff(&m);
}
fatal(format!("{} build tests modified, review and commit", changes.len()));
}
}
} else if take_flag(&mut args, &["--examples"]) {

View File

@ -444,4 +444,4 @@ pub fn git_modified() -> Vec<PathBuf> {
pub fn print_git_diff(file: &std::path::Path) {
Command::new("git").arg("diff").arg(file).status().unwrap();
}
}