Skip to content

Commit

Permalink
Add --no-fail-fast to compiletest (rust-lang#2145)
Browse files Browse the repository at this point in the history
Compiletest behavior has changed to always failing fast after rust-lang#2045. This PR introduces a --no-fail-fast flag to compiletest which will execute the entire suite regardless of failure.

The regression script uses --no-fail-fast so all failures in a suite are printed as part of the CI.
  • Loading branch information
celinval authored Jan 23, 2023
1 parent 55fe61c commit 3b88c9b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/kani-regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ for testp in "${TESTS[@]}"; do
suite=${testl[0]}
mode=${testl[1]}
echo "Check compiletest suite=$suite mode=$mode"
cargo run -p compiletest --quiet -- --suite $suite --mode $mode --quiet
cargo run -p compiletest --quiet -- --suite $suite --mode $mode \
--quiet --no-fail-fast
done

# Check codegen for the standard library
Expand Down
4 changes: 4 additions & 0 deletions tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ pub struct Config {
/// Timeout duration for each test.
pub timeout: Option<Duration>,

/// Whether we will abort execution when a failure occurs.
/// When set to false, this will execute the entire test suite regardless of any failure.
pub fail_fast: bool,

/// Whether we will run the tests or not.
pub dry_run: bool,
}
Expand Down
6 changes: 5 additions & 1 deletion tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
.optflag("h", "help", "show this message")
.optopt("", "edition", "default Rust edition", "EDITION")
.optopt("", "timeout", "the timeout for each test in seconds", "TIMEOUT")
.optflag("", "no-fail-fast", "run all tests regardless of failure")
.optflag("", "dry-run", "don't actually run the tests")
;

Expand Down Expand Up @@ -157,6 +158,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
color,
edition: matches.opt_str("edition"),
force_rerun: matches.opt_present("force-rerun"),
fail_fast: !matches.opt_present("no-fail-fast"),
dry_run: matches.opt_present("dry-run"),
timeout,
}
Expand All @@ -176,6 +178,8 @@ pub fn log_config(config: &Config) {
logv(c, format!("verbose: {}", config.verbose));
logv(c, format!("quiet: {}", config.quiet));
logv(c, format!("timeout: {:?}", config.timeout));
logv(c, format!("fail-fast: {:?}", config.fail_fast));
logv(c, format!("dry-run: {:?}", config.dry_run));
logv(
c,
format!(
Expand Down Expand Up @@ -285,7 +289,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
list: false,
options: test::Options::new(),
time_options: None,
fail_fast: true,
fail_fast: config.fail_fast,
force_run_in_process: false,
}
}
Expand Down

0 comments on commit 3b88c9b

Please sign in to comment.