1
0
Fork 0

print when we mark a build crashy (#6769)

LGTM
This commit is contained in:
Wilfried Goesgens 2018-10-09 16:47:16 +02:00 committed by Frank Celler
parent 79bade7e6b
commit ad31b31096
4 changed files with 33 additions and 23 deletions

View File

@ -231,10 +231,10 @@ function main (argv) {
}
// run the test and store the result
let r = {}; // result
let res = {}; // result
try {
// run tests
r = UnitTest.unitTest(testSuits, options, testOutputDirectory) || {};
res = UnitTest.unitTest(testSuits, options, testOutputDirectory) || {};
} catch (x) {
print('caught exception during test execution!');
@ -248,18 +248,18 @@ function main (argv) {
print(x);
}
print(JSON.stringify(r));
print(JSON.stringify(res));
}
_.defaults(r, {
_.defaults(res, {
status: false,
crashed: true
});
// whether or not there was an error
try {
fs.write(testOutputDirectory + '/UNITTEST_RESULT_EXECUTIVE_SUMMARY.json', String(r.status), true);
fs.write(testOutputDirectory + '/UNITTEST_RESULT_CRASHED.json', String(r.crashed), true);
fs.write(testOutputDirectory + '/UNITTEST_RESULT_EXECUTIVE_SUMMARY.json', String(res.status), true);
fs.write(testOutputDirectory + '/UNITTEST_RESULT_CRASHED.json', String(res.crashed), true);
} catch (x) {
print('failed to write test result: ' + x.message);
}
@ -268,9 +268,9 @@ function main (argv) {
let j;
try {
j = JSON.stringify(r);
j = JSON.stringify(res);
} catch (err) {
j = inspect(r);
j = inspect(res);
}
fs.write(testOutputDirectory + '/UNITTEST_RESULT.json', j, true);
@ -289,19 +289,19 @@ function main (argv) {
isRocksDb = (options.storageEngine === 'rocksdb');
}
resultsToXml(r, 'UNITTEST_RESULT_' + prefix, isCluster, isRocksDb);
resultsToXml(res, 'UNITTEST_RESULT_' + prefix, isCluster, isRocksDb);
} catch (x) {
print('exception while serializing status xml!');
print(x.message);
print(x.stack);
print(inspect(r));
print(inspect(res));
}
}
// creates yaml like dump at the end
UnitTest.unitTestPrettyPrintResults(r, testOutputDirectory, options);
UnitTest.unitTestPrettyPrintResults(res, testOutputDirectory, options);
return r.status;
return res.status;
}
let result = main(ARGUMENTS);

View File

@ -437,12 +437,12 @@ function executeAndWait (cmd, args, options, valgrindTest, rootDir, circumventCo
(platform.substr(0, 3) === 'win')
)
) {
print(res);
let instanceInfo = {
rootDir: rootDir,
pid: res.pid,
exitStatus: res
};
print("executeAndWait: Marking crashy - " + JSON.stringify(instanceInfo));
crashUtils.analyzeCrash(cmd,
instanceInfo,
options,
@ -692,6 +692,7 @@ function checkArangoAlive (arangod, options) {
arangod.exitStatus = res;
analyzeServerCrash(arangod, options, 'health Check - ' + res.signal);
serverCrashed = true;
print("checkArangoAlive: Marking crashy - " + JSON.stringify(arangod));
}
}
@ -923,6 +924,7 @@ function shutdownInstance (instanceInfo, options, forceTerminate) {
}
if (arangod.exitStatus.hasOwnProperty('signal')) {
analyzeServerCrash(arangod, options, 'instance "' + arangod.role + '" Shutdown - ' + arangod.exitStatus.signal);
print("shutdownInstance: Marking crashy - " + JSON.stringify(arangod));
serverCrashed = true;
}
} else {

View File

@ -224,7 +224,7 @@ function testCaseMessage (test) {
}
}
function unitTestPrettyPrintResults (r, testOutputDirectory, options) {
function unitTestPrettyPrintResults (res, testOutputDirectory, options) {
function skipInternalMember (r, a) {
return !r.hasOwnProperty(a) || internalMembers.indexOf(a) !== -1;
}
@ -240,12 +240,12 @@ function unitTestPrettyPrintResults (r, testOutputDirectory, options) {
let SuccessMessages = '';
try {
/* jshint forin: false */
for (let testrunName in r) {
if (skipInternalMember(r, testrunName)) {
for (let testrunName in res) {
if (skipInternalMember(res, testrunName)) {
continue;
}
let testrun = r[testrunName];
let testrun = res[testrunName];
let successCases = {};
let failedCases = {};
@ -355,17 +355,17 @@ function unitTestPrettyPrintResults (r, testOutputDirectory, options) {
print(failedMessages);
/* jshint forin: true */
let color = (!r.crashed && r.status === true) ? GREEN : RED;
let color = (!res.crashed && res.status === true) ? GREEN : RED;
let crashText = '';
let crashedText = '';
if (r.crashed === true) {
if (res.crashed === true) {
crashedText = ' BUT! - We had at least one unclean shutdown or crash during the testrun.';
crashText = RED + crashedText + RESET;
}
print('\n' + color + '* Overall state: ' + ((r.status === true) ? 'Success' : 'Fail') + RESET + crashText);
print('\n' + color + '* Overall state: ' + ((res.status === true) ? 'Success' : 'Fail') + RESET + crashText);
let failText = '';
if (r.status !== true) {
if (res.status !== true) {
failText = ' Suites failed: ' + failedSuite + ' Tests Failed: ' + failedTests;
print(color + failText + RESET);
}
@ -375,7 +375,7 @@ function unitTestPrettyPrintResults (r, testOutputDirectory, options) {
} catch (x) {
print('exception caught while pretty printing result: ');
print(x.message);
print(JSON.stringify(r));
print(JSON.stringify(res));
}
}
@ -637,7 +637,8 @@ function iterateTests(cases, options, jsonReply) {
pu.cleanupDBDirectories(options);
} else {
print('not cleaning up as some tests weren\'t successful:\n' +
pu.getCleanupDBDirectories());
pu.getCleanupDBDirectories() +
cleanup + ' - ' + globalStatus + ' - ' + pu.serverCrashed);
}
} else {
print("not cleaning up since we didn't start the server ourselves\n");

View File

@ -1,4 +1,5 @@
/* jshint strict: false, sub: true */
/* global print */
'use strict';
// //////////////////////////////////////////////////////////////////////////////
@ -81,6 +82,7 @@ function replicationFuzz (options) {
customInstanceInfos,
startStopHandlers) {
let message;
print("starting replication slave: ");
let slave = pu.startInstance('tcp', options, {}, 'slave_fuzz');
let state = (typeof slave === 'object');
@ -140,6 +142,7 @@ function replicationRandom (options) {
customInstanceInfos,
startStopHandlers) {
let message;
print("starting replication slave: ");
let slave = pu.startInstance('tcp', options, {}, 'slave_random');
let state = (typeof slave === 'object');
@ -199,6 +202,7 @@ function replicationAql (options) {
customInstanceInfos,
startStopHandlers) {
let message;
print("starting replication slave: ");
let slave = pu.startInstance('tcp', options, {}, 'slave_aql');
let state = (typeof slave === 'object');
@ -261,6 +265,7 @@ function replicationOngoing (options) {
customInstanceInfos,
startStopHandlers) {
let message;
print("starting replication slave: ");
let slave = pu.startInstance('tcp', options, {}, 'slave_ongoing');
let state = (typeof slave === 'object');
@ -324,6 +329,7 @@ function replicationStatic (options) {
startStopHandlers) {
let message;
let res = true;
print("starting replication slave: ");
let slave = pu.startInstance('tcp', options, {}, 'slave_static');
let state = (typeof slave === 'object');
@ -410,6 +416,7 @@ function replicationSync (options) {
startStopHandlers) {
let message;
let res = true;
print("starting replication slave: ");
let slave = pu.startInstance('tcp', options, {"log.level" : "replication=trace", "--log.level": "replication=trace"}, 'slave_sync');
let state = (typeof slave === 'object');