From c8a2b554c603ae5fba74d2edaa70a8ddfd5d77aa Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 17 Oct 2019 08:42:08 +0200 Subject: [PATCH] Fix testresult (#10262) --- .../modules/@arangodb/result-processing.js | 23 +++++++++++++++---- js/client/modules/@arangodb/test-utils.js | 23 ++++++++----------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/js/client/modules/@arangodb/result-processing.js b/js/client/modules/@arangodb/result-processing.js index 5625ec92db..172c5ce25c 100644 --- a/js/client/modules/@arangodb/result-processing.js +++ b/js/client/modules/@arangodb/result-processing.js @@ -58,6 +58,7 @@ const internalMembers = [ 'processStats', 'startupTime', 'testDuration', + 'timeout', 'shutdownTime', 'totalSetUp', 'totalTearDown', @@ -99,10 +100,6 @@ function gatherStatus(result) { ); } -// ////////////////////////////////////////////////////////////////////////////// -// / @brief pretty prints the result -// ////////////////////////////////////////////////////////////////////////////// - function fancyTimeFormat(time) { // Hours, minutes and seconds @@ -331,6 +328,10 @@ function saveToJunitXML(options, results) { }); } +// ////////////////////////////////////////////////////////////////////////////// +// / @brief pretty prints the result +// ////////////////////////////////////////////////////////////////////////////// + function unitTestPrettyPrintResults (options, results) { let onlyFailedMessages = ''; let failedMessages = ''; @@ -381,6 +382,7 @@ function unitTestPrettyPrintResults (options, results) { failedCases[testSuiteName] = { test: testCaseMessage(testSuite) }; + failsOfOneSuite[testSuiteName + '_ALL'] = testCaseMessage(testSuite); } } }, @@ -511,6 +513,10 @@ ${failedMessages}${color} * Overall state: ${statusMessage}${RESET}${crashText}$ fs.write(options.testOutputDirectory + options.testFailureText, onlyFailedMessages); } +// ////////////////////////////////////////////////////////////////////////////// +// / @brief creates a chartlist of the longest running tests +// ////////////////////////////////////////////////////////////////////////////// + function locateLongRunning(options, results) { let testRunStatistics = ""; let sortedByDuration = []; @@ -608,6 +614,11 @@ function locateLongRunning(options, results) { print(testRunStatistics); } +// ////////////////////////////////////////////////////////////////////////////// +// / @brief creates a chart list of the tests with the most excessive +// setup/teardown usage +// ////////////////////////////////////////////////////////////////////////////// + function locateLongSetupTeardown(options, results) { let testRunStatistics = " Setup | Run | tests | setupAll | suite name\n"; let sortedByDuration = []; @@ -702,7 +713,9 @@ function locateLongSetupTeardown(options, results) { print(testRunStatistics); } - +// ////////////////////////////////////////////////////////////////////////////// +// / @brief prints the factor server startup/teardown vs. test duration +// ////////////////////////////////////////////////////////////////////////////// function locateShortServerLife(options, results) { let rc = true; diff --git a/js/client/modules/@arangodb/test-utils.js b/js/client/modules/@arangodb/test-utils.js index b63761e0f4..4d26dbf0cf 100755 --- a/js/client/modules/@arangodb/test-utils.js +++ b/js/client/modules/@arangodb/test-utils.js @@ -765,27 +765,22 @@ function readTestResult(path, rc, testCase) { buf = fs.read(jsonFN); fs.remove(jsonFN); } catch (x) { - let msg = 'failed to read ' + jsonFN + " - " + x; + let msg = 'readTestResult: failed to read ' + jsonFN + " - " + x; print(RED + msg + RESET); - return { - failed: 1, - status: false, - message: msg, - duration: -1 - }; + rc.message += " - " + msg; + rc.status = false; + return rc; } let result; try { result = JSON.parse(buf); } catch (x) { - let msg = 'failed to parse ' + jsonFN + "'" + buf + "' - " + x; + let msg = 'readTestResult: failed to parse ' + jsonFN + "'" + buf + "' - " + x; print(RED + msg + RESET); - return { - status: false, - message: msg, - duration: -1 - }; + rc.message += " - " + msg; + rc.status = false; + return rc; } if (Array.isArray(result)) { @@ -810,7 +805,7 @@ function readTestResult(path, rc, testCase) { } } else { rc.failed = rc.status ? 0 : 1; - rc.message = "don't know howto handle '" + buf + "'"; + rc.message = "readTestResult: don't know howto handle '" + buf + "'"; return rc; } }