Allow filtering of test functions to run in WASM testrunner
Just proxy any non-standard arg to the WASM module and let it use the arg as a filter Change-Id: Ia77a30ca872497425017edb8fa8961b6d687ca68 Reviewed-by: Michal Klocek <michal.klocek@qt.io>bb10
parent
cde904b38a
commit
d552558170
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in New Issue