From b825e37402fd41954c3470e0331a2a35bccd5ac7 Mon Sep 17 00:00:00 2001 From: Ryan Qian Date: Fri, 19 Jan 2024 22:51:18 +0800 Subject: [PATCH] benchmark: fix api restriction for the permission category give appropriate permissions to the following scripts: * permission-processhas-fs-read.js: 'ChildProcess' permission * permission-startup.js: 'FileSystemRead' permission > Paths delimited by comma (,) are no longer allowed. Refs: https://github.com/nodejs/node/blob/main/doc/api/cli.md#--allow-fs-read Signed-off-by: Ryan Qian --- benchmark/permission/permission-processhas-fs-read.js | 1 + benchmark/permission/permission-startup.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmark/permission/permission-processhas-fs-read.js b/benchmark/permission/permission-processhas-fs-read.js index bd81814e55861a..e0b2efdb3b2f74 100644 --- a/benchmark/permission/permission-processhas-fs-read.js +++ b/benchmark/permission/permission-processhas-fs-read.js @@ -13,6 +13,7 @@ const options = { flags: [ '--experimental-permission', `--allow-fs-read=${rootPath}`, + '--allow-child-process', ], }; diff --git a/benchmark/permission/permission-startup.js b/benchmark/permission/permission-startup.js index c800706299bb23..a65b5cafdc543f 100644 --- a/benchmark/permission/permission-startup.js +++ b/benchmark/permission/permission-startup.js @@ -47,12 +47,14 @@ function spawnProcess(script, bench, state) { function main({ count, script, nFiles, prefixPath }) { script = path.resolve(__dirname, '../../', `${script}.js`); - const files = mockFiles(nFiles, prefixPath).join(','); const optionsWithScript = [ '--experimental-permission', - `--allow-fs-read=${files},${script}`, - script, + `--allow-fs-read=${script}`, ]; + for (const file of mockFiles(nFiles, prefixPath)) { + optionsWithScript.push('--allow-fs-read=' + file); + } + optionsWithScript.push(script); const warmup = 3; const state = { count, finished: -warmup }; spawnProcess(optionsWithScript, bench, state);