@iamsergio/qttest-utils 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +283 -0
- package/out/cmake.js +31 -42
- package/out/example.js +53 -64
- package/out/qttest.js +244 -252
- package/out/test.js +206 -221
- package/out/utils.js +17 -7
- package/package.json +16 -6
- package/.release-please-manifest.json +0 -3
- package/CONTRIBUTING.md +0 -33
- package/Changelog +0 -229
- package/release-please-config.json +0 -16
- package/test.sh +0 -7
package/out/qttest.js
CHANGED
|
@@ -18,27 +18,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
37
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
40
|
};
|
|
40
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.QtTests = exports.QtTestSlot = exports.QtTest =
|
|
42
|
+
exports.QtTests = exports.QtTestSlot = exports.QtTest = void 0;
|
|
43
|
+
exports.logMessage = logMessage;
|
|
42
44
|
const child_process_1 = require("child_process");
|
|
43
45
|
const path_1 = __importDefault(require("path"));
|
|
44
46
|
const fs = __importStar(require("fs"));
|
|
@@ -50,21 +52,24 @@ function logMessage(message) {
|
|
|
50
52
|
gLogFunction(message);
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
|
-
exports.logMessage = logMessage;
|
|
54
55
|
/**
|
|
55
56
|
* Represents a single QtTest executable.
|
|
56
57
|
* Supports listing the individual test slots
|
|
57
58
|
*/
|
|
58
59
|
class QtTest {
|
|
60
|
+
filename;
|
|
61
|
+
buildDirPath;
|
|
62
|
+
/// If true, will print more verbose output
|
|
63
|
+
verbose = false;
|
|
64
|
+
/// Allows vscode extensions to associate with a test item
|
|
65
|
+
vscodeTestItem;
|
|
66
|
+
/// The list of individual runnable test slots
|
|
67
|
+
slots = null;
|
|
68
|
+
/// Set after running
|
|
69
|
+
lastExitCode = 0;
|
|
70
|
+
/// Allows the caller to receive the output of the test process
|
|
71
|
+
outputFunc = undefined;
|
|
59
72
|
constructor(filename, buildDirPath) {
|
|
60
|
-
/// If true, will print more verbose output
|
|
61
|
-
this.verbose = false;
|
|
62
|
-
/// The list of individual runnable test slots
|
|
63
|
-
this.slots = null;
|
|
64
|
-
/// Set after running
|
|
65
|
-
this.lastExitCode = 0;
|
|
66
|
-
/// Allows the caller to receive the output of the test process
|
|
67
|
-
this.outputFunc = undefined;
|
|
68
73
|
this.filename = filename;
|
|
69
74
|
this.buildDirPath = buildDirPath;
|
|
70
75
|
}
|
|
@@ -93,48 +98,46 @@ class QtTest {
|
|
|
93
98
|
/**
|
|
94
99
|
* Calls "./yourqttest -functions" and stores the results in the slots property.
|
|
95
100
|
*/
|
|
96
|
-
parseAvailableSlots() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.slots.push(slot);
|
|
125
|
-
}
|
|
101
|
+
async parseAvailableSlots() {
|
|
102
|
+
let slotNames = [];
|
|
103
|
+
let output = "";
|
|
104
|
+
let err = "";
|
|
105
|
+
await new Promise((resolve, reject) => {
|
|
106
|
+
if (!fs.existsSync(this.filename)) {
|
|
107
|
+
reject(new Error("qttest: File doesn't exit: " + this.filename));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const child = (0, child_process_1.spawn)(this.filename, ["-functions"], {
|
|
111
|
+
cwd: this.buildDirPath,
|
|
112
|
+
});
|
|
113
|
+
child.stdout.on("data", (chunk) => {
|
|
114
|
+
output += chunk.toString();
|
|
115
|
+
});
|
|
116
|
+
child.stderr.on("data", (chunk) => {
|
|
117
|
+
err += chunk.toString();
|
|
118
|
+
});
|
|
119
|
+
child.on("exit", (code) => {
|
|
120
|
+
if (code === 0) {
|
|
121
|
+
slotNames = slotNames.concat(output.split("\n"));
|
|
122
|
+
slotNames = slotNames.map((entry) => entry.trim().replace("()", ""));
|
|
123
|
+
slotNames = slotNames.filter((entry) => entry.length > 0);
|
|
124
|
+
if (slotNames.length > 0) {
|
|
125
|
+
this.slots = [];
|
|
126
|
+
for (var slotName of slotNames) {
|
|
127
|
+
var slot = new QtTestSlot(slotName, this);
|
|
128
|
+
this.slots.push(slot);
|
|
126
129
|
}
|
|
127
|
-
resolve(slotNames);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
reject(new Error("qttest: Failed to run -functions, stdout=" +
|
|
131
|
-
output +
|
|
132
|
-
"; stderr=" +
|
|
133
|
-
err +
|
|
134
|
-
"; code=" +
|
|
135
|
-
code));
|
|
136
130
|
}
|
|
137
|
-
|
|
131
|
+
resolve(slotNames);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
reject(new Error("qttest: Failed to run -functions, stdout=" +
|
|
135
|
+
output +
|
|
136
|
+
"; stderr=" +
|
|
137
|
+
err +
|
|
138
|
+
"; code=" +
|
|
139
|
+
code));
|
|
140
|
+
}
|
|
138
141
|
});
|
|
139
142
|
});
|
|
140
143
|
}
|
|
@@ -178,27 +181,25 @@ class QtTest {
|
|
|
178
181
|
}
|
|
179
182
|
/// Returns whether this test is a QtTest by running it with -help and checking if the help text looks familiar
|
|
180
183
|
/// Note that if this is not a QtTest it might not run help and instead execute the test itself
|
|
181
|
-
isQtTestViaHelp() {
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
result = true;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
child.on("exit", (code) => {
|
|
195
|
-
if (code === 0) {
|
|
196
|
-
resolve(result);
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
resolve(false);
|
|
184
|
+
async isQtTestViaHelp() {
|
|
185
|
+
return await new Promise((resolve, reject) => {
|
|
186
|
+
const child = (0, child_process_1.spawn)(this.filename, ["-help"]);
|
|
187
|
+
let output = "";
|
|
188
|
+
let result = false;
|
|
189
|
+
child.stdout.on("data", (chunk) => {
|
|
190
|
+
if (!result) {
|
|
191
|
+
if (chunk.toString().includes("[testfunction[:testdata]]")) {
|
|
192
|
+
result = true;
|
|
200
193
|
}
|
|
201
|
-
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
child.on("exit", (code) => {
|
|
197
|
+
if (code === 0) {
|
|
198
|
+
resolve(result);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
resolve(false);
|
|
202
|
+
}
|
|
202
203
|
});
|
|
203
204
|
});
|
|
204
205
|
}
|
|
@@ -212,64 +213,62 @@ class QtTest {
|
|
|
212
213
|
return undefined;
|
|
213
214
|
}
|
|
214
215
|
/// Runs this test
|
|
215
|
-
runTest(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
216
|
+
async runTest(slot, cwd = "") {
|
|
217
|
+
let args = [];
|
|
218
|
+
if (slot) {
|
|
219
|
+
// Runs a single Qt test instead
|
|
220
|
+
args = args.concat(slot.name);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
this.clearSubTestStates();
|
|
224
|
+
}
|
|
225
|
+
// log to file and to stdout
|
|
226
|
+
args = args.concat("-o").concat(this.tapOutputFileName(slot) + ",tap");
|
|
227
|
+
args = args.concat("-o").concat(this.txtOutputFileName(slot) + ",txt");
|
|
228
|
+
args = args.concat("-o").concat("-,txt");
|
|
229
|
+
return await new Promise((resolve, reject) => {
|
|
230
|
+
let cwdDir = cwd.length > 0 ? cwd : this.buildDirPath;
|
|
231
|
+
logMessage("Running " +
|
|
232
|
+
this.filename +
|
|
233
|
+
" " +
|
|
234
|
+
args.join(" ") +
|
|
235
|
+
" with cwd=" +
|
|
236
|
+
cwdDir);
|
|
237
|
+
const child = (0, child_process_1.spawn)(this.filename, args, { cwd: cwdDir });
|
|
238
|
+
if (this.outputFunc) {
|
|
239
|
+
// Callers wants the process output:
|
|
240
|
+
child.stdout.on("data", (chunk) => {
|
|
241
|
+
if (this.outputFunc)
|
|
242
|
+
this.outputFunc(chunk.toString());
|
|
243
|
+
});
|
|
244
|
+
child.stderr.on("data", (chunk) => {
|
|
245
|
+
if (this.outputFunc)
|
|
246
|
+
this.outputFunc(chunk.toString());
|
|
247
|
+
});
|
|
224
248
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
logMessage("Running " +
|
|
232
|
-
this.filename +
|
|
233
|
-
" " +
|
|
234
|
-
args.join(" ") +
|
|
235
|
-
" with cwd=" +
|
|
236
|
-
cwdDir);
|
|
237
|
-
const child = (0, child_process_1.spawn)(this.filename, args, { cwd: cwdDir });
|
|
238
|
-
if (this.outputFunc) {
|
|
239
|
-
// Callers wants the process output:
|
|
240
|
-
child.stdout.on("data", (chunk) => {
|
|
241
|
-
if (this.outputFunc)
|
|
242
|
-
this.outputFunc(chunk.toString());
|
|
243
|
-
});
|
|
244
|
-
child.stderr.on("data", (chunk) => {
|
|
245
|
-
if (this.outputFunc)
|
|
246
|
-
this.outputFunc(chunk.toString());
|
|
247
|
-
});
|
|
249
|
+
child.on("exit", async (code) => {
|
|
250
|
+
/// Can code even be null ?
|
|
251
|
+
if (code == undefined)
|
|
252
|
+
code = -1;
|
|
253
|
+
if (!slot) {
|
|
254
|
+
this.lastExitCode = code;
|
|
248
255
|
}
|
|
249
|
-
|
|
250
|
-
///
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.lastExitCode = code;
|
|
255
|
-
}
|
|
256
|
-
if (this.slots && this.slots.length > 0) {
|
|
257
|
-
/// When running a QtTest executable, let's check which sub-tests failed
|
|
258
|
-
/// (So VSCode can show some error icon for each fail)
|
|
259
|
-
try {
|
|
260
|
-
yield this.updateSubTestStates(cwdDir, slot);
|
|
261
|
-
}
|
|
262
|
-
catch (e) {
|
|
263
|
-
logMessage("Failed to update sub-test states: " + e);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
if (code === 0) {
|
|
267
|
-
resolve(true);
|
|
256
|
+
if (this.slots && this.slots.length > 0) {
|
|
257
|
+
/// When running a QtTest executable, let's check which sub-tests failed
|
|
258
|
+
/// (So VSCode can show some error icon for each fail)
|
|
259
|
+
try {
|
|
260
|
+
await this.updateSubTestStates(cwdDir, slot);
|
|
268
261
|
}
|
|
269
|
-
|
|
270
|
-
|
|
262
|
+
catch (e) {
|
|
263
|
+
logMessage("Failed to update sub-test states: " + e);
|
|
271
264
|
}
|
|
272
|
-
}
|
|
265
|
+
}
|
|
266
|
+
if (code === 0) {
|
|
267
|
+
resolve(true);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
resolve(false);
|
|
271
|
+
}
|
|
273
272
|
});
|
|
274
273
|
});
|
|
275
274
|
}
|
|
@@ -293,76 +292,74 @@ class QtTest {
|
|
|
293
292
|
}
|
|
294
293
|
}
|
|
295
294
|
}
|
|
296
|
-
updateSubTestStates(cwdDir, slot) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
295
|
+
async updateSubTestStates(cwdDir, slot) {
|
|
296
|
+
let tapFileName = cwdDir + "/" + this.tapOutputFileName(slot);
|
|
297
|
+
var failures = await new Promise((resolve, reject) => {
|
|
298
|
+
fs.readFile(tapFileName, "utf8", (error, data) => {
|
|
299
|
+
if (error) {
|
|
300
|
+
logMessage("ERROR: Failed to read log file");
|
|
301
|
+
reject(error);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
let failedResults = [];
|
|
305
|
+
try {
|
|
306
|
+
const tap_events = tap_parser_1.Parser.parse(data);
|
|
307
|
+
for (let event of tap_events) {
|
|
308
|
+
try {
|
|
309
|
+
if (event.length < 2)
|
|
310
|
+
continue;
|
|
311
|
+
if (event.at(0) != "assert")
|
|
312
|
+
continue;
|
|
313
|
+
var obj = event.at(1);
|
|
314
|
+
let pass = obj["ok"] === true;
|
|
315
|
+
let xfail = !pass && obj["todo"] !== false;
|
|
316
|
+
if (xfail) {
|
|
317
|
+
// This is a QEXPECT_FAIL test, all good.
|
|
318
|
+
// QtTest outputs it as "todo"
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
// There's an QEXPECT_FAIL but test passed, not good.
|
|
322
|
+
let xpass = pass && obj["todo"].includes("returned TRUE unexpectedly");
|
|
323
|
+
if (!pass || xpass) {
|
|
324
|
+
// We found a failure
|
|
325
|
+
var name = obj["name"].replace(/\(.*\)/, "");
|
|
326
|
+
var filename = "";
|
|
327
|
+
var lineNumber = -1;
|
|
328
|
+
if (obj["diag"]) {
|
|
329
|
+
filename = obj["diag"]["file"];
|
|
330
|
+
lineNumber = obj["diag"]["line"];
|
|
322
331
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (!pass || xpass) {
|
|
326
|
-
// We found a failure
|
|
327
|
-
var name = obj["name"].replace(/\(.*\)/, "");
|
|
328
|
-
var filename = "";
|
|
329
|
-
var lineNumber = -1;
|
|
330
|
-
if (obj["diag"]) {
|
|
331
|
-
filename = obj["diag"]["file"];
|
|
332
|
-
lineNumber = obj["diag"]["line"];
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
// A XPASS for example misses file:line info. Nothing we can do, it's a Qt bug arguably.
|
|
336
|
-
}
|
|
337
|
-
failedResults.push({
|
|
338
|
-
name: name,
|
|
339
|
-
filePath: filename,
|
|
340
|
-
lineNumber: lineNumber,
|
|
341
|
-
});
|
|
332
|
+
else {
|
|
333
|
+
// A XPASS for example misses file:line info. Nothing we can do, it's a Qt bug arguably.
|
|
342
334
|
}
|
|
335
|
+
failedResults.push({
|
|
336
|
+
name: name,
|
|
337
|
+
filePath: filename,
|
|
338
|
+
lineNumber: lineNumber,
|
|
339
|
+
});
|
|
343
340
|
}
|
|
344
|
-
catch (e) { }
|
|
345
341
|
}
|
|
342
|
+
catch (e) { }
|
|
346
343
|
}
|
|
347
|
-
catch (e) { }
|
|
348
|
-
resolve(failedResults);
|
|
349
344
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
for (let failure of failures) {
|
|
353
|
-
if (slot && slot.name != failure.name) {
|
|
354
|
-
// We executed a single slot, ignore anything else
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
let failedSlot = this.slotByName(failure.name);
|
|
358
|
-
if (failedSlot) {
|
|
359
|
-
failedSlot.lastTestFailure = failure;
|
|
345
|
+
catch (e) { }
|
|
346
|
+
resolve(failedResults);
|
|
360
347
|
}
|
|
361
|
-
|
|
362
|
-
logMessage("ERROR: Failed to find slot with name " + failure.name);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
348
|
+
});
|
|
365
349
|
});
|
|
350
|
+
for (let failure of failures) {
|
|
351
|
+
if (slot && slot.name != failure.name) {
|
|
352
|
+
// We executed a single slot, ignore anything else
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
let failedSlot = this.slotByName(failure.name);
|
|
356
|
+
if (failedSlot) {
|
|
357
|
+
failedSlot.lastTestFailure = failure;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
logMessage("ERROR: Failed to find slot with name " + failure.name);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
366
363
|
}
|
|
367
364
|
}
|
|
368
365
|
exports.QtTest = QtTest;
|
|
@@ -370,6 +367,13 @@ exports.QtTest = QtTest;
|
|
|
370
367
|
* Represents a single Qt test slot
|
|
371
368
|
*/
|
|
372
369
|
class QtTestSlot {
|
|
370
|
+
name;
|
|
371
|
+
// The QTest executable this slot belongs to
|
|
372
|
+
parentQTest;
|
|
373
|
+
/// Allows vscode extensions to associate with a test item
|
|
374
|
+
vscodeTestItem;
|
|
375
|
+
/// Set after running
|
|
376
|
+
lastTestFailure;
|
|
373
377
|
constructor(name, parent) {
|
|
374
378
|
this.name = name;
|
|
375
379
|
this.parentQTest = parent;
|
|
@@ -380,10 +384,8 @@ class QtTestSlot {
|
|
|
380
384
|
get absoluteFilePath() {
|
|
381
385
|
return this.parentQTest.filename;
|
|
382
386
|
}
|
|
383
|
-
runTest() {
|
|
384
|
-
return
|
|
385
|
-
return this.parentQTest.runTest(this);
|
|
386
|
-
});
|
|
387
|
+
async runTest() {
|
|
388
|
+
return this.parentQTest.runTest(this);
|
|
387
389
|
}
|
|
388
390
|
command() {
|
|
389
391
|
return {
|
|
@@ -398,51 +400,43 @@ exports.QtTestSlot = QtTestSlot;
|
|
|
398
400
|
* Represents the list of all QtTest executables in your project
|
|
399
401
|
*/
|
|
400
402
|
class QtTests {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
for (let ctest of ctests) {
|
|
410
|
-
let qtest = new QtTest(ctest.executablePath(), buildDirPath);
|
|
411
|
-
this.qtTestExecutables.push(qtest);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
logMessage("ERROR: Failed to retrieve ctests!");
|
|
403
|
+
qtTestExecutables = [];
|
|
404
|
+
async discoverViaCMake(buildDirPath) {
|
|
405
|
+
var cmake = new cmake_1.CMakeTests(buildDirPath);
|
|
406
|
+
let ctests = await cmake.tests();
|
|
407
|
+
if (ctests) {
|
|
408
|
+
for (let ctest of ctests) {
|
|
409
|
+
let qtest = new QtTest(ctest.executablePath(), buildDirPath);
|
|
410
|
+
this.qtTestExecutables.push(qtest);
|
|
416
411
|
}
|
|
417
|
-
}
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
logMessage("ERROR: Failed to retrieve ctests!");
|
|
415
|
+
}
|
|
418
416
|
}
|
|
419
417
|
/// Removes any executable (from the list) that doesn't link to libQtTest.so
|
|
420
418
|
/// This heuristic tries to filter-out doctest and other non-Qt tests
|
|
421
419
|
/// Only implemented for linux for now
|
|
422
|
-
removeNonLinking() {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
acceptedExecutables.push(ex);
|
|
434
|
-
}
|
|
435
|
-
this.qtTestExecutables = acceptedExecutables;
|
|
420
|
+
async removeNonLinking() {
|
|
421
|
+
let isLinux = process.platform === "linux";
|
|
422
|
+
if (!isLinux) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
let acceptedExecutables = [];
|
|
426
|
+
for (let ex of this.qtTestExecutables) {
|
|
427
|
+
let linksToQt = await ex.linksToQtTestLib();
|
|
428
|
+
// undefined or true is accepted
|
|
429
|
+
if (linksToQt !== false) {
|
|
430
|
+
acceptedExecutables.push(ex);
|
|
436
431
|
}
|
|
437
|
-
|
|
432
|
+
this.qtTestExecutables = acceptedExecutables;
|
|
433
|
+
}
|
|
438
434
|
}
|
|
439
435
|
setLogFunction(func) {
|
|
440
436
|
gLogFunction = func;
|
|
441
437
|
}
|
|
442
|
-
removeByRunningHelp() {
|
|
443
|
-
|
|
444
|
-
this.qtTestExecutables = this.qtTestExecutables.filter((ex) => __awaiter(this, void 0, void 0, function* () { return yield ex.isQtTestViaHelp(); }));
|
|
445
|
-
});
|
|
438
|
+
async removeByRunningHelp() {
|
|
439
|
+
this.qtTestExecutables = this.qtTestExecutables.filter(async (ex) => await ex.isQtTestViaHelp());
|
|
446
440
|
}
|
|
447
441
|
/// Removes any executable (from the list) that matches the specified regex
|
|
448
442
|
removeMatching(regex) {
|
|
@@ -457,19 +451,17 @@ class QtTests {
|
|
|
457
451
|
console.log(ex.filename);
|
|
458
452
|
}
|
|
459
453
|
}
|
|
460
|
-
dumpTestSlots() {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
console.log(" - " + slot.name);
|
|
469
|
-
}
|
|
454
|
+
async dumpTestSlots() {
|
|
455
|
+
for (var ex of this.qtTestExecutables) {
|
|
456
|
+
if (!ex.slots)
|
|
457
|
+
await ex.parseAvailableSlots();
|
|
458
|
+
console.log(ex.filename);
|
|
459
|
+
if (ex.slots) {
|
|
460
|
+
for (let slot of ex.slots) {
|
|
461
|
+
console.log(" - " + slot.name);
|
|
470
462
|
}
|
|
471
463
|
}
|
|
472
|
-
}
|
|
464
|
+
}
|
|
473
465
|
}
|
|
474
466
|
/// Returns all executables that contain a Qt test slot with the specified name
|
|
475
467
|
executablesContainingSlot(slotName) {
|