Skip to content

Commit 22241ca

Browse files
committed
Test overwrite_existing apparent symlink dereferencing
To investigate #2006, this explodes the occasionally failing test `writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed` into 1000 identical tests, using `test_case::test_matrix`. When run in series, they all pass, but when run in parallel with `cargo nextest`, some failures always occur, at least when this is done on macOS. This is as predicted in: #2006 (comment) A more specific result in local testing on macOS 15 is that, while the number of failures is 0 with `--test-threads=1`, with 2 or more threads, the number of failures tends to *decrease* with the number of threads. The most failures occur with `--test-threads=2`, about 30 on the system tested, while `--test-threads=16` has about 10 failures. The tests were run with this command, with any `--test-threads=<N>` argument added: cargo nextest run -p gix-worktree-state-tests writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed --no-fail-fast
1 parent c3f06ae commit 22241ca

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

Cargo.lock

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-worktree-state/tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ symlink = "0.1.0"
3333
once_cell = "1.21.3"
3434

3535
walkdir = "2.3.2"
36+
test-case = "3.3.1"

gix-worktree-state/tests/state/checkout.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use gix_object::{bstr::ByteSlice, Data};
1212
use gix_testtools::tempfile::TempDir;
1313
use gix_worktree_state::checkout::Collision;
1414
use once_cell::sync::Lazy;
15+
use test_case::test_matrix;
1516

1617
use crate::fixture_path;
1718

@@ -103,8 +104,8 @@ fn accidental_writes_through_symlinks_are_prevented_if_overwriting_is_forbidden(
103104
}
104105
}
105106

106-
#[test]
107-
fn writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed() {
107+
#[test_matrix(0..=999)]
108+
fn writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed(_i: i32) {
108109
let mut opts = opts_from_probe();
109110
// with overwrite mode
110111
opts.overwrite_existing = true;

0 commit comments

Comments
 (0)