summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-09-03 11:24:25 +0200
committerGitHub <noreply@github.com>2024-09-03 11:24:25 +0200
commit5cf97f539bb0c3d2bda918f53cd4a976c03b37e3 (patch)
tree82f05b270b3df52609e3d0d6c86a768d1399e257 /tests
parentb5695d02df75719bca0df1aae0622b22761b1533 (diff)
BREAKING(permissions): remove --allow-hrtime (#25367)
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because it is already possible to get access to high resolution timers through workers and SharedArrayBuffer. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/run_tests.rs9
-rw-r--r--tests/specs/bench/allow_all/allow_all.out6
-rw-r--r--tests/specs/bench/allow_all/allow_all.ts1
-rw-r--r--tests/specs/bench/allow_none/allow_none.out2
-rw-r--r--tests/specs/bench/allow_none/allow_none.ts1
-rw-r--r--tests/specs/bench/ignore_permissions/ignore_permissions.ts1
-rw-r--r--tests/testdata/bench/allow_all.out2
-rw-r--r--tests/testdata/bench/allow_none.out2
-rw-r--r--tests/testdata/run/025_hrtime.ts5
-rw-r--r--tests/testdata/run/025_hrtime.ts.out2
-rw-r--r--tests/testdata/run/deny_all_permission_args.js1
-rw-r--r--tests/testdata/run/deny_all_permission_args.out1
-rw-r--r--tests/testdata/run/deny_some_permission_args.js1
-rw-r--r--tests/testdata/run/deny_some_permission_args.out1
-rw-r--r--tests/testdata/test/allow_all.out6
-rw-r--r--tests/testdata/test/allow_all.ts1
-rw-r--r--tests/testdata/test/allow_none.out10
-rw-r--r--tests/testdata/test/allow_none.ts1
-rw-r--r--tests/testdata/test/ignore_permissions.ts1
-rw-r--r--tests/testdata/workers/no_permissions_worker.js4
-rw-r--r--tests/testdata/workers/permission_echo.js2
-rw-r--r--tests/testdata/workers/read_check_granular_worker.js1
-rw-r--r--tests/unit/files_test.ts4
-rw-r--r--tests/unit/performance_test.ts2
-rw-r--r--tests/unit/permissions_test.ts10
-rw-r--r--tests/unit/worker_test.ts5
26 files changed, 18 insertions, 64 deletions
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs
index 79dc397e0..841ef2d18 100644
--- a/tests/integration/run_tests.rs
+++ b/tests/integration/run_tests.rs
@@ -153,11 +153,6 @@ itest!(_023_no_ext {
output: "run/023_no_ext.out",
});
-itest!(_025_hrtime {
- args: "run --quiet --allow-hrtime --reload run/025_hrtime.ts",
- output: "run/025_hrtime.ts.out",
-});
-
itest!(_025_reload_js_type_error {
args: "run --quiet --reload run/025_reload_js_type_error.js",
output: "run/025_reload_js_type_error.js.out",
@@ -735,12 +730,12 @@ fn permission_request_long() {
}
itest!(deny_all_permission_args {
- args: "run --deny-env --deny-read --deny-write --deny-ffi --deny-run --deny-sys --deny-net --deny-hrtime run/deny_all_permission_args.js",
+ args: "run --deny-env --deny-read --deny-write --deny-ffi --deny-run --deny-sys --deny-net run/deny_all_permission_args.js",
output: "run/deny_all_permission_args.out",
});
itest!(deny_some_permission_args {
- args: "run --allow-env --deny-env=FOO --allow-read --deny-read=/foo --allow-write --deny-write=/foo --allow-ffi --deny-ffi=/foo --allow-run --deny-run=foo --allow-sys --deny-sys=hostname --allow-net --deny-net=127.0.0.1 --allow-hrtime --deny-hrtime run/deny_some_permission_args.js",
+ args: "run --allow-env --deny-env=FOO --allow-read --deny-read=/foo --allow-write --deny-write=/foo --allow-ffi --deny-ffi=/foo --allow-run --deny-run=foo --allow-sys --deny-sys=hostname --allow-net --deny-net=127.0.0.1 run/deny_some_permission_args.js",
output: "run/deny_some_permission_args.out",
});
diff --git a/tests/specs/bench/allow_all/allow_all.out b/tests/specs/bench/allow_all/allow_all.out
index 4cc0f4204..b7d245de6 100644
--- a/tests/specs/bench/allow_all/allow_all.out
+++ b/tests/specs/bench/allow_all/allow_all.out
@@ -5,8 +5,8 @@ Runtime | Deno [WILDLINE] ([WILDLINE])
[WILDLINE]/allow_all.ts
-benchmark time/iter (avg) iter/s (min … max) p75 p99 p995
--------------- ----------------------------- --------------------- --------------------------
+benchmark time/iter (avg) iter/s (min … max) p75 p99 p995
+------------- ----------------------------- --------------------- --------------------------
read false [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
read true [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
write false [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
@@ -19,6 +19,4 @@ run false [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE
run true [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
ffi false [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
ffi true [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
-hrtime false [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
-hrtime true [WILDLINE] [WILDLINE] [WILDLINE] ([WILDLINE] … [WILDLINE]) [WILDLINE]
diff --git a/tests/specs/bench/allow_all/allow_all.ts b/tests/specs/bench/allow_all/allow_all.ts
index 9747fb414..04dca8926 100644
--- a/tests/specs/bench/allow_all/allow_all.ts
+++ b/tests/specs/bench/allow_all/allow_all.ts
@@ -7,7 +7,6 @@ const permissions: Deno.PermissionName[] = [
"env",
"run",
"ffi",
- "hrtime",
];
for (const name of permissions) {
diff --git a/tests/specs/bench/allow_none/allow_none.out b/tests/specs/bench/allow_none/allow_none.out
index 82bc7cc03..d92fb1469 100644
--- a/tests/specs/bench/allow_none/allow_none.out
+++ b/tests/specs/bench/allow_none/allow_none.out
@@ -18,6 +18,4 @@ run error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
ffi error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
-hrtime error: PermissionDenied: Can't escalate parent thread permissions
-[WILDCARD]
error: Bench failed
diff --git a/tests/specs/bench/allow_none/allow_none.ts b/tests/specs/bench/allow_none/allow_none.ts
index 77f86f256..59007ecb0 100644
--- a/tests/specs/bench/allow_none/allow_none.ts
+++ b/tests/specs/bench/allow_none/allow_none.ts
@@ -5,7 +5,6 @@ const permissions: Deno.PermissionName[] = [
"env",
"run",
"ffi",
- "hrtime",
];
for (const name of permissions) {
diff --git a/tests/specs/bench/ignore_permissions/ignore_permissions.ts b/tests/specs/bench/ignore_permissions/ignore_permissions.ts
index 0dcd9299f..62f939015 100644
--- a/tests/specs/bench/ignore_permissions/ignore_permissions.ts
+++ b/tests/specs/bench/ignore_permissions/ignore_permissions.ts
@@ -7,7 +7,6 @@ Deno.bench({
env: true,
run: true,
ffi: true,
- hrtime: true,
},
ignore: true,
fn() {
diff --git a/tests/testdata/bench/allow_all.out b/tests/testdata/bench/allow_all.out
index fc395493c..0aba21914 100644
--- a/tests/testdata/bench/allow_all.out
+++ b/tests/testdata/bench/allow_all.out
@@ -18,5 +18,3 @@ run false [WILDCARD] [WILDCARD] [WILDCARD] ([WILDCARD] … [WILDCARD]) [WILDCARD
run true [WILDCARD] [WILDCARD] [WILDCARD] ([WILDCARD] … [WILDCARD]) [WILDCARD]
ffi false [WILDCARD] [WILDCARD] [WILDCARD] ([WILDCARD] … [WILDCARD]) [WILDCARD]
ffi true [WILDCARD] [WILDCARD] [WILDCARD] ([WILDCARD] … [WILDCARD]) [WILDCARD]
-hrtime false [WILDCARD] [WILDCARD] [WILDCARD] ([WILDCARD] … [WILDCARD]) [WILDCARD]
-hrtime true [WILDCARD] [WILDCARD] [WILDCARD] ([WILDCARD] … [WILDCARD]) [WILDCARD]
diff --git a/tests/testdata/bench/allow_none.out b/tests/testdata/bench/allow_none.out
index 0acf74691..9499e234a 100644
--- a/tests/testdata/bench/allow_none.out
+++ b/tests/testdata/bench/allow_none.out
@@ -18,6 +18,4 @@ run error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
ffi error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
-hrtime error: PermissionDenied: Can't escalate parent thread permissions
-[WILDCARD]
error: Bench failed
diff --git a/tests/testdata/run/025_hrtime.ts b/tests/testdata/run/025_hrtime.ts
deleted file mode 100644
index 7e69b0ddf..000000000
--- a/tests/testdata/run/025_hrtime.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-globalThis.onload = async () => {
- console.log(performance.now() % 2 !== 0);
- await Deno.permissions.revoke({ name: "hrtime" });
- console.log(performance.now() % 2 === 0);
-};
diff --git a/tests/testdata/run/025_hrtime.ts.out b/tests/testdata/run/025_hrtime.ts.out
deleted file mode 100644
index bb101b641..000000000
--- a/tests/testdata/run/025_hrtime.ts.out
+++ /dev/null
@@ -1,2 +0,0 @@
-true
-true
diff --git a/tests/testdata/run/deny_all_permission_args.js b/tests/testdata/run/deny_all_permission_args.js
index b0ca864fb..c63d2c362 100644
--- a/tests/testdata/run/deny_all_permission_args.js
+++ b/tests/testdata/run/deny_all_permission_args.js
@@ -5,4 +5,3 @@ console.log(Deno.permissions.querySync({ name: "ffi" }));
console.log(Deno.permissions.querySync({ name: "run" }));
console.log(Deno.permissions.querySync({ name: "sys" }));
console.log(Deno.permissions.querySync({ name: "net" }));
-console.log(Deno.permissions.querySync({ name: "hrtime" }));
diff --git a/tests/testdata/run/deny_all_permission_args.out b/tests/testdata/run/deny_all_permission_args.out
index 2a5228d62..de6f687f4 100644
--- a/tests/testdata/run/deny_all_permission_args.out
+++ b/tests/testdata/run/deny_all_permission_args.out
@@ -5,4 +5,3 @@ PermissionStatus { state: "denied", onchange: null }
PermissionStatus { state: "denied", onchange: null }
PermissionStatus { state: "denied", onchange: null }
PermissionStatus { state: "denied", onchange: null }
-PermissionStatus { state: "denied", onchange: null }
diff --git a/tests/testdata/run/deny_some_permission_args.js b/tests/testdata/run/deny_some_permission_args.js
index 320376b6f..357dda238 100644
--- a/tests/testdata/run/deny_some_permission_args.js
+++ b/tests/testdata/run/deny_some_permission_args.js
@@ -19,4 +19,3 @@ console.log(Deno.permissions.querySync({ name: "sys", kind: "loadavg" }));
console.log(Deno.permissions.querySync({ name: "net" }));
console.log(Deno.permissions.querySync({ name: "net", host: "127.0.0.1" }));
console.log(Deno.permissions.querySync({ name: "net", host: "192.168.0.1" }));
-console.log(Deno.permissions.querySync({ name: "hrtime" }));
diff --git a/tests/testdata/run/deny_some_permission_args.out b/tests/testdata/run/deny_some_permission_args.out
index 80c37159b..abb5274ee 100644
--- a/tests/testdata/run/deny_some_permission_args.out
+++ b/tests/testdata/run/deny_some_permission_args.out
@@ -19,4 +19,3 @@ PermissionStatus { state: "granted", onchange: null }
PermissionStatus { state: "granted", onchange: null, partial: true }
PermissionStatus { state: "denied", onchange: null }
PermissionStatus { state: "granted", onchange: null }
-PermissionStatus { state: "denied", onchange: null }
diff --git a/tests/testdata/test/allow_all.out b/tests/testdata/test/allow_all.out
index 8b783b823..b3bf5275f 100644
--- a/tests/testdata/test/allow_all.out
+++ b/tests/testdata/test/allow_all.out
@@ -1,5 +1,5 @@
[WILDCARD]
-running 14 tests from [WILDCARD]
+running 12 tests from [WILDCARD]
read false ... ok [WILDCARD]
read true ... ok [WILDCARD]
write false ... ok [WILDCARD]
@@ -12,7 +12,5 @@ run false ... ok [WILDCARD]
run true ... ok [WILDCARD]
ffi false ... ok [WILDCARD]
ffi true ... ok [WILDCARD]
-hrtime false ... ok [WILDCARD]
-hrtime true ... ok [WILDCARD]
-ok | 14 passed | 0 failed [WILDCARD]
+ok | 12 passed | 0 failed [WILDCARD]
diff --git a/tests/testdata/test/allow_all.ts b/tests/testdata/test/allow_all.ts
index 01341d9e5..7faa58c61 100644
--- a/tests/testdata/test/allow_all.ts
+++ b/tests/testdata/test/allow_all.ts
@@ -7,7 +7,6 @@ const permissions: Deno.PermissionName[] = [
"env",
"run",
"ffi",
- "hrtime",
];
for (const name of permissions) {
diff --git a/tests/testdata/test/allow_none.out b/tests/testdata/test/allow_none.out
index aaa467344..aaea9aea3 100644
--- a/tests/testdata/test/allow_none.out
+++ b/tests/testdata/test/allow_none.out
@@ -1,12 +1,11 @@
[WILDCARD]
-running 7 tests from [WILDCARD]
+running 6 tests from [WILDCARD]
read ... FAILED [WILDCARD]
write ... FAILED [WILDCARD]
net ... FAILED [WILDCARD]
env ... FAILED [WILDCARD]
run ... FAILED [WILDCARD]
ffi ... FAILED [WILDCARD]
-hrtime ... FAILED [WILDCARD]
ERRORS
@@ -34,10 +33,6 @@ ffi => ./test/allow_none.ts:[WILDCARD]
error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
-hrtime => ./test/allow_none.ts:[WILDCARD]
-error: PermissionDenied: Can't escalate parent thread permissions
-[WILDCARD]
-
FAILURES
read => ./test/allow_none.ts:[WILDCARD]
@@ -46,6 +41,5 @@ net => ./test/allow_none.ts:[WILDCARD]
env => ./test/allow_none.ts:[WILDCARD]
run => ./test/allow_none.ts:[WILDCARD]
ffi => ./test/allow_none.ts:[WILDCARD]
-hrtime => ./test/allow_none.ts:[WILDCARD]
-FAILED | 0 passed | 7 failed [WILDCARD]
+FAILED | 0 passed | 6 failed [WILDCARD]
diff --git a/tests/testdata/test/allow_none.ts b/tests/testdata/test/allow_none.ts
index 17a6f4014..e59a30c4d 100644
--- a/tests/testdata/test/allow_none.ts
+++ b/tests/testdata/test/allow_none.ts
@@ -7,7 +7,6 @@ const permissions: Deno.PermissionName[] = [
"env",
"run",
"ffi",
- "hrtime",
];
for (const name of permissions) {
diff --git a/tests/testdata/test/ignore_permissions.ts b/tests/testdata/test/ignore_permissions.ts
index ff3084441..e9ade6dfe 100644
--- a/tests/testdata/test/ignore_permissions.ts
+++ b/tests/testdata/test/ignore_permissions.ts
@@ -7,7 +7,6 @@ Deno.test({
env: true,
run: true,
ffi: true,
- hrtime: true,
},
ignore: true,
fn() {
diff --git a/tests/testdata/workers/no_permissions_worker.js b/tests/testdata/workers/no_permissions_worker.js
index f49f690ab..505f3b925 100644
--- a/tests/testdata/workers/no_permissions_worker.js
+++ b/tests/testdata/workers/no_permissions_worker.js
@@ -1,13 +1,11 @@
self.onmessage = async () => {
- const hrtime = await Deno.permissions.query({ name: "hrtime" });
const net = await Deno.permissions.query({ name: "net" });
const ffi = await Deno.permissions.query({ name: "ffi" });
const read = await Deno.permissions.query({ name: "read" });
const run = await Deno.permissions.query({ name: "run" });
const write = await Deno.permissions.query({ name: "write" });
self.postMessage(
- hrtime.state === "prompt" &&
- net.state === "prompt" &&
+ net.state === "prompt" &&
ffi.state === "prompt" &&
read.state === "prompt" &&
run.state === "prompt" &&
diff --git a/tests/testdata/workers/permission_echo.js b/tests/testdata/workers/permission_echo.js
index f492a25f2..501eaf2ca 100644
--- a/tests/testdata/workers/permission_echo.js
+++ b/tests/testdata/workers/permission_echo.js
@@ -1,7 +1,6 @@
self.onmessage = async () => {
const env = await Deno.permissions.query({ name: "env" });
const ffi = await Deno.permissions.query({ name: "ffi" });
- const hrtime = await Deno.permissions.query({ name: "hrtime" });
const net = await Deno.permissions.query({ name: "net" });
const read = await Deno.permissions.query({ name: "read" });
const run = await Deno.permissions.query({ name: "run" });
@@ -9,7 +8,6 @@ self.onmessage = async () => {
self.postMessage({
env: env.state,
ffi: ffi.state,
- hrtime: hrtime.state,
net: net.state,
read: read.state,
run: run.state,
diff --git a/tests/testdata/workers/read_check_granular_worker.js b/tests/testdata/workers/read_check_granular_worker.js
index d40fac876..7f2d0f717 100644
--- a/tests/testdata/workers/read_check_granular_worker.js
+++ b/tests/testdata/workers/read_check_granular_worker.js
@@ -3,7 +3,6 @@ postMessage({
envGlobal: (await Deno.permissions.query({ name: "env" })).state,
envFoo: (await Deno.permissions.query({ name: "env", variable: "foo" })).state,
envAbsent: (await Deno.permissions.query({ name: "env", variable: "absent" })).state,
- hrtime: (await Deno.permissions.query({ name: "hrtime" })).state,
netGlobal: (await Deno.permissions.query({ name: "net" })).state,
netFoo: (await Deno.permissions.query({ name: "net", host: "foo" })).state,
netFoo8000: (await Deno.permissions.query({ name: "net", host: "foo:8000" })).state,
diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts
index fb45e3ad6..c9c3c0110 100644
--- a/tests/unit/files_test.ts
+++ b/tests/unit/files_test.ts
@@ -782,14 +782,14 @@ Deno.test({ permissions: { read: true } }, function fsFileIsTerminal() {
});
Deno.test(
- { permissions: { read: true, run: true, hrtime: true } },
+ { permissions: { read: true, run: true } },
async function fsFileLockFileSync() {
await runFlockTests({ sync: true });
},
);
Deno.test(
- { permissions: { read: true, run: true, hrtime: true } },
+ { permissions: { read: true, run: true } },
async function fsFileLockFileAsync() {
await runFlockTests({ sync: false });
},
diff --git a/tests/unit/performance_test.ts b/tests/unit/performance_test.ts
index 0c9ed21df..93af641ad 100644
--- a/tests/unit/performance_test.ts
+++ b/tests/unit/performance_test.ts
@@ -7,7 +7,7 @@ import {
assertThrows,
} from "./test_util.ts";
-Deno.test({ permissions: { hrtime: false } }, async function performanceNow() {
+Deno.test({ permissions: {} }, async function performanceNow() {
const { promise, resolve } = Promise.withResolvers<void>();
const start = performance.now();
let totalTime = 0;
diff --git a/tests/unit/permissions_test.ts b/tests/unit/permissions_test.ts
index 4dab0696a..e18b0c8f2 100644
--- a/tests/unit/permissions_test.ts
+++ b/tests/unit/permissions_test.ts
@@ -70,7 +70,7 @@ Deno.test(function permissionSysInvalidKindSync() {
});
Deno.test(async function permissionQueryReturnsEventTarget() {
- const status = await Deno.permissions.query({ name: "hrtime" });
+ const status = await Deno.permissions.query({ name: "read", path: "." });
assert(["granted", "denied", "prompt"].includes(status.state));
let called = false;
status.addEventListener("change", () => {
@@ -78,11 +78,13 @@ Deno.test(async function permissionQueryReturnsEventTarget() {
});
status.dispatchEvent(new Event("change"));
assert(called);
- assert(status === (await Deno.permissions.query({ name: "hrtime" })));
+ assert(
+ status === (await Deno.permissions.query({ name: "read", path: "." })),
+ );
});
Deno.test(function permissionQueryReturnsEventTargetSync() {
- const status = Deno.permissions.querySync({ name: "hrtime" });
+ const status = Deno.permissions.querySync({ name: "read", path: "." });
assert(["granted", "denied", "prompt"].includes(status.state));
let called = false;
status.addEventListener("change", () => {
@@ -90,7 +92,7 @@ Deno.test(function permissionQueryReturnsEventTargetSync() {
});
status.dispatchEvent(new Event("change"));
assert(called);
- assert(status === Deno.permissions.querySync({ name: "hrtime" }));
+ assert(status === Deno.permissions.querySync({ name: "read", path: "." }));
});
Deno.test(async function permissionQueryForReadReturnsSameStatus() {
diff --git a/tests/unit/worker_test.ts b/tests/unit/worker_test.ts
index e5966348f..700f57b6b 100644
--- a/tests/unit/worker_test.ts
+++ b/tests/unit/worker_test.ts
@@ -451,7 +451,6 @@ Deno.test("Worker limit children permissions granularly", async function () {
deno: {
permissions: {
env: ["foo"],
- hrtime: true,
net: ["foo", "bar:8000"],
ffi: [new URL("foo", workerUrl), "bar"],
read: [new URL("foo", workerUrl), "bar"],
@@ -468,7 +467,6 @@ Deno.test("Worker limit children permissions granularly", async function () {
envGlobal: "prompt",
envFoo: "granted",
envAbsent: "prompt",
- hrtime: "granted",
netGlobal: "prompt",
netFoo: "granted",
netFoo8000: "granted",
@@ -508,7 +506,6 @@ Deno.test("Nested worker limit children permissions", async function () {
envGlobal: "prompt",
envFoo: "prompt",
envAbsent: "prompt",
- hrtime: "prompt",
netGlobal: "prompt",
netFoo: "prompt",
netFoo8000: "prompt",
@@ -586,7 +583,6 @@ Deno.test("Worker permissions are not inherited with empty permission object", a
worker.postMessage(null);
assertEquals(await promise, {
env: "prompt",
- hrtime: "prompt",
net: "prompt",
ffi: "prompt",
read: "prompt",
@@ -611,7 +607,6 @@ Deno.test("Worker permissions are not inherited with single specified permission
worker.postMessage(null);
assertEquals(await promise, {
env: "prompt",
- hrtime: "prompt",
net: "granted",
ffi: "prompt",
read: "prompt",