Skip to content

Commit ebd5c6f

Browse files
committed
try to make gix-filter tests stable by running it through cargo run
Previously it could fail but not existing, maybe due to a cache being deleted sometime, somehow. How it should always be available as it's run through `cargo run`.
1 parent e2e17c6 commit ebd5c6f

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-filter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ smallvec = "1.10.0"
3030

3131

3232
[dev-dependencies]
33-
once_cell = "1.18.0"
33+
serial_test = { version = "2.0.0", default-features = false }
3434
gix-testtools = { path = "../tests/tools" }
3535
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"] }

gix-filter/tests/driver/mod.rs

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
1-
use std::path::PathBuf;
2-
3-
use once_cell::sync::Lazy;
4-
5-
static DRIVER: Lazy<PathBuf> = Lazy::new(|| {
6-
let mut cargo = std::process::Command::new(env!("CARGO"));
7-
let res = cargo
8-
.args(["build", "--example", "arrow"])
9-
.status()
10-
.expect("cargo should run fine");
11-
assert!(res.success(), "cargo invocation should be successful");
12-
13-
let path = PathBuf::from(env!("CARGO_TARGET_TMPDIR"))
14-
.ancestors()
15-
.nth(1)
16-
.expect("first parent in target dir")
17-
.join("debug")
18-
.join("examples")
19-
.join(if cfg!(windows) { "arrow.exe" } else { "arrow" });
20-
assert!(path.is_file(), "Expecting driver to be located at {path:?}");
21-
path
22-
});
1+
static DRIVER: &str = concat!(env!("CARGO"), " run --example arrow");
232

243
mod baseline {
254
use crate::driver::DRIVER;
5+
use serial_test::serial;
266

7+
#[serial]
278
#[test]
289
fn our_implementation_used_by_git() -> crate::Result {
29-
let mut exe = DRIVER.to_string_lossy().into_owned();
10+
let mut exe = DRIVER.to_owned();
3011
if cfg!(windows) {
3112
exe = exe.replace('\\', "/");
3213
}
@@ -85,6 +66,7 @@ pub(crate) mod apply {
8566
driver::{apply, apply::Delay, Operation},
8667
Driver,
8768
};
69+
use serial_test::serial;
8870

8971
use crate::driver::{shutdown::extract_client, DRIVER};
9072

@@ -95,7 +77,7 @@ pub(crate) mod apply {
9577
}
9678

9779
pub(crate) fn driver_with_process() -> Driver {
98-
let mut exe = DRIVER.to_string_lossy().into_owned();
80+
let mut exe = DRIVER.to_owned();
9981
if cfg!(windows) {
10082
exe = exe.replace('\\', "/");
10183
}
@@ -108,6 +90,7 @@ pub(crate) mod apply {
10890
}
10991
}
11092

93+
#[serial]
11194
#[test]
11295
fn missing_driver_means_no_filter_is_applied() -> crate::Result {
11396
let mut state = gix_filter::driver::State::default();
@@ -134,6 +117,7 @@ pub(crate) mod apply {
134117
Ok(())
135118
}
136119

120+
#[serial]
137121
#[test]
138122
fn a_crashing_process_can_restart_it() -> crate::Result {
139123
let mut state = gix_filter::driver::State::default();
@@ -167,6 +151,7 @@ pub(crate) mod apply {
167151
Ok(())
168152
}
169153

154+
#[serial]
170155
#[test]
171156
fn process_status_abort_disables_capability() -> crate::Result {
172157
let mut state = gix_filter::driver::State::default();
@@ -193,6 +178,7 @@ pub(crate) mod apply {
193178
Ok(())
194179
}
195180

181+
#[serial]
196182
#[test]
197183
fn process_status_strange_shuts_down_process() -> crate::Result {
198184
let mut state = gix_filter::driver::State::default();
@@ -218,6 +204,7 @@ pub(crate) mod apply {
218204
Ok(())
219205
}
220206

207+
#[serial]
221208
#[test]
222209
fn smudge_and_clean_failure_is_translated_to_observable_error_for_required_drivers() -> crate::Result {
223210
let mut state = gix_filter::driver::State::default();
@@ -239,6 +226,7 @@ pub(crate) mod apply {
239226
Ok(())
240227
}
241228

229+
#[serial]
242230
#[test]
243231
fn smudge_and_clean_failure_means_nothing_if_required_is_false() -> crate::Result {
244232
let mut state = gix_filter::driver::State::default();
@@ -262,6 +250,7 @@ pub(crate) mod apply {
262250
Ok(())
263251
}
264252

253+
#[serial]
265254
#[test]
266255
fn smudge_and_clean_series() -> crate::Result {
267256
let mut state = gix_filter::driver::State::default();

0 commit comments

Comments
 (0)