Skip to content

Commit 9cc060d

Browse files
committed
Use single-threaded checkout in tests
This change (from EliahKagan#37), which is intended to be temporary, sets `thread_limit: Some(1)` in the `opts_from_probe()` test helper function in the `checkout.rs` test module, so that tests including `writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed` will use single-threaded checkout. This applies no matter how the tests are run. In addition, for the `test-ext4-casefold` CI jobs (but not others), this adds the `--no-default-features` option to the `cargo nextest` command, so that the `gix-features-parallel` feature defined in `gix-worktree-state/Cargo.toml`, which when enabled causes `gix-features/parallel` to be enabled for the tests, is not enabled. The purpose of these changes it to examine if, when checkout operations are themselves performed without multithreading, there is any change to #2006. This does not make the failures go away. They still occur on all systems on which they had occurred before. It is unclear if it makes any difference to the failures. It seems like they may be slightly less likely to occur on GNU/Linux, but experiments so far are insufficient to confirm this. Furthermore, even if there is an effect, it may be that the effect is more subtle (such as possibly shifting the number of parallel tests where failures peak, from 2 to some higher number). The changes here should not be confused with the duplication of the test case, nor with the argument to `--test-threads`, which actually specifies the number of parallel test *processes*, since `cargo nextest` is being used. This squashes a few commits trying some minor variations. The original messages are shown below. For full changes and CI results from each commit, see: EliahKagan#37 --- * Try to avoid parallel checkout in `test-ext4-casefold` This attempts to turn off parallelism within individual runs of writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed by passing `--no-default-features` to turn off the `gix-features-parallel` feature in `gix-worktree-state/Cargo.toml` (which is how `gix-features/parallel` is enabled in those tests). This is to check if the multithreading parallelism within the checkout operations participates in #2006. See: #2006 (comment) * Patch the `thread_limit` argument to `Some(1)` too In the `text-ext4-casefold` jobs. * Modify the test code to use single-threaded checkout This moves setting `thread_limit: Some(1)` out of being a step done with `sed` in the `test-ext4-casefold` jobs, and into being an actual change to the source code of the `checkout.rs` test module. This change is intended to be temporary. The goal is the same as before, but to observe the effect outside `text-ext4-casefold`. That is, the goal here is to temporarily see if there is a change in results in the other jobs where failure almost always occurs due to #2006, i.e., the `test-fast` jobs on `macos-latest` and `windows-latest`, and the `test-fixtures-windows` job. Note that, as of this change, the `gix-features/parallel` feature is only turned off in the `test-ext4-casefold` jobs. In others, that feature is still turned on, just a parallelism of 1, i.e., a single thread, is used for the checkout. But a parallelism of 1 seems usually to be special-cased to not use facilities related to multithreading. (This `thread_limit` argument change, as well as the immediately preceding change of disabling the `parallel` feature flag in the `test-ext4-casefold` test jobs, are entirely separate from how many writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed duplicated test cases there are, and also entirely separate from the operand to `--test-threads`, which actually controls the number of test *processes* `cargo nextest` creates to run the tests.)
1 parent f48a2bf commit 9cc060d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,16 @@ jobs:
242242
- uses: taiki-e/install-action@v2
243243
with:
244244
tool: nextest
245-
- name: More writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed reps
245+
- name: Increase writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed reps
246246
run: |
247247
# Prepend leading digits "24" to the upper bound of the label range.
248248
sed -Ei 's/^(#\[test_matrix\(0\.\.=)([[:digit:]]+\)])$/\124\2/' \
249249
gix-worktree-state/tests/state/checkout.rs
250+
- name: Display the changes made for this test
251+
run: git diff
250252
- name: Test writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed (nextest)
251253
run: |
252-
cargo nextest run -p gix-worktree-state-tests \
254+
cargo nextest run -p gix-worktree-state-tests --no-default-features \
253255
writes_through_symlinks_are_prevented_even_if_overwriting_is_allowed \
254256
--status-level=fail --test-threads=${{ matrix.parallel-tests }}
255257

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,11 @@ fn probe_gitoxide_dir() -> crate::Result<gix_fs::Capabilities> {
689689
fn opts_from_probe() -> gix_worktree_state::checkout::Options {
690690
static CAPABILITIES: Lazy<gix_fs::Capabilities> = Lazy::new(|| probe_gitoxide_dir().unwrap());
691691

692+
// FIXME(integration): Restore multithreaded `thread_limit` prior to merging #2008.
692693
gix_worktree_state::checkout::Options {
693694
fs: *CAPABILITIES,
694695
destination_is_initially_empty: true,
695-
thread_limit: gix_features::parallel::num_threads(None).into(),
696+
thread_limit: Some(1), // gix_features::parallel::num_threads(None).into(),
696697
..Default::default()
697698
}
698699
}

0 commit comments

Comments
 (0)