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/05/11 20:26:34 UTC

cordova-medic git commit: CB-8936 Gathering logs for Android. This closes #53.

Repository: cordova-medic
Updated Branches:
  refs/heads/master ff1ca207c -> 9dd297c07


CB-8936 Gathering logs for Android. This closes #53.


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

Branch: refs/heads/master
Commit: 9dd297c0734b42f0cde476e4a6834f1c7ee521e4
Parents: ff1ca20
Author: alsorokin <al...@akvelon.com>
Authored: Fri May 8 11:39:11 2015 +0300
Committer: Dmitry Blotsky <dm...@gmail.com>
Committed: Mon May 11 11:26:10 2015 -0700

----------------------------------------------------------------------
 buildbot-conf/cordova.conf | 11 ++++++++
 medic/medic-log.js         | 61 +++++++++++++++++++++++++++++++++++++++++
 medic/medic.js             |  1 +
 3 files changed, 73 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/9dd297c0/buildbot-conf/cordova.conf
----------------------------------------------------------------------
diff --git a/buildbot-conf/cordova.conf b/buildbot-conf/cordova.conf
index 34c0e77..9caa0a8 100644
--- a/buildbot-conf/cordova.conf
+++ b/buildbot-conf/cordova.conf
@@ -264,8 +264,16 @@ cordova_plugins_check_command = [
     '--file',    P('test_summary_file'),
 ]
 
+cordova_plugins_log_command = [
+    'node',
+    'cordova-medic/medic/medic.js',
+    'log',
+    '--platform', P('platform')
+]
+
 cordova_plugins_run_steps = [
     SH(command=cordova_plugins_run_command, description='running tests'),
+    SH(command=cordova_plugins_log_command, description='gathering logs'),
     SH(command=cordova_plugins_check_command, description='getting test results'),
     SetPropertyFromCommand(command=['cat', P('test_summary_file')], property='test_summary', hideStepIf=True),
     DisplayResults(warnOnWarnings=True),
@@ -277,16 +285,19 @@ cordova_plugins_run_steps = [
 cordova_plugins_windows_run_steps = [
 
     SH(command=cordova_plugins_run_command + ['--winvers',  'store80'], description='running tests (Windows 8.0)', haltOnFailure=False),
+    SH(command=cordova_plugins_log_command, description='gathering logs'),
     SH(command=cordova_plugins_check_command, description='getting test results (Windows 8.0)', haltOnFailure=False),
     SetPropertyFromCommand(command=['cat', P('test_summary_file')], property='test_summary', hideStepIf=True, haltOnFailure=False),
     DisplayResults(haltOnFailure=False, warnOnWarnings=True),
 
     SH(command=cordova_plugins_run_command + ['--winvers',  'store'], description='running tests (Windows 8.1)', haltOnFailure=False),
+    SH(command=cordova_plugins_log_command, description='gathering logs'),
     SH(command=cordova_plugins_check_command, description='getting test results (Windows 8.1)', haltOnFailure=False),
     SetPropertyFromCommand(command=['cat', P('test_summary_file')], property='test_summary', hideStepIf=True, haltOnFailure=False),
     DisplayResults(haltOnFailure=False, warnOnWarnings=True),
 
     SH(command=cordova_plugins_run_command + ['--winvers',  'phone'], description='running tests (Windows Phone 8.1)', haltOnFailure=False),
+    SH(command=cordova_plugins_log_command, description='gathering logs'),
     SH(command=cordova_plugins_check_command, description='getting test results (Windows Phone 8.1)', haltOnFailure=False),
     SetPropertyFromCommand(command=['cat', P('test_summary_file')], property='test_summary', hideStepIf=True, haltOnFailure=False),
     DisplayResults(haltOnFailure=False, warnOnWarnings=True),

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/9dd297c0/medic/medic-log.js
----------------------------------------------------------------------
diff --git a/medic/medic-log.js b/medic/medic-log.js
new file mode 100644
index 0000000..1a1206e
--- /dev/null
+++ b/medic/medic-log.js
@@ -0,0 +1,61 @@
+#!/usr/bin/env node
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* jshint node: true */
+
+"use strict";
+
+var fs = require("fs");
+
+var shelljs  = require("shelljs");
+var optimist = require("optimist");
+var util     = require("../lib/util");
+
+// main
+function main() {
+
+    // shell config
+    shelljs.config.fatal  = false;
+    shelljs.config.silent = false;
+
+    // command-specific args
+    var argv = optimist
+        .usage("Usage: $0 {platform}")
+        .demand('platform')
+        .argv;
+
+    switch (argv.platform) {
+        case util.ANDROID:
+            var cmd = "adb logcat -d";
+            console.log("executing " + cmd);
+            shelljs.exec(cmd, function(code, output) {
+                if (code > 0) {
+                    util.fatal('Failed to run logcat command.');
+                }
+            });
+            break;
+        default:
+            console.warn("Logging is unsupported for " + argv.platform);
+            break;
+    }
+}
+
+main();

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/9dd297c0/medic/medic.js
----------------------------------------------------------------------
diff --git a/medic/medic.js b/medic/medic.js
index f58a39a..0c433cf 100755
--- a/medic/medic.js
+++ b/medic/medic.js
@@ -34,6 +34,7 @@ function main() {
         .command("checkout", "check out repositories")
         .command("run",      "run a cordova app in automated mode")
         .command("check",    "analyze test runs from a medic DB")
+        .command("log",      "output platform-specific logs to console")
         .parse(process.argv);
 }
 


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