diff options
Diffstat (limited to 'jstests/resmoke_selftest')
-rw-r--r-- | jstests/resmoke_selftest/shell_hang_analyzer.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/jstests/resmoke_selftest/shell_hang_analyzer.js b/jstests/resmoke_selftest/shell_hang_analyzer.js index 9fc58b628cd..189f6fe1bba 100644 --- a/jstests/resmoke_selftest/shell_hang_analyzer.js +++ b/jstests/resmoke_selftest/shell_hang_analyzer.js @@ -17,17 +17,21 @@ const anyLineMatches = function(lines, rex) { */ const child = MongoRunner.runMongod(); -try { - clearRawMongoProgramOutput(); +clearRawMongoProgramOutput(); - // drive-by test for enable(). Separate test for disable() below. - MongoRunner.runHangAnalyzer.disable(); - MongoRunner.runHangAnalyzer.enable(); +// drive-by test for enable(). Separate test for disable() below. +MongoRunner.runHangAnalyzer.disable(); +MongoRunner.runHangAnalyzer.enable(); - MongoRunner.runHangAnalyzer([child.pid]); +MongoRunner.runHangAnalyzer([child.pid]); - const lines = rawMongoProgramOutput().split('\n'); +if (TestData && TestData.inEvergreen) { + assert.soon(() => { + // Ensure the hang-analyzer has killed the process. + return !checkProgram(child.pid).alive; + }); + const lines = rawMongoProgramOutput().split('\n'); if (_isAddressSanitizerActive()) { assert.soon(() => { // On ASAN builds, we never dump the core during hang analyzer runs, @@ -42,7 +46,8 @@ try { return anyLineMatches(lines, /Dumping core/); }); } -} finally { +} else { + // When running locally the hang-analyzer is not run. MongoRunner.stopMongod(child); } })(); |