Skip to content

Commit

Permalink
chore(cli): pre-factor the sanitizer tests (#22436)
Browse files Browse the repository at this point in the history
Moving tests around so that we can make #22413 smaller
  • Loading branch information
mmastrac authored Feb 16, 2024
1 parent 88d7c50 commit c92717a
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 171 deletions.
48 changes: 20 additions & 28 deletions tests/integration/test_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,63 +219,55 @@ itest!(allow_none {
});

itest!(ops_sanitizer_unstable {
args: "test --trace-ops test/ops_sanitizer_unstable.ts",
args: "test --trace-ops test/sanitizer/ops_sanitizer_unstable.ts",
exit_code: 1,
output: "test/ops_sanitizer_unstable.out",
output: "test/sanitizer/ops_sanitizer_unstable.out",
});

itest!(ops_sanitizer_timeout_failure {
args: "test test/ops_sanitizer_timeout_failure.ts",
output: "test/ops_sanitizer_timeout_failure.out",
args: "test test/sanitizer/ops_sanitizer_timeout_failure.ts",
output: "test/sanitizer/ops_sanitizer_timeout_failure.out",
});

itest!(ops_sanitizer_multiple_timeout_tests {
args: "test --trace-ops test/ops_sanitizer_multiple_timeout_tests.ts",
args:
"test --trace-ops test/sanitizer/ops_sanitizer_multiple_timeout_tests.ts",
exit_code: 1,
output: "test/ops_sanitizer_multiple_timeout_tests.out",
output: "test/sanitizer/ops_sanitizer_multiple_timeout_tests.out",
});

itest!(ops_sanitizer_multiple_timeout_tests_no_trace {
args: "test test/ops_sanitizer_multiple_timeout_tests.ts",
args: "test test/sanitizer/ops_sanitizer_multiple_timeout_tests.ts",
exit_code: 1,
output: "test/ops_sanitizer_multiple_timeout_tests_no_trace.out",
output: "test/sanitizer/ops_sanitizer_multiple_timeout_tests_no_trace.out",
});

itest!(trace_ops_catch_error {
args: "test -A --trace-ops test/trace_ops_caught_error/main.ts",
itest!(sanitizer_trace_ops_catch_error {
args: "test -A --trace-ops test/sanitizer/trace_ops_caught_error/main.ts",
exit_code: 0,
output: "test/trace_ops_caught_error/main.out",
output: "test/sanitizer/trace_ops_caught_error/main.out",
});

// TODO(@littledivy): re-enable this test, recent optimizations made output non deterministic.
// https://github.com/denoland/deno/issues/14268
//
// itest!(ops_sanitizer_missing_details {
// args: "test --allow-write --allow-read test/ops_sanitizer_missing_details.ts",
// exit_code: 1,
// output: "test/ops_sanitizer_missing_details.out",
// });

itest!(ops_sanitizer_closed_inside_started_before {
args: "test --trace-ops test/ops_sanitizer_closed_inside_started_before.ts",
args: "test --trace-ops test/sanitizer/ops_sanitizer_closed_inside_started_before.ts",
exit_code: 1,
output: "test/ops_sanitizer_closed_inside_started_before.out",
output: "test/sanitizer/ops_sanitizer_closed_inside_started_before.out",
});

itest!(ops_sanitizer_nexttick {
args: "test --no-check test/ops_sanitizer_nexttick.ts",
output: "test/ops_sanitizer_nexttick.out",
args: "test --no-check test/sanitizer/ops_sanitizer_nexttick.ts",
output: "test/sanitizer/ops_sanitizer_nexttick.out",
});

itest!(resource_sanitizer {
args: "test --allow-read test/resource_sanitizer.ts",
args: "test --allow-read test/sanitizer/resource_sanitizer.ts",
exit_code: 1,
output: "test/resource_sanitizer.out",
output: "test/sanitizer/resource_sanitizer.out",
});

itest!(exit_sanitizer {
args: "test test/exit_sanitizer.ts",
output: "test/exit_sanitizer.out",
args: "test test/sanitizer/exit_sanitizer.ts",
output: "test/sanitizer/exit_sanitizer.out",
exit_code: 1,
});

Expand Down
38 changes: 0 additions & 38 deletions tests/testdata/test/exit_sanitizer.out

This file was deleted.

18 changes: 0 additions & 18 deletions tests/testdata/test/ops_sanitizer_missing_details.out

This file was deleted.

10 changes: 0 additions & 10 deletions tests/testdata/test/ops_sanitizer_missing_details.ts

This file was deleted.

45 changes: 0 additions & 45 deletions tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out

This file was deleted.

6 changes: 0 additions & 6 deletions tests/testdata/test/ops_sanitizer_timeout_failure.out

This file was deleted.

38 changes: 38 additions & 0 deletions tests/testdata/test/sanitizer/exit_sanitizer.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Check [WILDCARD]/exit_sanitizer.ts
running 3 tests from [WILDCARD]/exit_sanitizer.ts
exit(0) ... FAILED ([WILDCARD])
exit(1) ... FAILED ([WILDCARD])
exit(2) ... FAILED ([WILDCARD])

ERRORS

exit(0) => [WILDCARD]/exit_sanitizer.ts:[WILDCARD]
error: Error: Test case attempted to exit with exit code: 0
Deno.exit(0);
^
at [WILDCARD]
at [WILDCARD]/exit_sanitizer.ts:2:8

exit(1) => [WILDCARD]/exit_sanitizer.ts:[WILDCARD]
error: Error: Test case attempted to exit with exit code: 1
Deno.exit(1);
^
at [WILDCARD]
at [WILDCARD]/exit_sanitizer.ts:6:8

exit(2) => [WILDCARD]/exit_sanitizer.ts:[WILDCARD]
error: Error: Test case attempted to exit with exit code: 2
Deno.exit(2);
^
at [WILDCARD]
at [WILDCARD]/exit_sanitizer.ts:10:8

FAILURES

exit(0) => [WILDCARD]/exit_sanitizer.ts:[WILDCARD]
exit(1) => [WILDCARD]/exit_sanitizer.ts:[WILDCARD]
exit(2) => [WILDCARD]/exit_sanitizer.ts:[WILDCARD]

FAILED | 0 passed | 3 failed ([WILDCARD])

error: Test failed
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Check [WILDCARD]test/ops_sanitizer_closed_inside_started_before.ts
running 1 test from ./test/ops_sanitizer_closed_inside_started_before.ts
Check [WILDCARD]/ops_sanitizer_closed_inside_started_before.ts
running 1 test from [WILDCARD]/ops_sanitizer_closed_inside_started_before.ts
test 1 ... FAILED [WILDCARD]

ERRORS

test 1 => ./test/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]
test 1 => [WILDCARD]/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]
error: Leaking async ops:
- 1 async operation to sleep for a duration was started before this test, but was completed during the test. Async operations should not complete in a test if they were not started in that test. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operation was started here:
at [WILDCARD]
at [WILDCARD]/tests/testdata/test/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]
at [WILDCARD]/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]

FAILURES

test 1 => ./test/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]
test 1 => [WILDCARD]/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]

FAILED | 0 passed | 1 failed [WILDCARD]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Check [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts
running 2 tests from [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])

ERRORS

test 1 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
error: Leaking async ops:
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]

at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]

test 2 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
error: Leaking async ops:
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]

at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]

FAILURES

test 1 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]

FAILED | 0 passed | 2 failed ([WILDCARD])

error: Test failed
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts
running 2 tests from ./test/ops_sanitizer_multiple_timeout_tests.ts
Check [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts
running 2 tests from [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])

ERRORS

test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 1 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
error: Leaking async ops:
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
To get more details where ops were leaked, run again with --trace-ops flag.

test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
error: Leaking async ops:
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
To get more details where ops were leaked, run again with --trace-ops flag.

FAILURES

test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 1 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]

FAILED | 0 passed | 2 failed ([WILDCARD])

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
running 2 tests from ./test/ops_sanitizer_nexttick.ts
running 2 tests from [WILDCARD]/ops_sanitizer_nexttick.ts
test 1 ... ok ([WILDCARD])
test 2 ... ok ([WILDCARD])

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Check [WILDCARD]/tests/testdata/test/ops_sanitizer_step_leak.ts
running 1 test from ./tests/testdata/test/ops_sanitizer_step_leak.ts
Check [WILDCARD]/ops_sanitizer_step_leak.ts
running 1 test from [WILDCARD]/ops_sanitizer_step_leak.ts
timeout ...
step ... ok [WILDCARD]
------- output -------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Check [WILDCARD]/ops_sanitizer_timeout_failure.ts
running 1 test from [WILDCARD]/ops_sanitizer_timeout_failure.ts
wait ... ok ([WILDCARD])

ok | 1 passed | 0 failed ([WILDCARD])

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts
running 2 tests from ./test/ops_sanitizer_unstable.ts
Check [WILDCARD]/ops_sanitizer_unstable.ts
running 2 tests from [WILDCARD]/ops_sanitizer_unstable.ts
no-op ... ok ([WILDCARD])
leak interval ... FAILED ([WILDCARD])

ERRORS

leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]
leak interval => [WILDCARD]/ops_sanitizer_unstable.ts:[WILDCARD]
error: Leaking async ops:
- 1 async operation to sleep for a duration was started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operation was started here:
at [WILDCARD]
at setInterval ([WILDCARD])
at fn ([WILDCARD]/testdata/test/ops_sanitizer_unstable.ts:7:5)
at fn ([WILDCARD]/ops_sanitizer_unstable.ts:[WILDCARD])
at [WILDCARD]

FAILURES

leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]
leak interval => [WILDCARD]/ops_sanitizer_unstable.ts:[WILDCARD]

FAILED | 1 passed | 1 failed ([WILDCARD])

Expand Down
Loading

0 comments on commit c92717a

Please sign in to comment.