summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-02-16 14:22:12 -0700
committerGitHub <noreply@github.com>2024-02-16 21:22:12 +0000
commit67a4231bb62b7839f39bafc9e2e656f43093619b (patch)
tree428c3db10857a5c1785af56ea8997dff8b2adb0b /tests
parentc92717a1a43d31951cd8a1161afb766ef339aa21 (diff)
refactor(cli): move op sanitizer to Rust (#22413)
The format of the sanitizers will change a little bit: - If multiple async ops leak and traces are on, we repeat the async op header once per stack trace. - All leaks are aggregated under a "Leaks detected:" banner as the new timers are eventually going to be added, and these are neither ops nor resources. - `1 async op` is now `An async op` - If ops and resources leak, we show both (rather than op leaks masking resources) Follow-on to https://github.com/denoland/deno/pull/22226
Diffstat (limited to 'tests')
-rw-r--r--tests/testdata/test/sanitizer/ops_sanitizer_closed_inside_started_before.out4
-rw-r--r--tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests.out12
-rw-r--r--tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests_no_trace.out4
-rw-r--r--tests/testdata/test/sanitizer/ops_sanitizer_unstable.out4
-rw-r--r--tests/testdata/test/sanitizer/resource_sanitizer.out2
-rw-r--r--tests/unit/ops_test.ts2
6 files changed, 14 insertions, 14 deletions
diff --git a/tests/testdata/test/sanitizer/ops_sanitizer_closed_inside_started_before.out b/tests/testdata/test/sanitizer/ops_sanitizer_closed_inside_started_before.out
index 823f4704e..8346ba526 100644
--- a/tests/testdata/test/sanitizer/ops_sanitizer_closed_inside_started_before.out
+++ b/tests/testdata/test/sanitizer/ops_sanitizer_closed_inside_started_before.out
@@ -5,8 +5,8 @@ test 1 ... FAILED [WILDCARD]
ERRORS
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:
+error: Leaks detected:
+ - An async operation to sleep for a duration was started before the test, but 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]/ops_sanitizer_closed_inside_started_before.ts:[WILDCARD]
diff --git a/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests.out b/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests.out
index 6af59da90..57801c5c8 100644
--- a/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests.out
+++ b/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests.out
@@ -6,14 +6,14 @@ 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:
+error: Leaks detected:
+ - An 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 setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]
-
+ - An 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 setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
@@ -21,14 +21,14 @@ error: Leaking async ops:
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:
+error: Leaks detected:
+ - An 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 setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
at [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]
-
+ - An 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 setTimeout ([WILDCARD])
at test ([WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD])
diff --git a/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests_no_trace.out b/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests_no_trace.out
index ae5f68f2f..0d2863b9c 100644
--- a/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests_no_trace.out
+++ b/tests/testdata/test/sanitizer/ops_sanitizer_multiple_timeout_tests_no_trace.out
@@ -6,12 +6,12 @@ test 2 ... FAILED ([WILDCARD])
ERRORS
test 1 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
-error: Leaking async ops:
+error: Leaks detected:
- 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 => [WILDCARD]/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
-error: Leaking async ops:
+error: Leaks detected:
- 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.
diff --git a/tests/testdata/test/sanitizer/ops_sanitizer_unstable.out b/tests/testdata/test/sanitizer/ops_sanitizer_unstable.out
index f7c391b7c..90990caf5 100644
--- a/tests/testdata/test/sanitizer/ops_sanitizer_unstable.out
+++ b/tests/testdata/test/sanitizer/ops_sanitizer_unstable.out
@@ -6,8 +6,8 @@ leak interval ... FAILED ([WILDCARD])
ERRORS
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:
+error: Leaks detected:
+ - An 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]/ops_sanitizer_unstable.ts:[WILDCARD])
diff --git a/tests/testdata/test/sanitizer/resource_sanitizer.out b/tests/testdata/test/sanitizer/resource_sanitizer.out
index 50f98511c..128bbc7b6 100644
--- a/tests/testdata/test/sanitizer/resource_sanitizer.out
+++ b/tests/testdata/test/sanitizer/resource_sanitizer.out
@@ -5,7 +5,7 @@ leak ... FAILED ([WILDCARD])
ERRORS
leak => [WILDCARD]/resource_sanitizer.ts:[WILDCARD]
-error: Leaking resources:
+error: Leaks detected:
[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.
- A file was opened during the test, but not closed during the test. Close the file handle by calling `file.close()`.
diff --git a/tests/unit/ops_test.ts b/tests/unit/ops_test.ts
index 4a0daa0a5..4ba7c5ce3 100644
--- a/tests/unit/ops_test.ts
+++ b/tests/unit/ops_test.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-const EXPECTED_OP_COUNT = 15;
+const EXPECTED_OP_COUNT = 11;
Deno.test(function checkExposedOps() {
// @ts-ignore TS doesn't allow to index with symbol