From 13fa719eab03a2a1f3a6f9b75524cd175233f961 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 10 Jun 2024 08:21:34 -0700 Subject: [PATCH 1/4] CI: set a build timeout; increase test timeout --- .github/workflows/tests.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d9bb5012..97b6f199 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -161,8 +161,7 @@ jobs: - name: Mutants in-diff # Normally this would have --in-place, but for the sake of exercising more cases, it does not. run: > - cargo mutants --no-shuffle -vV --in-diff git.diff --test-tool - ${{matrix.test_tool}} + cargo mutants --no-shuffle -vV --in-diff git.diff --test-tool=${{matrix.test_tool}} --timeout=500 --build-timeout=500 - name: Archive mutants.out uses: actions/upload-artifact@v4 if: always() @@ -196,11 +195,11 @@ jobs: run: | install cargo-mutants ~/.cargo/bin/ - name: Mutants - # Skip baselines because this action depends on the tests + # Skip baselines because this job only runs after the baseline has been separately run. run: > cargo mutants --no-shuffle -vV --shard ${{ matrix.shard }}/8 - --test-tool ${{ matrix.test_tool }} --baseline=skip --timeout=240 - --in-place + --test-tool ${{ matrix.test_tool }} --baseline=skip --timeout=500 + --build-timeout=500 --in-place - name: Archive mutants.out uses: actions/upload-artifact@v4 if: always() From 5f8e19e6aec70cdd21b0eb7cbf0a1cc82554cc71 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 11 Jun 2024 06:28:50 -0700 Subject: [PATCH 2/4] Reduce internal timeout in hang_when_mutated --- testdata/hang_when_mutated/src/lib.rs | 2 +- ...st__list_mutants_in_all_trees_as_json.snap | 60 ------------------- ...st__list_mutants_in_all_trees_as_text.snap | 2 - 3 files changed, 1 insertion(+), 63 deletions(-) diff --git a/testdata/hang_when_mutated/src/lib.rs b/testdata/hang_when_mutated/src/lib.rs index 3d4ced90..8dc0ff00 100644 --- a/testdata/hang_when_mutated/src/lib.rs +++ b/testdata/hang_when_mutated/src/lib.rs @@ -42,7 +42,7 @@ pub fn controlled_loop() -> usize { return i; } std::thread::sleep(std::time::Duration::from_millis(100)); - if start.elapsed() > Duration::from_secs(60 * 5) { + if start.elapsed() > Duration::from_secs(60) { panic!("timed out"); } } diff --git a/tests/snapshots/list__list_mutants_in_all_trees_as_json.snap b/tests/snapshots/list__list_mutants_in_all_trees_as_json.snap index 00125962..a02344d6 100644 --- a/tests/snapshots/list__list_mutants_in_all_trees_as_json.snap +++ b/tests/snapshots/list__list_mutants_in_all_trees_as_json.snap @@ -1861,66 +1861,6 @@ expression: buf "line": 45 } } - }, - { - "file": "src/lib.rs", - "function": { - "function_name": "controlled_loop", - "return_type": "-> usize", - "span": { - "end": { - "column": 2, - "line": 50 - }, - "start": { - "column": 1, - "line": 32 - } - } - }, - "genre": "BinaryOperator", - "package": "cargo-mutants-testdata-hang-when-mutated", - "replacement": "+", - "span": { - "end": { - "column": 54, - "line": 45 - }, - "start": { - "column": 53, - "line": 45 - } - } - }, - { - "file": "src/lib.rs", - "function": { - "function_name": "controlled_loop", - "return_type": "-> usize", - "span": { - "end": { - "column": 2, - "line": 50 - }, - "start": { - "column": 1, - "line": 32 - } - } - }, - "genre": "BinaryOperator", - "package": "cargo-mutants-testdata-hang-when-mutated", - "replacement": "/", - "span": { - "end": { - "column": 54, - "line": 45 - }, - "start": { - "column": 53, - "line": 45 - } - } } ] ``` diff --git a/tests/snapshots/list__list_mutants_in_all_trees_as_text.snap b/tests/snapshots/list__list_mutants_in_all_trees_as_text.snap index 525bdcf2..1fcbe631 100644 --- a/tests/snapshots/list__list_mutants_in_all_trees_as_text.snap +++ b/tests/snapshots/list__list_mutants_in_all_trees_as_text.snap @@ -148,8 +148,6 @@ src/lib.rs:38:5: replace controlled_loop -> usize with 0 src/lib.rs:38:5: replace controlled_loop -> usize with 1 src/lib.rs:45:28: replace > with == in controlled_loop src/lib.rs:45:28: replace > with < in controlled_loop -src/lib.rs:45:53: replace * with + in controlled_loop -src/lib.rs:45:53: replace * with / in controlled_loop ``` ## testdata/insta From fd149e64c74c6c1d6805cf97d79b5cad1ddd2f73 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 11 Jun 2024 06:46:12 -0700 Subject: [PATCH 3/4] Try 10 shards --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97b6f199..618fab32 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -175,7 +175,7 @@ jobs: strategy: fail-fast: false # We want to get all the mutant failures matrix: - shard: [0, 1, 2, 3, 4, 5, 6, 7] + shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] test_tool: [cargo] steps: - uses: actions/checkout@v4 @@ -197,7 +197,7 @@ jobs: - name: Mutants # Skip baselines because this job only runs after the baseline has been separately run. run: > - cargo mutants --no-shuffle -vV --shard ${{ matrix.shard }}/8 + cargo mutants --no-shuffle -vV --shard ${{ matrix.shard }}/10 --test-tool ${{ matrix.test_tool }} --baseline=skip --timeout=500 --build-timeout=500 --in-place - name: Archive mutants.out From 93fa91f232d362607820364a7cb79bb95dd4a9a5 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 11 Jun 2024 07:13:59 -0700 Subject: [PATCH 4/4] Don't test for trace messages from interrupt handler --- tests/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/main.rs b/tests/main.rs index 04b59f8a..9840e83c 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -709,9 +709,10 @@ fn interrupt_caught_and_kills_children() { println!("stderr:\n{stderr}"); assert!(stderr.contains("interrupted")); - // Also because of `--level=trace` we see some debug details. - assert!(stderr.contains("terminating child process")); - assert!(stderr.contains("terminated child exit status")); + // We used to look here for some other trace messages about how it's interrupted, but + // that seems to be racy: sometimes the parent sees the child interrupted before it + // emits these messages? Anyhow, it's not essential. + // This shouldn't cause a panic though (#333) assert!(!stderr.contains("panic")); // And we don't want duplicate messages about workers failing.