cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgreb...@apache.org
Subject [07/14] cordova-medic git commit: Add step displaying results of mobilespec tests
Date Thu, 13 Nov 2014 05:24:47 GMT
Add step displaying results of mobilespec tests

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

Branch: refs/heads/master
Commit: 8ace6367747e1ff7a8b070283e308d82cc5a1334
Parents: 81cf92d
Author: dmitriy-barkalov <v-dmbark@microsoft.com>
Authored: Thu Oct 23 10:22:04 2014 -0700
Committer: dmitriy-barkalov <v-dmbark@microsoft.com>
Committed: Thu Oct 23 10:22:04 2014 -0700

----------------------------------------------------------------------
 build_android.js      |  2 ++
 build_blackberry10.js |  2 ++
 build_ios.js          |  2 ++
 build_windows.js      |  2 ++
 build_wp8.js          |  2 ++
 testchecker.js        | 60 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 70 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/8ace6367/build_android.js
----------------------------------------------------------------------
diff --git a/build_android.js b/build_android.js
index 436c446..5057ca0 100644
--- a/build_android.js
+++ b/build_android.js
@@ -4,6 +4,7 @@ var buildinfo = require('./buildinfo');
 var config = require('./config');
 var android  = require('./src/build/makers/android');
 var argv = require('optimist').argv;
+var testcheck = require('./testchecker');
 
 // this assumes that you start it in the sandbox
 
@@ -28,6 +29,7 @@ buildinfo('Android', BRANCH, function (error, sha ) {
                 TEST_OK=false;
             } else {
                 console.log('Android tests complete');
+                TEST_OK = testcheck.checkTestResults(sha, config.couchdb.host) == 0 ? true
: false;
             }
        });
     }

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/8ace6367/build_blackberry10.js
----------------------------------------------------------------------
diff --git a/build_blackberry10.js b/build_blackberry10.js
index 9556f34..651ae32 100644
--- a/build_blackberry10.js
+++ b/build_blackberry10.js
@@ -4,6 +4,7 @@ var path = require ('path'),
     config = require('./config'),
     blackberry10  = require('./src/build/makers/blackberry10'),
     argv = require('optimist').argv;
+var testcheck = require('./testchecker');
 
 // this assumes that you start it in the sandbox
 
@@ -28,6 +29,7 @@ buildinfo('BlackBerry', BRANCH, function (error, sha ) {
                 TEST_OK=false;
             } else {
                 console.log('BlackBerry tests complete');
+                TEST_OK = testcheck.checkTestResults(sha, config.couchdb.host) == 0 ? true
: false;
             }
        });
     }

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/8ace6367/build_ios.js
----------------------------------------------------------------------
diff --git a/build_ios.js b/build_ios.js
index ecf0a90..c6f5eb1 100644
--- a/build_ios.js
+++ b/build_ios.js
@@ -4,6 +4,7 @@ var buildinfo = require('./buildinfo');
 var config = require('./config');
 var ios  = require('./src/build/makers/ios');
 var argv = require('optimist').argv;
+var testcheck = require('./testchecker');
 
 // this assumes that you start it in the sandbox
 
@@ -28,6 +29,7 @@ buildinfo('ios', BRANCH, function (error, sha ) {
                TEST_OK=false;
            } else {
                console.log('iOS tests complete')
+               TEST_OK = testcheck.checkTestResults(sha, config.couchdb.host) == 0 ? true
: false;
            }
        });
     }

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/8ace6367/build_windows.js
----------------------------------------------------------------------
diff --git a/build_windows.js b/build_windows.js
index 6f3cb55..3425726 100644
--- a/build_windows.js
+++ b/build_windows.js
@@ -6,6 +6,7 @@ var config = require('./config');
 var windows  = require('./src/build/makers/windows');
 var argv = require('optimist').argv;
 var error_writer = require('./src/build/makers/error_writer');
+var testcheck = require('./testchecker');
 
 // this assumes that you start it in the sandbox
 
@@ -57,6 +58,7 @@ buildinfo('Windows', BRANCH, function (error, sha ) {
 
         windows(output_location, sha, config.app.entry, config.couchdb.host, test_timeout,
build_target).then(function() {
                 console.log('Windows test execution completed');
+                TEST_OK = testcheck.checkTestResults(sha, config.couchdb.host) == 0 ? true
: false;
             }, function(err) {
                 TEST_OK=false;
                 error_writer('windows', sha, 'Windows tests execution failed.', err);

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/8ace6367/build_wp8.js
----------------------------------------------------------------------
diff --git a/build_wp8.js b/build_wp8.js
index 92793c4..f700471 100644
--- a/build_wp8.js
+++ b/build_wp8.js
@@ -5,6 +5,7 @@ var config = require('./config');
 var wp8  = require('./src/build/makers/wp8');
 var argv = require('optimist').argv;
 var error_writer = require('./src/build/makers/error_writer');
+var testcheck = require('./testchecker');
 
 // this assumes that you start it in the sandbox
 
@@ -28,6 +29,7 @@ buildinfo('WP8', BRANCH, function (error, sha ) {
 
         wp8(output_location, sha, config.wp8.target, config.app.entry, config.couchdb.host,
test_timeout).then(function() {
                 console.log('WP8 test execution completed');
+                TEST_OK = testcheck.checkTestResults(sha, config.couchdb.host) == 0 ? true
: false;
             }, function(err) {
                 TEST_OK=false;
                 error_writer('wp8', sha, 'WP8 tests execution failed.', err);

http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/8ace6367/testchecker.js
----------------------------------------------------------------------
diff --git a/testchecker.js b/testchecker.js
new file mode 100644
index 0000000..e9c8ccf
--- /dev/null
+++ b/testchecker.js
@@ -0,0 +1,60 @@
+var http = require('http');
+var url = require('url');
+
+var checkTestResults = function(sha, dbHost) {
+    console.log('Starting results verification for ' + sha);
+
+    var options = {
+        host: url.parse(dbHost).hostname,
+        port: url.parse(dbHost).port,
+        path: '/mobilespec_results/_all_docs?start_key="' + sha + '"&limit=1'
+    };
+
+    var resultsDoc = "";
+
+    // get current document id by sha
+    var req =  http.get(options, function(result) {
+        result.on("data", function(chunk) {
+            resultsDoc += chunk.toString();
+        });
+
+        result.on('end', function () {
+            var resultId = JSON.parse(resultsDoc).rows[0].id;
+
+            var requestOptions = {
+                host: url.parse(dbHost).hostname,
+                port: url.parse(dbHost).port,
+                path: '/mobilespec_results/' + resultId
+            };
+
+            var resultsJSON = "";
+            var failure;
+
+            // get failures by document id
+            var resultsRequest = http.get(requestOptions, function(res) {
+                res.on("data", function(chunk) {
+                    resultsJSON += chunk;
+                });
+
+                res.on('end', function() {
+                    failure = JSON.parse(resultsJSON);
+                    if(typeof failure.mobilespec.failures == "undefined") {
+                        console.log("No failures were detected");
+                        return 0;
+                    } else {
+                        console.log('Test failures were detected. Open ' +
+                        dbHost + '/_utils/document.html?mobilespec_results/' +
+                        resultId + ' for details');
+                        return -1;
+                    }
+                });
+            }).on('error', function(e) {
+                console.log("Got error: " + e.message);
+            });
+        });
+    }).on('error', function(e) {
+        console.log("Got error: " + e.message);
+    });
+}
+
+module.exports.checkTestResults = checkTestResults;
\ No newline at end of file


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


Mime
View raw message