Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 9 additions & 4 deletions src/framework/Framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -104,7 +105,9 @@ export class Framework {
})))
}

public async run(suites: Suite[]) {
public async run(suites: Suite[]): Promise<boolean> {
let success: boolean = true;

this.scheduled.concat(suites);
this.reporter.general();
const t0 = performance.now();
Expand All @@ -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();
Expand All @@ -126,6 +130,8 @@ export class Framework {
await Promise.all(suites.map(suite => suite.testees.map(async (testee: Testee) => {
await timeout<Object | void>('Shutdown testbed', testee.timeout, testee.shutdown());
})))

return success;
}

public async parallel(suites: Suite[]) {
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions src/manage/Compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompileOutput> {
Expand All @@ -94,7 +94,7 @@ export class WatCompiler extends Compiler {
// compile WAT to Wasm
return new Promise<CompileOutput>((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 = '';

Expand Down Expand Up @@ -122,7 +122,7 @@ export class WatCompiler extends Compiler {
public dump(output: CompileOutput): Promise<CompileOutput> {
// object dump
return new Promise<CompileOutput>((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());
Expand Down
2 changes: 1 addition & 1 deletion src/util/env.ts
Original file line number Diff line number Diff line change
@@ -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`;

Expand Down
2 changes: 1 addition & 1 deletion tests/examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ debug.test({
steps: [DUMP]
});

framework.run([spec, debug]).then(() => process.exit(0));
framework.analyse([spec, debug]);
Loading