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

View File

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

View File

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

View File

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