From ad31b31096ffd0a1eafe5b70f4beb16efa21e37a Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 9 Oct 2018 16:47:16 +0200 Subject: [PATCH] print when we mark a build crashy (#6769) LGTM --- UnitTests/unittest.js | 24 +++++++++---------- js/client/modules/@arangodb/process-utils.js | 4 +++- js/client/modules/@arangodb/testing.js | 21 ++++++++-------- .../@arangodb/testsuites/replication.js | 7 ++++++ 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/UnitTests/unittest.js b/UnitTests/unittest.js index f4e9dcc02c..271077399a 100644 --- a/UnitTests/unittest.js +++ b/UnitTests/unittest.js @@ -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); diff --git a/js/client/modules/@arangodb/process-utils.js b/js/client/modules/@arangodb/process-utils.js index fe6e66779b..454b887403 100644 --- a/js/client/modules/@arangodb/process-utils.js +++ b/js/client/modules/@arangodb/process-utils.js @@ -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 { diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index d8c6a712ce..1439126e12 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -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"); diff --git a/js/client/modules/@arangodb/testsuites/replication.js b/js/client/modules/@arangodb/testsuites/replication.js index 159759776e..e7889495cd 100644 --- a/js/client/modules/@arangodb/testsuites/replication.js +++ b/js/client/modules/@arangodb/testsuites/replication.js @@ -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');