Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions JetStreamDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function getIntParam(urlParams, key) {
const rawValue = urlParams.get(key);
const value = parseInt(rawValue);
if (value <= 0)
throw new Error(`Expected positive value for ${key}, but got ${rawValue}`)
return value
throw new Error(`Expected positive value for ${key}, but got ${rawValue}`);
return value;
}

function getTestListParam(urlParams, key) {
Expand Down
65 changes: 63 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,43 @@
*/

load("./shell-config.js")
load("./JetStreamDriver.js");

const cliFlags = { __proto__: null };
const cliArgs = [];
if (globalThis.arguments?.length) {
for (const argument of globalThis.arguments)
if (argument.startsWith("--")) {
const parts = argument.split("=");
cliFlags[parts[0].toLowerCase()] = parts.slice(1).join("=");
Comment thread
camillobruni marked this conversation as resolved.
} else
cliArgs.push(argument);
}

function getIntFlag(flags, flag) {
if (!(flag in flags))
return undefined;
const rawValue = flags[flag];
const value = parseInt(rawValue);
if (value <= 0)
throw new Error(`Expected positive value for ${flag}, but got ${rawValue}`);
return value;
}

if ("--iteration-count" in cliFlags)
globalThis.testIterationCount = getIntFlag(cliFlags, "--iteration-count");
Comment thread
camillobruni marked this conversation as resolved.

if ("--worst-case-count" in cliFlags)
Comment thread
camillobruni marked this conversation as resolved.
globalThis.testWorstCaseCount = getIntFlag(cliFlags, "--worst-case-count");

if ("--dump-json-results" in cliFlags)
globalThis.dumpJSONResults = true;
Comment thread
camillobruni marked this conversation as resolved.

if (typeof runMode !== "undefined" && runMode == "RAMification")
globalThis.RAMification = true;
Comment thread
camillobruni marked this conversation as resolved.

if (cliArgs.length)
globalThis.testList = cliArgs;


async function runJetStream() {
try {
Expand All @@ -36,4 +72,29 @@ async function runJetStream() {
throw e;
}
}
runJetStream();

load("./JetStreamDriver.js");

if ("--help" in cliFlags) {
console.log("JetStream Driver Help");
console.log("");

console.log("Options:");
console.log(" --iteration-count: Set the default iteration count.");
console.log(" ---worst-case-count: Set the default worst-case count");
Comment thread
camillobruni marked this conversation as resolved.
Outdated
console.log(" --dump-json-results: Print summary json to the console.");
console.log("");

console.log("Available tags:");
const tagNames = Array.from(benchmarksByTag.keys()).sort();
for (const tagName of tagNames)
console.log(" ", tagName);
console.log("");

console.log("Available tests:");
const benchmarkNames = BENCHMARKS.map(b => b.name).sort();
for (const benchmark of benchmarkNames)
console.log(" ", benchmark);
} else {
runJetStream();
}
5 changes: 0 additions & 5 deletions shell-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,3 @@ if (isSpiderMonkey) {
globalThis.readFile = readRelativeToScript;
globalThis.arguments = scriptArgs;
}
if (globalThis.arguments?.length)
globalThis.testList = globalThis.arguments.slice();

if (typeof runMode !== "undefined" && runMode == "RAMification")
globalThis.RAMification = true;
Loading