Skip to content

Commit

Permalink
[nextest-runner] simplify phase.run.extra-args to run-extra-args
Browse files Browse the repository at this point in the history
Honestly, YAGNI. I think the other cases like target runners are distinct
enough and should be considered separately.
  • Loading branch information
sunshowers committed Dec 10, 2024
1 parent a39ca1b commit f822dab
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ junit.store-success-output = true

[[profile.default.overrides]]
filter = 'test(test_single_threaded)'
phase.run.extra-args = ["--test-threads", "1"]
run-extra-args = ["--test-threads", "1"]

[[profile.default.scripts]]
filter = 'package(integration-tests) or binary_id(nextest-runner::integration)'
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/custom-harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ fn main() -> ExitCode {
thread_count::test_single_threaded,
)
// Because nextest's CI runs tests against the latest stable version of
// nextest, which doesn't have support for phase.run.extra-args yet, we
// have to use the `with_ignored_flag` method to ignore the test. This
// is temporary until phase.run.extra-args is in stable nextest.
// nextest, which doesn't have support for run-extra-args yet, we have
// to use the `with_ignored_flag` method to ignore the test. This is
// temporary until run-extra-args is in stable nextest.
.with_ignored_flag(true),
Trial::test(
"thread_count::test_multi_threaded",
Expand Down
2 changes: 1 addition & 1 deletion nextest-runner/default-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ threads-required = 1

# Extra arguments to pass in to the test binary at runtime. Intended primarily for
# communication with custom test harnesses -- use with caution!
phase.run.extra-args = []
run-extra-args = []

# Show these test statuses in the output.
#
Expand Down
20 changes: 9 additions & 11 deletions nextest-runner/src/config/config_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use super::{
phase::DeserializedPhase, ArchiveConfig, CompiledByProfile, CompiledData,
CompiledDefaultFilter, ConfigExperimental, CustomTestGroup, DeserializedOverride,
DeserializedProfileScriptConfig, NextestVersionDeserialize, RetryPolicy, ScriptConfig,
ScriptId, SettingSource, SetupScripts, SlowTimeout, TestGroup, TestGroupConfig, TestSettings,
TestThreads, ThreadsRequired, ToolConfigFile,
ArchiveConfig, CompiledByProfile, CompiledData, CompiledDefaultFilter, ConfigExperimental,
CustomTestGroup, DeserializedOverride, DeserializedProfileScriptConfig,
NextestVersionDeserialize, RetryPolicy, ScriptConfig, ScriptId, SettingSource, SetupScripts,
SlowTimeout, TestGroup, TestGroupConfig, TestSettings, TestThreads, ThreadsRequired,
ToolConfigFile,
};
use crate::{
errors::{
Expand Down Expand Up @@ -711,7 +711,7 @@ impl<'cfg> EvaluatableProfile<'cfg> {
/// Returns extra arguments to be passed to the test binary at runtime.
pub fn run_extra_args(&self) -> &'cfg [String] {
self.custom_profile
.and_then(|profile| profile.phase.run.extra_args.as_deref())
.and_then(|profile| profile.run_extra_args.as_deref())
.unwrap_or(&self.default_profile.run_extra_args)
}

Expand Down Expand Up @@ -978,10 +978,8 @@ impl DefaultProfileImpl {
.threads_required
.expect("threads-required present in default profile"),
run_extra_args: p
.phase
.run
.extra_args
.expect("phase.run.extra-args present in default profile"),
.run_extra_args
.expect("run-extra-args present in default profile"),
retries: p.retries.expect("retries present in default profile"),
status_level: p
.status_level
Expand Down Expand Up @@ -1057,7 +1055,7 @@ pub(super) struct CustomProfileImpl {
#[serde(default)]
threads_required: Option<ThreadsRequired>,
#[serde(default)]
phase: DeserializedPhase,
run_extra_args: Option<Vec<String>>,
#[serde(default)]
status_level: Option<StatusLevel>,
#[serde(default)]
Expand Down
12 changes: 6 additions & 6 deletions nextest-runner/src/config/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use super::{
phase::DeserializedPhase, CompiledProfileScripts, DeserializedProfileScriptConfig,
EvaluatableProfile, NextestConfig, NextestConfigImpl,
CompiledProfileScripts, DeserializedProfileScriptConfig, EvaluatableProfile, NextestConfig,
NextestConfigImpl,
};
use crate::{
config::{FinalConfig, PreBuildPlatform, RetryPolicy, SlowTimeout, TestGroup, ThreadsRequired},
Expand Down Expand Up @@ -168,7 +168,7 @@ impl<'p, Source: Copy> TestSettings<'p, Source> {
}
}
if run_extra_args.is_none() {
if let Some(r) = override_.data.phase.run.extra_args.as_deref() {
if let Some(r) = override_.data.run_extra_args.as_deref() {
run_extra_args = Some(Source::track_override(r, override_));
}
}
Expand Down Expand Up @@ -544,7 +544,7 @@ pub(super) struct ProfileOverrideData {
target_spec: MaybeTargetSpec,
filter: Option<FilterOrDefaultFilter>,
threads_required: Option<ThreadsRequired>,
phase: DeserializedPhase,
run_extra_args: Option<Vec<String>>,
retries: Option<RetryPolicy>,
slow_timeout: Option<SlowTimeout>,
leak_timeout: Option<Duration>,
Expand Down Expand Up @@ -626,7 +626,7 @@ impl CompiledOverride<PreBuildPlatform> {
target_spec,
filter,
threads_required: source.threads_required,
phase: source.phase.clone(),
run_extra_args: source.run_extra_args.clone(),
retries: source.retries,
slow_timeout: source.slow_timeout,
leak_timeout: source.leak_timeout,
Expand Down Expand Up @@ -770,7 +770,7 @@ pub(super) struct DeserializedOverride {
#[serde(default)]
threads_required: Option<ThreadsRequired>,
#[serde(default)]
phase: DeserializedPhase,
run_extra_args: Option<Vec<String>>,
#[serde(default, deserialize_with = "super::deserialize_retry_policy")]
retries: Option<RetryPolicy>,
#[serde(default, deserialize_with = "super::deserialize_slow_timeout")]
Expand Down

0 comments on commit f822dab

Please sign in to comment.