chore(cli): pre-factor the sanitizer tests (#22436)

Moving tests around so that we can make #22413 smaller
This commit is contained in:
Matt Mastracci 2024-02-16 10:49:42 -07:00 committed by GitHub
parent 88d7c50cd5
commit c92717a1a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 138 additions and 171 deletions

View file

@ -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,
});

View file

@ -1,38 +0,0 @@
Check [WILDCARD]/test/exit_sanitizer.ts
running 3 tests from ./test/exit_sanitizer.ts
exit(0) ... FAILED ([WILDCARD])
exit(1) ... FAILED ([WILDCARD])
exit(2) ... FAILED ([WILDCARD])
ERRORS
exit(0) => ./test/exit_sanitizer.ts:[WILDCARD]
error: Error: Test case attempted to exit with exit code: 0
Deno.exit(0);
^
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:2:8
exit(1) => ./test/exit_sanitizer.ts:[WILDCARD]
error: Error: Test case attempted to exit with exit code: 1
Deno.exit(1);
^
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:6:8
exit(2) => ./test/exit_sanitizer.ts:[WILDCARD]
error: Error: Test case attempted to exit with exit code: 2
Deno.exit(2);
^
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:10:8
FAILURES
exit(0) => ./test/exit_sanitizer.ts:[WILDCARD]
exit(1) => ./test/exit_sanitizer.ts:[WILDCARD]
exit(2) => ./test/exit_sanitizer.ts:[WILDCARD]
FAILED | 0 passed | 3 failed ([WILDCARD])
error: Test failed

View file

@ -1,18 +0,0 @@
Check [WILDCARD]test/ops_sanitizer_missing_details.ts
running 1 test from ./test/ops_sanitizer_missing_details.ts
test 1 ... FAILED [WILDCARD]
ERRORS
test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD]
error: Leaking async ops:
- 1 async operation to op_write was started in this test, but never completed.
To get more details where ops were leaked, run again with --trace-ops flag.
FAILURES
test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD]
FAILED | 0 passed | 1 failed [WILDCARD]
error: Test failed

View file

@ -1,10 +0,0 @@
// https://github.com/denoland/deno/issues/13729
// https://github.com/denoland/deno/issues/13938
import { writeAll } from "../../../tests/util/std/streams/write_all.ts";
Deno.test("test 1", { permissions: { write: true, read: true } }, async () => {
const tmpFile = await Deno.makeTempFile();
const file = await Deno.open(tmpFile, { write: true });
const buf = new Uint8Array(new Array(1_000_000).fill(1));
writeAll(file, buf);
});

View file

@ -1,45 +0,0 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts
running 2 tests from ./test/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]
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]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]
at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]
test 2 => ./test/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]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]
at [WILDCARD]
at setTimeout ([WILDCARD])
at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]
FAILURES
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
FAILED | 0 passed | 2 failed ([WILDCARD])
error: Test failed

View file

@ -1,6 +0,0 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_timeout_failure.ts
running 1 test from ./test/ops_sanitizer_timeout_failure.ts
wait ... ok ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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])

View file

@ -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])

View file

@ -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 -------

View file

@ -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])

View file

@ -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])

View file

@ -2,6 +2,7 @@ Deno.test("no-op", function () {});
Deno.test({
name: "leak interval",
// regression test for sanitizer errors being swallowed with permissions.
// https://github.com/denoland/deno/pull/18550
permissions: {},
fn() {
setInterval(function () {}, 100000);

View file

@ -1,10 +1,10 @@
Check [WILDCARD]/test/resource_sanitizer.ts
running 1 test from ./test/resource_sanitizer.ts
Check [WILDCARD]/resource_sanitizer.ts
running 1 test from [WILDCARD]/resource_sanitizer.ts
leak ... FAILED ([WILDCARD])
ERRORS
leak => ./test/resource_sanitizer.ts:[WILDCARD]
leak => [WILDCARD]/resource_sanitizer.ts:[WILDCARD]
error: Leaking resources:
[UNORDERED_START]
- The stdin pipe was opened before the test started, but was closed during the test. Do not close resources in a test that were not created during that test.
@ -13,7 +13,7 @@ error: Leaking resources:
FAILURES
leak => ./test/resource_sanitizer.ts:[WILDCARD]
leak => [WILDCARD]/resource_sanitizer.ts:[WILDCARD]
FAILED | 0 passed | 1 failed ([WILDCARD])

View file

@ -1,5 +1,5 @@
Check file:///[WILDCARD]/trace_ops_caught_error/main.ts
running 1 test from ./test/trace_ops_caught_error/main.ts
running 1 test from [WILDCARD]/trace_ops_caught_error/main.ts
handle thrown error in async function ... ok ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -1,3 +1,4 @@
// https://github.com/denoland/deno/pull/16970
Deno.test("handle thrown error in async function", async () => {
const dirPath = Deno.makeTempDirSync();
const filePath = `${dirPath}/file.txt`;

View file

@ -226,6 +226,7 @@ Deno.test({
},
});
// Only supported on Windows (but won't throw anywhere)
Deno.test({
name: "process.on SIGBREAK doesn't throw",
fn() {
@ -235,9 +236,9 @@ Deno.test({
},
});
// Not supported on Windows (but won't throw anywhere)
Deno.test({
name: "process.on SIGTERM doesn't throw on windows",
ignore: Deno.build.os !== "windows",
name: "process.on SIGTERM doesn't throw",
fn() {
const listener = () => {};
process.on("SIGTERM", listener);