mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Auto merge of #12478 - weihanglo:keep-going, r=epage
feat: remove `--keep-going` from `cargo test/bench`
This commit is contained in:
commit
7e9de3f4ec
@ -42,7 +42,8 @@ pub fn cli() -> Command {
|
|||||||
"Benchmark all targets",
|
"Benchmark all targets",
|
||||||
)
|
)
|
||||||
.arg_features()
|
.arg_features()
|
||||||
.arg_jobs()
|
.arg_jobs_without_keep_going()
|
||||||
|
.arg(flag("keep-going", "Use `--no-fail-fast` instead").hide(true)) // See rust-lang/cargo#11702
|
||||||
.arg_profile("Build artifacts with the specified profile")
|
.arg_profile("Build artifacts with the specified profile")
|
||||||
.arg_target_triple("Build for the target triple")
|
.arg_target_triple("Build for the target triple")
|
||||||
.arg_target_dir()
|
.arg_target_dir()
|
||||||
@ -54,6 +55,17 @@ pub fn cli() -> Command {
|
|||||||
|
|
||||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||||
let ws = args.workspace(config)?;
|
let ws = args.workspace(config)?;
|
||||||
|
|
||||||
|
if args.keep_going() {
|
||||||
|
return Err(anyhow::format_err!(
|
||||||
|
"\
|
||||||
|
unexpected argument `--keep-going` found
|
||||||
|
|
||||||
|
tip: to run as many benchmarks as possible without failing fast, use `--no-fail-fast`"
|
||||||
|
)
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
|
||||||
let mut compile_opts = args.compile_options(
|
let mut compile_opts = args.compile_options(
|
||||||
config,
|
config,
|
||||||
CompileMode::Bench,
|
CompileMode::Bench,
|
||||||
|
@ -48,7 +48,8 @@ pub fn cli() -> Command {
|
|||||||
"Test all targets (does not include doctests)",
|
"Test all targets (does not include doctests)",
|
||||||
)
|
)
|
||||||
.arg_features()
|
.arg_features()
|
||||||
.arg_jobs()
|
.arg_jobs_without_keep_going()
|
||||||
|
.arg(flag("keep-going", "Use `--no-fail-fast` instead").hide(true)) // See rust-lang/cargo#11702
|
||||||
.arg_release("Build artifacts in release mode, with optimizations")
|
.arg_release("Build artifacts in release mode, with optimizations")
|
||||||
.arg_profile("Build artifacts with the specified profile")
|
.arg_profile("Build artifacts with the specified profile")
|
||||||
.arg_target_triple("Build for the target triple")
|
.arg_target_triple("Build for the target triple")
|
||||||
@ -65,6 +66,16 @@ pub fn cli() -> Command {
|
|||||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||||
let ws = args.workspace(config)?;
|
let ws = args.workspace(config)?;
|
||||||
|
|
||||||
|
if args.keep_going() {
|
||||||
|
return Err(anyhow::format_err!(
|
||||||
|
"\
|
||||||
|
unexpected argument `--keep-going` found
|
||||||
|
|
||||||
|
tip: to run as many tests as possible without failing fast, use `--no-fail-fast`"
|
||||||
|
)
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
|
||||||
let mut compile_opts = args.compile_options(
|
let mut compile_opts = args.compile_options(
|
||||||
config,
|
config,
|
||||||
CompileMode::Test,
|
CompileMode::Test,
|
||||||
|
@ -83,6 +83,16 @@ pub trait CommandExt: Sized {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn arg_jobs(self) -> Self {
|
fn arg_jobs(self) -> Self {
|
||||||
|
self.arg_jobs_without_keep_going()._arg(
|
||||||
|
flag(
|
||||||
|
"keep-going",
|
||||||
|
"Do not abort the build as soon as there is an error (unstable)",
|
||||||
|
)
|
||||||
|
.help_heading(heading::COMPILATION_OPTIONS),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn arg_jobs_without_keep_going(self) -> Self {
|
||||||
self._arg(
|
self._arg(
|
||||||
opt("jobs", "Number of parallel jobs, defaults to # of CPUs.")
|
opt("jobs", "Number of parallel jobs, defaults to # of CPUs.")
|
||||||
.short('j')
|
.short('j')
|
||||||
@ -90,13 +100,6 @@ pub trait CommandExt: Sized {
|
|||||||
.allow_hyphen_values(true)
|
.allow_hyphen_values(true)
|
||||||
.help_heading(heading::COMPILATION_OPTIONS),
|
.help_heading(heading::COMPILATION_OPTIONS),
|
||||||
)
|
)
|
||||||
._arg(
|
|
||||||
flag(
|
|
||||||
"keep-going",
|
|
||||||
"Do not abort the build as soon as there is an error (unstable)",
|
|
||||||
)
|
|
||||||
.help_heading(heading::COMPILATION_OPTIONS),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn arg_targets_all(
|
fn arg_targets_all(
|
||||||
|
@ -186,7 +186,6 @@ includes an option to control the number of threads used:
|
|||||||
{{#options}}
|
{{#options}}
|
||||||
|
|
||||||
{{> options-jobs }}
|
{{> options-jobs }}
|
||||||
{{> options-keep-going }}
|
|
||||||
{{> options-future-incompat }}
|
{{> options-future-incompat }}
|
||||||
|
|
||||||
{{/options}}
|
{{/options}}
|
||||||
|
@ -442,11 +442,6 @@ OPTIONS
|
|||||||
If a string default is provided, it sets the value back to defaults.
|
If a string default is provided, it sets the value back to defaults.
|
||||||
Should not be 0.
|
Should not be 0.
|
||||||
|
|
||||||
--keep-going
|
|
||||||
Build as many crates in the dependency graph as possible, rather
|
|
||||||
than aborting the build on the first one that fails to build.
|
|
||||||
Unstable, requires -Zunstable-options.
|
|
||||||
|
|
||||||
--future-incompat-report
|
--future-incompat-report
|
||||||
Displays a future-incompat report for any future-incompatible
|
Displays a future-incompat report for any future-incompatible
|
||||||
warnings produced during execution of this command
|
warnings produced during execution of this command
|
||||||
|
@ -515,12 +515,6 @@ a string <code>default</code> is provided, it sets the value back to defaults.
|
|||||||
Should not be 0.</dd>
|
Should not be 0.</dd>
|
||||||
|
|
||||||
|
|
||||||
<dt class="option-term" id="option-cargo-test---keep-going"><a class="option-anchor" href="#option-cargo-test---keep-going"></a><code>--keep-going</code></dt>
|
|
||||||
<dd class="option-desc">Build as many crates in the dependency graph as possible, rather than aborting
|
|
||||||
the build on the first one that fails to build. Unstable, requires
|
|
||||||
<code>-Zunstable-options</code>.</dd>
|
|
||||||
|
|
||||||
|
|
||||||
<dt class="option-term" id="option-cargo-test---future-incompat-report"><a class="option-anchor" href="#option-cargo-test---future-incompat-report"></a><code>--future-incompat-report</code></dt>
|
<dt class="option-term" id="option-cargo-test---future-incompat-report"><a class="option-anchor" href="#option-cargo-test---future-incompat-report"></a><code>--future-incompat-report</code></dt>
|
||||||
<dd class="option-desc">Displays a future-incompat report for any future-incompatible warnings
|
<dd class="option-desc">Displays a future-incompat report for any future-incompatible warnings
|
||||||
produced during execution of this command</p>
|
produced during execution of this command</p>
|
||||||
|
@ -45,9 +45,13 @@ _cargo() {
|
|||||||
'(--bench --bin --example --lib)--test=[specify test name]:test name'
|
'(--bench --bin --example --lib)--test=[specify test name]:test name'
|
||||||
)
|
)
|
||||||
|
|
||||||
parallel=(
|
jobs=(
|
||||||
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
|
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
|
||||||
'--keep-going[do not abort build on first error]'
|
)
|
||||||
|
|
||||||
|
parallel=(
|
||||||
|
"${jobs[@]}"
|
||||||
|
'--keep-going[do not abort build on first build error]'
|
||||||
)
|
)
|
||||||
|
|
||||||
features=(
|
features=(
|
||||||
@ -87,7 +91,7 @@ _cargo() {
|
|||||||
'*:args:_default'
|
'*:args:_default'
|
||||||
;;
|
;;
|
||||||
bench)
|
bench)
|
||||||
_arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
|
_arguments -s -A "^--" $common $jobs $features $msgfmt $triple $target $manifest \
|
||||||
"${command_scope_spec[@]}" \
|
"${command_scope_spec[@]}" \
|
||||||
'--all-targets[benchmark all targets]' \
|
'--all-targets[benchmark all targets]' \
|
||||||
"--no-run[compile but don't run]" \
|
"--no-run[compile but don't run]" \
|
||||||
@ -297,7 +301,7 @@ _cargo() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
test | t)
|
test | t)
|
||||||
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
|
_arguments -s -S $common $jobs $features $msgfmt $triple $target $manifest \
|
||||||
'--test=[test name]: :_cargo_test_names' \
|
'--test=[test name]: :_cargo_test_names' \
|
||||||
'--no-fail-fast[run all tests regardless of failure]' \
|
'--no-fail-fast[run all tests regardless of failure]' \
|
||||||
'--no-run[compile but do not run]' \
|
'--no-run[compile but do not run]' \
|
||||||
|
@ -41,7 +41,8 @@ _cargo()
|
|||||||
local opt_pkg='-p --package'
|
local opt_pkg='-p --package'
|
||||||
local opt_feat='-F --features --all-features --no-default-features'
|
local opt_feat='-F --features --all-features --no-default-features'
|
||||||
local opt_mani='--manifest-path'
|
local opt_mani='--manifest-path'
|
||||||
local opt_parallel='-j --jobs --keep-going'
|
local opt_jobs='-j --jobs'
|
||||||
|
local opt_parallel="$opt_jobs --keep-going"
|
||||||
local opt_force='-f --force'
|
local opt_force='-f --force'
|
||||||
local opt_sync='-s --sync'
|
local opt_sync='-s --sync'
|
||||||
local opt_lock='--frozen --locked --offline'
|
local opt_lock='--frozen --locked --offline'
|
||||||
@ -49,7 +50,7 @@ _cargo()
|
|||||||
|
|
||||||
local opt___nocmd="$opt_common -V --version --list --explain"
|
local opt___nocmd="$opt_common -V --version --list --explain"
|
||||||
local opt__add="$opt_common -p --package --features --default-features --no-default-features $opt_mani --optional --no-optional --rename --dry-run --path --git --branch --tag --rev --registry --dev --build --target"
|
local opt__add="$opt_common -p --package --features --default-features --no-default-features $opt_mani --optional --no-optional --rename --dry-run --path --git --branch --tag --rev --registry --dev --build --target"
|
||||||
local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --no-run --no-fail-fast --target-dir --ignore-rust-version"
|
local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --target --no-run --no-fail-fast --target-dir --ignore-rust-version"
|
||||||
local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version"
|
local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version"
|
||||||
local opt__b="$opt__build"
|
local opt__b="$opt__build"
|
||||||
local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version"
|
local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version"
|
||||||
@ -82,7 +83,7 @@ _cargo()
|
|||||||
local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir --ignore-rust-version"
|
local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir --ignore-rust-version"
|
||||||
local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --open --target-dir --profile --ignore-rust-version"
|
local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --open --target-dir --profile --ignore-rust-version"
|
||||||
local opt__search="$opt_common $opt_lock --limit --index --registry"
|
local opt__search="$opt_common $opt_lock --limit --index --registry"
|
||||||
local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile --ignore-rust-version"
|
local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_jobs $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile --ignore-rust-version"
|
||||||
local opt__t="$opt__test"
|
local opt__t="$opt__test"
|
||||||
local opt__tree="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock --target -i --invert --prefix --no-dedupe --duplicates -d --charset -f --format -e --edges"
|
local opt__tree="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock --target -i --invert --prefix --no-dedupe --duplicates -d --charset -f --format -e --edges"
|
||||||
local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"
|
local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"
|
||||||
|
@ -535,13 +535,6 @@ a string \fBdefault\fR is provided, it sets the value back to defaults.
|
|||||||
Should not be 0.
|
Should not be 0.
|
||||||
.RE
|
.RE
|
||||||
.sp
|
.sp
|
||||||
\fB\-\-keep\-going\fR
|
|
||||||
.RS 4
|
|
||||||
Build as many crates in the dependency graph as possible, rather than aborting
|
|
||||||
the build on the first one that fails to build. Unstable, requires
|
|
||||||
\fB\-Zunstable\-options\fR\&.
|
|
||||||
.RE
|
|
||||||
.sp
|
|
||||||
\fB\-\-future\-incompat\-report\fR
|
\fB\-\-future\-incompat\-report\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Displays a future\-incompat report for any future\-incompatible warnings
|
Displays a future\-incompat report for any future\-incompatible warnings
|
||||||
|
@ -1670,3 +1670,21 @@ fn json_artifact_includes_executable_for_benchmark() {
|
|||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn cargo_bench_no_keep_going() {
|
||||||
|
let p = project()
|
||||||
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
|
.file("src/main.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("bench --keep-going")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
error: unexpected argument `--keep-going` found
|
||||||
|
|
||||||
|
tip: to run as many benchmarks as possible without failing fast, use `--no-fail-fast`",
|
||||||
|
)
|
||||||
|
.with_status(101)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
@ -44,7 +44,6 @@ Feature Selection:
|
|||||||
|
|
||||||
Compilation Options:
|
Compilation Options:
|
||||||
-j, --jobs <N> Number of parallel jobs, defaults to # of CPUs.
|
-j, --jobs <N> Number of parallel jobs, defaults to # of CPUs.
|
||||||
--keep-going Do not abort the build as soon as there is an error (unstable)
|
|
||||||
--profile <PROFILE-NAME> Build artifacts with the specified profile
|
--profile <PROFILE-NAME> Build artifacts with the specified profile
|
||||||
--target <TRIPLE> Build for the target triple
|
--target <TRIPLE> Build for the target triple
|
||||||
--target-dir <DIRECTORY> Directory for all generated artifacts
|
--target-dir <DIRECTORY> Directory for all generated artifacts
|
||||||
|
@ -46,7 +46,6 @@ Feature Selection:
|
|||||||
|
|
||||||
Compilation Options:
|
Compilation Options:
|
||||||
-j, --jobs <N> Number of parallel jobs, defaults to # of CPUs.
|
-j, --jobs <N> Number of parallel jobs, defaults to # of CPUs.
|
||||||
--keep-going Do not abort the build as soon as there is an error (unstable)
|
|
||||||
-r, --release Build artifacts in release mode, with optimizations
|
-r, --release Build artifacts in release mode, with optimizations
|
||||||
--profile <PROFILE-NAME> Build artifacts with the specified profile
|
--profile <PROFILE-NAME> Build artifacts with the specified profile
|
||||||
--target <TRIPLE> Build for the target triple
|
--target <TRIPLE> Build for the target triple
|
||||||
|
@ -4843,3 +4843,21 @@ error: 2 targets failed:
|
|||||||
.with_status(101)
|
.with_status(101)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn cargo_test_no_keep_going() {
|
||||||
|
let p = project()
|
||||||
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
|
.file("src/main.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("test --keep-going")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
error: unexpected argument `--keep-going` found
|
||||||
|
|
||||||
|
tip: to run as many tests as possible without failing fast, use `--no-fail-fast`",
|
||||||
|
)
|
||||||
|
.with_status(101)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user