diff --git a/src/framework/Framework.ts b/src/framework/Framework.ts index 1e393ec..8c359db 100644 --- a/src/framework/Framework.ts +++ b/src/framework/Framework.ts @@ -8,6 +8,7 @@ import {StyleType} from '../reporter'; import {styling} from '../reporter/Style'; import {SuiteResult} from '../reporter/Results'; import {Reporter} from '../reporter/Reporter'; +import {Outcome} from "../reporter/describers/Describer"; interface DependenceTree { test: TestScenario; @@ -104,7 +105,9 @@ export class Framework { }))) } - public async run(suites: Suite[]) { + public async run(suites: Suite[]): Promise { + let success: boolean = true; + this.scheduled.concat(suites); this.reporter.general(); const t0 = performance.now(); @@ -118,6 +121,7 @@ export class Framework { await this.runSuite(result, testee, order); this.reporter.report(result); + success = success && result.outcome === Outcome.succeeded; })) })) const t1 = performance.now(); @@ -126,6 +130,8 @@ export class Framework { await Promise.all(suites.map(suite => suite.testees.map(async (testee: Testee) => { await timeout('Shutdown testbed', testee.timeout, testee.shutdown()); }))) + + return success; } public async parallel(suites: Suite[]) { @@ -162,10 +168,9 @@ export class Framework { } } - // Analyse flakiness - public analyse(suite: Suite[], runs: number = 3) { + public analyse(suite: Suite[], runs: number = 1) { this.runs = runs; - this.run(suite); + this.run(suite).then((success: boolean) => process.exit(success ? 0 : 1)); } public static getImplementation() { diff --git a/src/manage/Compiler.ts b/src/manage/Compiler.ts index 9281a13..3fa0ca1 100644 --- a/src/manage/Compiler.ts +++ b/src/manage/Compiler.ts @@ -72,7 +72,7 @@ export class WatCompiler extends Compiler { constructor(wabt: string) { super(); - this.wabt = wabt; + this.wabt = wabt.length > 0 ? wabt + "/" : ""; } public async compile(program: string, dir?: string): Promise { @@ -94,7 +94,7 @@ export class WatCompiler extends Compiler { // compile WAT to Wasm return new Promise((resolve, reject) => { const file = `${dir}/upload.wasm`; - const command = `${this.wabt}/wat2wasm --no-canonicalize-leb128s --disable-bulk-memory --debug-names -v -o ${file} ${program}`; + const command = `${this.wabt}wat2wasm --no-canonicalize-leb128s --disable-bulk-memory --debug-names -v -o ${file} ${program}`; let out: string = ''; let err: string = ''; @@ -122,7 +122,7 @@ export class WatCompiler extends Compiler { public dump(output: CompileOutput): Promise { // object dump return new Promise((resolve, reject) => { - const command = `${this.wabt}/wasm-objdump -x -m ${output.file}`; + const command = `${this.wabt}wasm-objdump -x -m ${output.file}`; const compile = exec(command, (error: ExecException | null, stdout: string) => { output.map = this.parseWasmObjDump(output, stdout.toString()); diff --git a/src/util/env.ts b/src/util/env.ts index 076663d..78b8725 100644 --- a/src/util/env.ts +++ b/src/util/env.ts @@ -1,6 +1,6 @@ import {homedir} from 'os'; -export const WABT: string = process.env.WABT ?? `${homedir()}/Documents/TOPL/plugin/WABT/build/`; +export const WABT: string = process.env.WABT ?? `${homedir()}/Arduino/libraries/WARDuino/lib/wabt/build/`; export const EMULATOR: string = process.env.EMULATOR ?? `${homedir()}/Arduino/libraries/WARDuino/build-emu/wdcli`; diff --git a/tests/examples/example.ts b/tests/examples/example.ts index d2827d7..2648b58 100644 --- a/tests/examples/example.ts +++ b/tests/examples/example.ts @@ -94,4 +94,4 @@ debug.test({ steps: [DUMP] }); -framework.run([spec, debug]).then(() => process.exit(0)); +framework.analyse([spec, debug]);