You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by db...@apache.org on 2015/09/23 20:52:35 UTC

cordova-medic git commit: CB-8936 Tweaking windows log gathering timeout. This closes # 64.

Repository: cordova-medic
Updated Branches:
  refs/heads/master 16843dc9c -> 1dcbac1cc


CB-8936 Tweaking windows log gathering timeout. This closes # 64.


Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/1dcbac1c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/1dcbac1c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/1dcbac1c

Branch: refs/heads/master
Commit: 1dcbac1ccf2ce8b7b4af726efd9dff932468a64f
Parents: 16843dc
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Tue Sep 22 11:15:51 2015 +0300
Committer: Dmitry Blotsky <dm...@gmail.com>
Committed: Wed Sep 23 11:52:18 2015 -0700

----------------------------------------------------------------------
 buildbot-conf/cordova.conf |  3 ++-
 lib/util.js                |  6 ++++++
 medic/medic-log.js         | 15 +++++++++++----
 3 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/1dcbac1c/buildbot-conf/cordova.conf
----------------------------------------------------------------------
diff --git a/buildbot-conf/cordova.conf b/buildbot-conf/cordova.conf
index 5cc5e44..3d0664c 100644
--- a/buildbot-conf/cordova.conf
+++ b/buildbot-conf/cordova.conf
@@ -358,7 +358,8 @@ def cordova_steps_run_tests(platform, extra_args=list()):
                 'node',
                 'cordova-medic/medic/medic.js',
                 'log',
-                '--platform', platform
+                '--platform', platform,
+                '--timeout', TEST_RUN_TIMEOUT
             ],
             description    = 'gathering logs',
             timeout        = LOG_GETTING_TIMEOUT,

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/1dcbac1c/lib/util.js
----------------------------------------------------------------------
diff --git a/lib/util.js b/lib/util.js
index 222c791..2190dc2 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -33,6 +33,8 @@ module.exports = function () {
         WP8:        "wp8",
 
         DEFAULT_ENCODING: "utf-8",
+        DEFAULT_LOG_TIME: 15,
+        DEFAULT_LOG_TIME_ADDITIONAL: 2,
 
         // functions
         fatal: function (message) {
@@ -55,6 +57,10 @@ module.exports = function () {
 
         contains: function (collection, item) {
             return collection.indexOf(item) != (-1);
+        },
+
+        secToMin: function (seconds) {
+            return Math.ceil(seconds / 60);
         }
     };
 }();

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/1dcbac1c/medic/medic-log.js
----------------------------------------------------------------------
diff --git a/medic/medic-log.js b/medic/medic-log.js
index 327d823..5251898 100644
--- a/medic/medic-log.js
+++ b/medic/medic-log.js
@@ -63,10 +63,14 @@ function logIOS() {
     });
 }
 
-function logWindows() {
+function logWindows(timeout) {
     var logScriptPath = path.join("mobilespec", "platforms", "windows", "cordova", "log.bat");
     if (fs.existsSync(logScriptPath)) {
-        shelljs.exec(logScriptPath + " --dump --mins 15", function (code, output) {
+        var mins = util.DEFAULT_LOG_TIME;
+        if (timeout) {
+            mins = util.secToMin(timeout) + util.DEFAULT_LOG_TIME_ADDITIONAL;
+        }
+        shelljs.exec(logScriptPath + " --dump --mins " + mins, function (code, output) {
             if (code > 0) {
                 util.fatal("Failed to run log command.");
             }
@@ -87,11 +91,14 @@ function main() {
 
     // command-specific args
     var argv = optimist
-        .usage("Usage: $0 {platform}")
+        .usage("Usage: $0 [options]")
         .demand("platform")
+        .describe("platform", "Gather logs for this platform.")
+        .describe("timeout", "Windows only, gather logs for last n seconds.")
         .argv;
 
     var platform = argv.platform;
+    var timeout = argv.timeout;
 
     switch (platform) {
         case util.ANDROID:
@@ -104,7 +111,7 @@ function main() {
             logIOS();
             break;
         case util.WINDOWS:
-            logWindows();
+            logWindows(timeout);
             break;
         case util.WP8:
             logWP8();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org