Skip to content

Commit

Permalink
exit with 1 on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
doehyunbaek committed Aug 20, 2024
1 parent be19f19 commit a71ede3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type TestReport = (
| Failure
);

async function runWasmR3Tests(names: string[], options) {
async function runWasmR3Tests(names: string[], options): Promise<number> {
console.log(`Run ${options.category} tests`);
let successful = 0;
for (let name of names) {
Expand All @@ -32,6 +32,7 @@ async function runWasmR3Tests(names: string[], options) {
`finished running ${names.length} ${options.category} testcases. Pass: ${successful}, Fail: ${fail}, FailRate: ${(fail / names.length) * 100
}%`
);
return fail
}

async function runSingleTest(options, name: string): Promise<TestReport> {
Expand Down Expand Up @@ -98,7 +99,12 @@ async function analyzeAndSaveBenchmark(options: any, testJsPath: string, website
testNames = testNames.filter((n) => options.testcases.includes(n));
testNames = Array.from(new Set([...testNames, ...options.testcases]));
}
await runWasmR3Tests(testNames, options);
const failNumber = await runWasmR3Tests(testNames, options);
if (failNumber > 0) {
exit(1);
} else {
exit(0);
}
}
if (options.category === ("slicedice")) {
let testNames = await getDirectoryNames(
Expand All @@ -110,7 +116,6 @@ async function analyzeAndSaveBenchmark(options: any, testJsPath: string, website
}
await runSliceDiceTests(testNames, options);
}
exit(0)
})();

function getPaths(name: string, options: any) {
Expand Down

0 comments on commit a71ede3

Please sign in to comment.