qt 6.6.0 clean

This commit is contained in:
kleuter
2023-11-01 22:23:55 +01:00
parent 7b5ada15e7
commit 5d8194efa7
1449 changed files with 134276 additions and 31391 deletions

View File

@ -68,9 +68,9 @@ export class BatchedTestRunner {
get errorDetails() { return this.#errorDetails; }
async run(targetIsBatch, testName, testOutputFormat) {
async run(targetIsBatch, testName, functions, testOutputFormat) {
try {
await this.#doRun(targetIsBatch, testName, testOutputFormat);
await this.#doRun(targetIsBatch, testName, functions, testOutputFormat);
} catch (e) {
this.#setTestRunnerError(e.message);
return;
@ -93,7 +93,7 @@ export class BatchedTestRunner {
this.#setTestRunnerStatus(status.code, status.numberOfFailed);
}
async #doRun(targetIsBatch, testName, testOutputFormat) {
async #doRun(targetIsBatch, testName, functions, testOutputFormat) {
const module = await this.#loader.loadEmscriptenModule(
targetIsBatch ? BatchedTestRunner.#TestBatchModuleName : testName,
() => { }
@ -111,6 +111,7 @@ export class BatchedTestRunner {
const LogToStdoutSpecialFilename = '-';
result = await module.exec({
args: [...(targetIsBatch ? [testClassName] : []),
...(functions ?? []),
'-o', `${LogToStdoutSpecialFilename},${testOutputFormat}`],
onStdout: (output) => {
this.#addTestOutput(testClassName, output);

View File

@ -5,8 +5,13 @@ import { RunnerStatus, TestStatus } from './batchedtestrunner.js';
// Sends messages to the running emrun instance via POST requests.
export class EmrunCommunication {
static #BATCHING_DELAY = 300;
#indexOfMessage = 0;
#postOutputPromises = [];
#postOutputPromise;
// Accumulate output in a batch that gets sent with a delay so that the emrun http server
// does not get pounded with requests.
#nextOutputBatch = null;
#post(body) {
return fetch('stdio.html', {
@ -15,10 +20,11 @@ export class EmrunCommunication {
});
}
// Returns a promise whose resolution signals that all outstanding traffic to the emrun instance
// has been completed.
waitUntilAllSent() {
return Promise.all(this.#postOutputPromises);
// Waits for the output sending to finish, if any output transfer is still in progress.
async waitUntilAllSent()
{
if (this.#postOutputPromise)
await this.#postOutputPromise;
}
// Posts the exit status to the running emrun instance. Emrun will drop connection unless it is
@ -29,13 +35,25 @@ export class EmrunCommunication {
// Posts an indexed output chunk to the running emrun instance. Each consecutive call to this
// method increments the output index by 1.
postOutput(output) {
const newPromise = this.#post(`^out^${this.#indexOfMessage++}^${output}`);
this.#postOutputPromises.push(newPromise);
newPromise.finally(() => {
this.#postOutputPromises.splice(this.#postOutputPromises.indexOf(newPromise), 1);
});
return newPromise;
postOutput(output)
{
if (this.#nextOutputBatch) {
this.#nextOutputBatch += output;
} else {
this.#nextOutputBatch = output;
this.#postOutputPromise = new Promise(resolve =>
{
window.setTimeout(() =>
{
const toSend = this.#nextOutputBatch;
this.#nextOutputBatch = null;
this.#post(`^out^${this.#indexOfMessage++}^${toSend}$`)
.finally(resolve);
}, EmrunCommunication.#BATCHING_DELAY);
});
}
return this.#postOutputPromise;
}
}

View File

@ -176,12 +176,6 @@ export class CompiledModule {
instanceParams.monitorRunDependencies = (name) => { };
instanceParams.print = (text) => true && console.log(text);
instanceParams.printErr = (text) => true && console.warn(text);
instanceParams.preRun = [
(instance) => {
const env = {};
instance.ENV = env;
},
];
instanceParams.mainScriptUrlOrBlob = new Blob([this.#js], {
type: 'text/javascript',

View File

@ -11,6 +11,22 @@ import {
import { parseQuery } from './util.js';
import { VisualOutputProducer, UI, ScannerFactory } from './qtestoutputreporter.js'
const StandardArg = {
qVisualOutput: 'qvisualoutput',
qTestName: 'qtestname',
qBatchedTest: 'qbatchedtest',
qUseEmrun: 'quseemrun',
qTestOutputFormat: 'qtestoutputformat',
}
const allArgs = new Set(Object.getOwnPropertyNames(StandardArg).map(arg => StandardArg[arg]));
Object.defineProperty(StandardArg, 'isKnown', {
get()
{
return name => allArgs.has(name);
},
});
(() => {
const setPageTitle = (useEmrun, testName, isBatch) => {
document.title = 'Qt WASM test runner';
@ -24,10 +40,11 @@ import { VisualOutputProducer, UI, ScannerFactory } from './qtestoutputreporter.
}
const parsed = parseQuery(location.search);
const outputInPage = parsed.get('qvisualoutput') !== undefined;
const testName = parsed.get('qtestname');
const isBatch = parsed.get('qbatchedtest') !== undefined;
const useEmrun = parsed.get('quseemrun') !== undefined;
const outputInPage = parsed.has(StandardArg.qVisualOutput);
const testName = parsed.get(StandardArg.qTestName);
const isBatch = parsed.has(StandardArg.qBatchedTest);
const useEmrun = parsed.has(StandardArg.qUseEmrun);
const functions = [...parsed.keys()].filter(arg => !StandardArg.isKnown(arg));
if (testName === undefined) {
if (!isBatch)
@ -37,7 +54,7 @@ import { VisualOutputProducer, UI, ScannerFactory } from './qtestoutputreporter.
}
const testOutputFormat = (() => {
const format = parsed.get('qtestoutputformat') ?? 'txt';
const format = parsed.get(StandardArg.qTestOutputFormat) ?? 'txt';
if (-1 === ['txt', 'xml', 'lightxml', 'junitxml', 'tap'].indexOf(format))
throw new Error(`Bad file format: ${format}`);
return format;
@ -65,5 +82,5 @@ import { VisualOutputProducer, UI, ScannerFactory } from './qtestoutputreporter.
}
setPageTitle(useEmrun, testName, isBatch);
testRunner.run(isBatch, testName, testOutputFormat);
testRunner.run(isBatch, testName, functions, testOutputFormat);
})();