Skip to content

Commit

Permalink
CI: set a build timeout; increase test timeout (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcefrog authored Jun 11, 2024
2 parents f8a1644 + 93fa91f commit e2c6463
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 73 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -176,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
Expand All @@ -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
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
uses: actions/upload-artifact@v4
if: always()
Expand Down
2 changes: 1 addition & 1 deletion testdata/hang_when_mutated/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down
7 changes: 4 additions & 3 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
60 changes: 0 additions & 60 deletions tests/snapshots/list__list_mutants_in_all_trees_as_json.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
]
```
Expand Down
2 changes: 0 additions & 2 deletions tests/snapshots/list__list_mutants_in_all_trees_as_text.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e2c6463

Please sign in to comment.