Skip to content

Commit

Permalink
Run tests serially in cmdline runner (gpuweb#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Feb 19, 2020
1 parent 8d5db5c commit b68612d
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/runtime/cmdline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,26 @@ for (const a of process.argv.slice(2)) {
const failed: Array<[TestSpecID, LiveTestCaseResult]> = [];
const warned: Array<[TestSpecID, LiveTestCaseResult]> = [];

// TODO: don't run all tests all at once
const running = [];
let total = 0;
for (const f of files) {
if (!('g' in f.spec)) {
continue;
}

const [rec] = log.record(f.id);
for (const t of f.spec.g.iterate(rec)) {
running.push(
(async () => {
const res = await t.run();
if (res.status === 'fail') {
failed.push([f.id, res]);
}
if (res.status === 'warn') {
warned.push([f.id, res]);
}
})()
);
const res = await t.run();
if (res.status === 'fail') {
failed.push([f.id, res]);
}
if (res.status === 'warn') {
warned.push([f.id, res]);
}
}
total++;
}

assert(running.length !== 0, 'found no tests!');

await Promise.all(running);
assert(total > 0, 'found no tests!');

// TODO: write results out somewhere (a file?)
if (verbose) {
Expand Down Expand Up @@ -103,7 +97,6 @@ for (const a of process.argv.slice(2)) {
printResults(failed);
}

const total = running.length;
const passed = total - warned.length - failed.length;
function pct(x: number): string {
return ((100 * x) / total).toFixed(2);
Expand Down

0 comments on commit b68612d

Please sign in to comment.