mirror of https://gitee.com/bigwinds/arangodb
fix test result handling of tests running in own spawned arangosh (#9577)
This commit is contained in:
parent
18748882d8
commit
abd3856302
|
@ -67,6 +67,7 @@ function runJSUnityTests (tests, instanceinfo) {
|
||||||
allResults[file] = res;
|
allResults[file] = res;
|
||||||
allResults.duration += res.duration;
|
allResults.duration += res.duration;
|
||||||
allResults.total +=1;
|
allResults.total +=1;
|
||||||
|
allResults.failed += res.failed;
|
||||||
allResults.totalSetUp += res.totalSetup;
|
allResults.totalSetUp += res.totalSetup;
|
||||||
allResults.totalTearDown += res.totalTearDown;
|
allResults.totalTearDown += res.totalTearDown;
|
||||||
|
|
||||||
|
@ -86,6 +87,11 @@ function runJSUnityTests (tests, instanceinfo) {
|
||||||
);
|
);
|
||||||
err = err.cause;
|
err = err.cause;
|
||||||
}
|
}
|
||||||
|
allResults[file] = {
|
||||||
|
failed: true,
|
||||||
|
message: runenvironment + ": cannot run test file '" + file + "': " + e
|
||||||
|
};
|
||||||
|
allResults.failed += 1;
|
||||||
allResults.status = false;
|
allResults.status = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +127,19 @@ function runMochaTests (testFiles) {
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
// / @brief runs tests from command-line
|
// / @brief runs tests from command-line
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
function addResults(result, which) {
|
||||||
|
for (let key in which) {
|
||||||
|
if (which.hasOwnProperty(key)) {
|
||||||
|
if (! statusKeys.includes(key)) {
|
||||||
|
if (result.hasOwnProperty(key)) {
|
||||||
|
print('Duplicate test in "' + key + '" - \n"' + JSON.stringify(which) + "\n" + JSON.stringify(result));
|
||||||
|
throw new Error();
|
||||||
|
}
|
||||||
|
result[key] = which[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function runCommandLineTests () {
|
function runCommandLineTests () {
|
||||||
let instanceinfo;
|
let instanceinfo;
|
||||||
|
@ -143,30 +162,15 @@ function runCommandLineTests () {
|
||||||
|
|
||||||
let resultJ = runJSUnityTests(jsUnity, instanceinfo);
|
let resultJ = runJSUnityTests(jsUnity, instanceinfo);
|
||||||
let resultM = runMochaTests(mocha);
|
let resultM = runMochaTests(mocha);
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
failed: resultJ.failed + resultM.failed,
|
failed: resultJ.failed + resultM.failed,
|
||||||
total: resultJ.total + resultM.total,
|
total: resultJ.total + resultM.total,
|
||||||
duration: resultJ.duration + resultM.duration,
|
duration: resultJ.duration + resultM.duration,
|
||||||
status: resultJ.status & resultM.status
|
status: resultJ.status && resultM.status
|
||||||
};
|
};
|
||||||
|
|
||||||
let addResults = function(which) {
|
addResults(result, resultJ);
|
||||||
for (let key in which) {
|
addResults(result, resultM);
|
||||||
if (which.hasOwnProperty(key)) {
|
|
||||||
if (! statusKeys.includes(key)) {
|
|
||||||
if (result.hasOwnProperty(key)) {
|
|
||||||
print('Duplicate test in "' + key + '" - \n"' + JSON.stringify(which) + "\n" + JSON.stringify(result));
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result[key] = which[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
addResults(resultJ);
|
|
||||||
addResults(resultM);
|
|
||||||
fs.write(fs.join(instanceinfo.rootDir, 'testresult.json'), JSON.stringify(result));
|
fs.write(fs.join(instanceinfo.rootDir, 'testresult.json'), JSON.stringify(result));
|
||||||
|
|
||||||
internal.setUnitTestsResult(result.status);
|
internal.setUnitTestsResult(result.status);
|
||||||
|
|
Loading…
Reference in New Issue