summaryrefslogtreecommitdiffstats
path: root/util/wasm/batchedtestrunner
diff options
context:
space:
mode:
Diffstat (limited to 'util/wasm/batchedtestrunner')
-rw-r--r--util/wasm/batchedtestrunner/batchedtestrunner.html2
-rw-r--r--util/wasm/batchedtestrunner/batchedtestrunner.js2
-rw-r--r--util/wasm/batchedtestrunner/emrunadapter.js2
-rw-r--r--util/wasm/batchedtestrunner/qtestoutputreporter.css2
-rw-r--r--util/wasm/batchedtestrunner/qtestoutputreporter.js2
-rw-r--r--util/wasm/batchedtestrunner/qwasmjsruntime.js44
-rw-r--r--util/wasm/batchedtestrunner/qwasmtestmain.js2
-rw-r--r--util/wasm/batchedtestrunner/util.js2
8 files changed, 33 insertions, 25 deletions
diff --git a/util/wasm/batchedtestrunner/batchedtestrunner.html b/util/wasm/batchedtestrunner/batchedtestrunner.html
index 0b85e48691..147cf34376 100644
--- a/util/wasm/batchedtestrunner/batchedtestrunner.html
+++ b/util/wasm/batchedtestrunner/batchedtestrunner.html
@@ -1,6 +1,6 @@
<!--
Copyright (C) 2022 The Qt Company Ltd.
-SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-->
<!doctype html>
diff --git a/util/wasm/batchedtestrunner/batchedtestrunner.js b/util/wasm/batchedtestrunner/batchedtestrunner.js
index 7cd5f2d350..453865a935 100644
--- a/util/wasm/batchedtestrunner/batchedtestrunner.js
+++ b/util/wasm/batchedtestrunner/batchedtestrunner.js
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import {
AbortedError,
diff --git a/util/wasm/batchedtestrunner/emrunadapter.js b/util/wasm/batchedtestrunner/emrunadapter.js
index 96c5624131..5b4284e18f 100644
--- a/util/wasm/batchedtestrunner/emrunadapter.js
+++ b/util/wasm/batchedtestrunner/emrunadapter.js
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import { RunnerStatus, TestStatus } from './batchedtestrunner.js';
diff --git a/util/wasm/batchedtestrunner/qtestoutputreporter.css b/util/wasm/batchedtestrunner/qtestoutputreporter.css
index 3cf312b11a..aefb867b81 100644
--- a/util/wasm/batchedtestrunner/qtestoutputreporter.css
+++ b/util/wasm/batchedtestrunner/qtestoutputreporter.css
@@ -1,6 +1,6 @@
/*
Copyright (C) 2022 The Qt Company Ltd.
- SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+ SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
*/
:root {
diff --git a/util/wasm/batchedtestrunner/qtestoutputreporter.js b/util/wasm/batchedtestrunner/qtestoutputreporter.js
index ad8a373540..7af288b8f0 100644
--- a/util/wasm/batchedtestrunner/qtestoutputreporter.js
+++ b/util/wasm/batchedtestrunner/qtestoutputreporter.js
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import { RunnerStatus, TestStatus } from './batchedtestrunner.js'
diff --git a/util/wasm/batchedtestrunner/qwasmjsruntime.js b/util/wasm/batchedtestrunner/qwasmjsruntime.js
index b8603f2618..3f2d421181 100644
--- a/util/wasm/batchedtestrunner/qwasmjsruntime.js
+++ b/util/wasm/batchedtestrunner/qwasmjsruntime.js
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// Exposes platform capabilities as static properties
@@ -109,18 +109,19 @@ export class CompiledModule {
this.#resourceLocator = resourceLocator;
}
- static make(js, wasm, resourceLocator
- ) {
+ static make(js, wasm, entryFunctionName, resourceLocator)
+ {
const exports = {};
+ const module = {};
eval(js);
- if (!exports.createQtAppInstance) {
+ if (!module.exports) {
throw new Error(
- 'createQtAppInstance has not been exported by the main script'
+ '${entryFunctionName} has not been exported by the main script'
);
}
return new CompiledModule(
- exports.createQtAppInstance, js, wasm, resourceLocator
+ module.exports, js, wasm, resourceLocator
);
}
@@ -128,16 +129,9 @@ export class CompiledModule {
return await new Promise(async (resolve, reject) => {
let instance = undefined;
let result = undefined;
- const continuation = () => {
- if (!(instance && result))
- return;
- resolve({
- stdout: result.stdout,
- exitCode: result.exitCode,
- instance,
- });
- };
+ let testFinished = false;
+ const testFinishedEvent = new CustomEvent('testFinished');
instance = await this.#createQtAppInstanceFn((() => {
const params = this.#makeDefaultExecParams({
onInstantiationError: (error) => { reject(error); },
@@ -153,12 +147,26 @@ export class CompiledModule {
params.quit = (code, exception) => {
if (exception && exception.name !== 'ExitStatus')
reject(exception);
+ };
+ params.notifyTestFinished = (code) => {
result = { stdout: data, exitCode: code };
- continuation();
+ testFinished = true;
+ window.dispatchEvent(testFinishedEvent);
};
return params;
})());
- continuation();
+ if (!testFinished) {
+ await new Promise((resolve) => {
+ window.addEventListener('testFinished', () => {
+ resolve();
+ });
+ });
+ }
+ resolve({
+ stdout: result.stdout,
+ exitCode: result.exitCode,
+ instance,
+ });
});
}
@@ -218,6 +226,6 @@ export class ModuleLoader {
);
const [js, wasm] = await Promise.all([jsLoadPromise, wasmLoadPromise]);
- return CompiledModule.make(js, wasm, this.#resourceLocator);
+ return CompiledModule.make(js, wasm, `${moduleName}_entry`, this.#resourceLocator);
}
}
diff --git a/util/wasm/batchedtestrunner/qwasmtestmain.js b/util/wasm/batchedtestrunner/qwasmtestmain.js
index 497f5309b1..a92a3a4b30 100644
--- a/util/wasm/batchedtestrunner/qwasmtestmain.js
+++ b/util/wasm/batchedtestrunner/qwasmtestmain.js
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import { BatchedTestRunner } from './batchedtestrunner.js'
import { EmrunAdapter, EmrunCommunication } from './emrunadapter.js'
diff --git a/util/wasm/batchedtestrunner/util.js b/util/wasm/batchedtestrunner/util.js
index 07a0e73e1a..a297baf6b2 100644
--- a/util/wasm/batchedtestrunner/util.js
+++ b/util/wasm/batchedtestrunner/util.js
@@ -1,5 +1,5 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
export function parseQuery() {
const trimmed = window.location.search.substring(1);