Skip to content

Commit 7a72f8f

Browse files
authored
drop subtasks in cancel-import/runner.c test (#1345)
This was causing a panic in Wasmtime when disposing of the guest task parent of those subtasks. Wasmtime shouldn't be panicking no matter what the guest does, so I'll need to fix that, but meanwhile we might as well have good handle hygene in our tests. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent c95face commit 7a72f8f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • tests/runtime-async/async/cancel-import

tests/runtime-async/async/cancel-import/runner.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ int main() {
1515
status = runner_subtask_cancel(subtask);
1616
assert(RUNNER_SUBTASK_STATE(status) == RUNNER_SUBTASK_RETURNED_CANCELLED);
1717
assert(RUNNER_SUBTASK_HANDLE(status) == 0);
18+
runner_subtask_drop(subtask);
1819

1920
runner_waitable_status_t status2 = test_future_void_write(writer);
2021
assert(RUNNER_WAITABLE_STATE(status2) == RUNNER_WAITABLE_DROPPED);
@@ -47,9 +48,12 @@ int main() {
4748
status = runner_subtask_cancel(subtask1);
4849
assert(RUNNER_SUBTASK_STATE(status) == RUNNER_SUBTASK_RETURNED_CANCELLED);
4950
assert(RUNNER_SUBTASK_HANDLE(status) == 0);
51+
runner_subtask_drop(subtask1);
52+
5053
status = runner_subtask_cancel(subtask2);
5154
assert(RUNNER_SUBTASK_STATE(status) == RUNNER_SUBTASK_STARTED_CANCELLED);
5255
assert(RUNNER_SUBTASK_HANDLE(status) == 0);
56+
runner_subtask_drop(subtask2);
5357

5458
// We still own the readable end of `reader2` and `writer2` since the
5559
// subtask didn't actually start, so drop it here.

0 commit comments

Comments
 (0)