diff --git a/JetStreamDriver.js b/JetStreamDriver.js index de06496d..f1e0f37a 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -2391,9 +2391,10 @@ function processTestList(testList) else benchmarkNames = testList.split(/[\s,]/); - for (const name of benchmarkNames) { + for (let name of benchmarkNames) { + name = name.toLowerCase(); if (benchmarksByTag.has(name)) - benchmarks.push(...findBenchmarksByTag(name)); + benchmarks.concat(findBenchmarksByTag(name)); else benchmarks.push(findBenchmarkByName(name)); } diff --git a/generators/async-file-system.js b/generators/async-file-system.js index fac354b2..9f85daf0 100644 --- a/generators/async-file-system.js +++ b/generators/async-file-system.js @@ -56,9 +56,13 @@ class File { set data(dataView) { this._data = dataView; } swapByteOrder() { + let hash = 0x1a2b3c4d; for (let i = 0; i < Math.floor(this.data.byteLength / 8) * 8; i += 8) { - this.data.setFloat64(i, this.data.getFloat64(i, isLittleEndian), !isLittleEndian); + const data = this.data.getFloat64(i, isLittleEndian); + this.data.setFloat64(i, data, !isLittleEndian); + hash ^= data | 0; } + return hash; } } @@ -171,11 +175,16 @@ async function setupDirectory() { } class Benchmark { + EXPECTED_FILE_COUNT = 666; + + totalFileCount = 0; + lastFileHash = undefined; + async runIteration() { const fs = await setupDirectory(); for await (let { entry: file } of fs.forEachFileRecursively()) { - file.swapByteOrder(); + this.lastFileHash = file.swapByteOrder(); } for await (let { name, entry: dir } of fs.forEachDirectoryRecursively()) { @@ -187,5 +196,17 @@ class Benchmark { } } } + + for await (let _ of fs.forEachFileRecursively()) { + this.totalFileCount++; + } + } + + validate(iterations) { + const expectedFileCount = this.EXPECTED_FILE_COUNT * iterations; + if (this.totalFileCount != expectedFileCount) + throw new Error(`Invalid total file count ${this.totalFileCount}, expected ${expectedFileCount}.`); + if (this.lastFileHash === undefined) + throw new Error(`Invalid file hash: ${this.lastFileHash}`); } } diff --git a/generators/sync-file-system.js b/generators/sync-file-system.js index 3b33d91a..60fbdeff 100644 --- a/generators/sync-file-system.js +++ b/generators/sync-file-system.js @@ -53,9 +53,13 @@ class File { set data(dataView) { this._data = dataView; } swapByteOrder() { + let hash = 0x1a2b3c4d; for (let i = 0; i < Math.floor(this.data.byteLength / 8) * 8; i += 8) { - this.data.setFloat64(i, this.data.getFloat64(i, isLittleEndian), !isLittleEndian); + const data = this.data.getFloat64(i, isLittleEndian); + this.data.setFloat64(i, data, !isLittleEndian); + hash ^= data | 0; } + return hash; } } @@ -161,11 +165,16 @@ function setupDirectory() { } class Benchmark { + EXPECTED_FILE_COUNT = 411; + + totalFileCount = 0; + lastFileHash = undefined; + runIteration() { const fs = setupDirectory(); for (let { entry: file } of fs.forEachFileRecursively()) { - file.swapByteOrder(); + this.lastFileHash = file.swapByteOrder(); } for (let { name, entry: dir } of fs.forEachDirectoryRecursively()) { @@ -178,5 +187,17 @@ class Benchmark { } } } + + for (let _ of fs.forEachFileRecursively()) { + this.totalFileCount++; + } + } + + validate(iterations) { + const expectedFileCount = this.EXPECTED_FILE_COUNT * iterations; + if (this.totalFileCount != expectedFileCount) + throw new Error(`Invalid total file count ${this.totalFileCount}, expected ${expectedFileCount}.`); + if (this.lastFileHash === undefined) + throw new Error(`Invalid file hash: ${this.lastFileHash}`); } } diff --git a/tests/run.mjs b/tests/run.mjs index 6ef609a9..67f0f11f 100644 --- a/tests/run.mjs +++ b/tests/run.mjs @@ -103,7 +103,7 @@ async function testEnd2End(params) { async function benchmarkResults(driver) { logInfo("JetStream START"); - await driver.manage().setTimeouts({ script: 60_000 }); + await driver.manage().setTimeouts({ script: 2 * 60_000 }); await driver.executeAsyncScript((callback) => { globalThis.JetStream.start(); callback(); @@ -118,7 +118,7 @@ async function benchmarkResults(driver) { class JetStreamTestError extends Error { constructor(errors) { - super(`Tests failed: ${errors.map(e => e.name).join(", ")}`); + super(`Tests failed: ${errors.map(e => e.stack).join(", ")}`); this.errors = errors; }