summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildscripts/resmokelib/core/programs.py3
-rw-r--r--jstests/resmoke_selftest/shell_hang_analyzer.js21
-rw-r--r--src/mongo/shell/assert.js16
-rw-r--r--src/mongo/shell/servers.js5
-rw-r--r--src/mongo/shell/utils.js1
5 files changed, 41 insertions, 5 deletions
diff --git a/buildscripts/resmokelib/core/programs.py b/buildscripts/resmokelib/core/programs.py
index edc81b1ee70..db5e893f194 100644
--- a/buildscripts/resmokelib/core/programs.py
+++ b/buildscripts/resmokelib/core/programs.py
@@ -282,6 +282,9 @@ def mongo_shell_program( # pylint: disable=too-many-branches,too-many-locals,to
global_vars["TestData"] = test_data
+ if config.EVERGREEN_TASK_ID is not None:
+ test_data["inEvergreen"] = True
+
# Initialize setParameters for mongod and mongos, to be passed to the shell via TestData. Since
# they are dictionaries, they will be converted to JavaScript objects when passed to the shell
# by the _format_shell_vars() function.
diff --git a/jstests/resmoke_selftest/shell_hang_analyzer.js b/jstests/resmoke_selftest/shell_hang_analyzer.js
index 340923a50c3..8cd619f19f6 100644
--- a/jstests/resmoke_selftest/shell_hang_analyzer.js
+++ b/jstests/resmoke_selftest/shell_hang_analyzer.js
@@ -66,4 +66,25 @@ const lines = rawMongoProgramOutput().split('\n');
// Nothing should be executed, so there's no output.
assert.eq(lines, ['']);
})();
+
+(function() {
+/*
+ * Test that hang analyzer doesn't run when running resmoke locally
+ */
+clearRawMongoProgramOutput();
+
+const origInEvg = TestData.inEvergreen;
+
+try {
+ TestData.inEvergreen = false;
+ MongoRunner.runHangAnalyzer.enable();
+ MongoRunner.runHangAnalyzer(TestData.peerPids);
+} finally {
+ TestData.inEvergreen = origInEvg;
+}
+
+const lines = rawMongoProgramOutput().split('\n');
+// Nothing should be executed, so there's no output.
+assert.eq(lines, ['']);
+})();
})();
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js
index 07bf0c31bfd..2c34209c2fa 100644
--- a/src/mongo/shell/assert.js
+++ b/src/mongo/shell/assert.js
@@ -323,7 +323,13 @@ assert = (function() {
}
var start = new Date();
- timeout = timeout || 5 * 60 * 1000;
+
+ if (TestData.inEvergreen) {
+ timeout = timeout || 10 * 60 * 1000;
+ } else {
+ timeout = timeout || 60 * 1000;
+ }
+
interval = interval || 200;
var last;
while (1) {
@@ -340,10 +346,10 @@ assert = (function() {
msg = _buildAssertionMessage(msg, msgPrefix);
if (runHangAnalyzer) {
msg = msg +
- "The hang analyzer is automatically called in assert.soon functions. " +
- "If you are *expecting* assert.soon to possibly fail, call assert.soon " +
- "with {runHangAnalyzer: false} as the fifth argument " +
- "(you can fill unused arguments with `undefined`).";
+ " The hang analyzer is automatically called in assert.soon functions." +
+ " If you are *expecting* assert.soon to possibly fail, call assert.soon" +
+ " with {runHangAnalyzer: false} as the fifth argument" +
+ " (you can fill unused arguments with `undefined`).";
print(msg + " Running hang analyzer from assert.soon.");
MongoRunner.runHangAnalyzer();
}
diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js
index 679b42463c9..e8da72e8ba0 100644
--- a/src/mongo/shell/servers.js
+++ b/src/mongo/shell/servers.js
@@ -123,6 +123,11 @@ function runHangAnalyzer(pids) {
return;
}
+ if (!TestData.inEvergreen) {
+ print('Skipping runHangAnalyzer: not running in Evergreen');
+ return;
+ }
+
if (!_hangAnalyzerEnabled) {
print('Skipping runHangAnalyzer: manually disabled');
return;
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 05c61f2a2eb..f1472995fc0 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -359,6 +359,7 @@ jsTestOptions = function() {
alwaysUseLogFiles: TestData.alwaysUseLogFiles || false,
skipCheckOrphans: TestData.skipCheckOrphans || false,
isAsanBuild: TestData.isAsanBuild,
+ inEvergreen: TestData.inEvergreen || false,
});
}
return _jsTestOptions;