Skip to content

Commit c0ff3b3

Browse files
committed
Move abort -> Errored logic into Config
1 parent 75e4321 commit c0ff3b3

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

src/aux_builds.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ impl Build for AuxBuilder {
141141
aux_cmd.arg("--print").arg("file-names");
142142
let output = run_command(&mut aux_cmd)?;
143143

144-
if build_manager.aborted() {
145-
return Err(Errored::aborted());
146-
}
144+
config.aborted()?;
147145

148146
assert!(output.status.success());
149147

src/build_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,6 @@ impl BuildManager {
156156

157157
/// Whether the build was cancelled
158158
pub fn aborted(&self) -> bool {
159-
self.config.aborted()
159+
self.config.abort_check.aborted()
160160
}
161161
}

src/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
diagnostics::{self, Diagnostics},
99
parser::CommandParserFunc,
1010
per_test_config::{Comments, Condition},
11-
CommandBuilder, Error, Errors,
11+
CommandBuilder, Error, Errored, Errors,
1212
};
1313
use color_eyre::eyre::Result;
1414
use regex::bytes::Regex;
@@ -454,8 +454,12 @@ impl Config {
454454
^ self.run_only_ignored
455455
}
456456

457-
pub(crate) fn aborted(&self) -> bool {
458-
self.abort_check.aborted()
457+
pub(crate) fn aborted(&self) -> Result<(), Errored> {
458+
if self.abort_check.aborted() {
459+
Err(Errored::aborted())
460+
} else {
461+
Ok(())
462+
}
459463
}
460464
}
461465

src/per_test_config.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,7 @@ impl TestConfig {
383383
let output = crate::core::run_command(&mut cmd)?;
384384

385385
// Do not bless aborted tests
386-
if build_manager.aborted() {
387-
return Err(Errored::aborted());
388-
}
386+
self.aborted()?;
389387

390388
let output = self.check_test_result(&cmd, output)?;
391389

@@ -412,11 +410,7 @@ impl TestConfig {
412410
}
413411

414412
pub(crate) fn aborted(&self) -> Result<(), Errored> {
415-
if self.config.aborted() {
416-
Err(Errored::aborted())
417-
} else {
418-
Ok(())
419-
}
413+
self.config.aborted()
420414
}
421415

422416
/// All the environment variables set for the given revision

0 commit comments

Comments
 (0)