Skip to content

Commit 124b45f

Browse files
committed
Improve stability
1 parent 8ca7517 commit 124b45f

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/framework/Framework.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ export class Framework {
5757
public run(cores: number = 1) { // todo remove cores
5858
this.suites.forEach((suite: Suite) => {
5959
this.testees.forEach((testee: Testee) => {
60+
const order: TestScenario[] = testee.scheduler.schedule(suite);
61+
const first: TestScenario = order[0];
62+
before('Initialize testbed', async function () {
63+
this.timeout(testee.connector.timeout(testee.specification.type));
64+
await testee.initialize(first.program, first.args ?? []);
65+
});
66+
6067
describe(`Testing on ${testee.name}.`, () => {
6168
// todo add parallelism
62-
const order: TestScenario[] = testee.scheduler.schedule(suite);
6369

6470
// if (!bed.disabled) { // TODO necessary? isn't this done in de test itself?
6571
//
@@ -70,17 +76,7 @@ export class Framework {
7076
// });
7177
// }
7278

73-
let initialized: boolean = false;
74-
7579
order.forEach((test: TestScenario) => {
76-
if (!initialized) {
77-
before('Initialize testbed', async function () {
78-
this.timeout(testee.connector.timeout(testee.specification.type));
79-
await testee.initialize(test.program, test.args ?? []);
80-
});
81-
initialized = true;
82-
}
83-
8480
testee.describe(test, this.runs);
8581
});
8682
});

src/framework/Testee.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ export class Testee { // TODO unified with testbed interface
106106
before('Compile and upload program', async function () {
107107
this.timeout(testee.connector.timeout(testee.specification.type));
108108
let compiled: CompileOutput = await new CompilerFactory(WABT).pickCompiler(description.program).compile(description.program);
109-
await testee.testbed!.sendRequest(new SourceMap.Mapping(), Message.updateModule(compiled.file));
109+
try {
110+
await testee.testbed!.sendRequest(new SourceMap.Mapping(), Message.updateModule(compiled.file));
111+
} catch (e) {
112+
await testee.initialize(description.program, description.args ?? []);
113+
}
110114
});
111115

112116
before('Fetch source map', async function () {

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ export * from './framework/scenario/Invoker';
1616
export * from './testbeds/TestbedSpecification';
1717

1818
export const latch = Framework.getImplementation();
19-
export {find} from './util/util';

0 commit comments

Comments
 (0)