Bug 983000 - "Intermittent test_ping_aboutnetworking.js | test failed (with xpcshell return code: 0), see following log | -1 != -1 - See following stack" r=mcmanus, a=test-only
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 01 May 2014 15:57:00 +0200
changeset 200130 931c88a0829917b752008dea4accdaa3aac48122
parent 200129 507f1da14ae6927f1e60f1a8c9abb49ffc30bafa
child 200131 02096e94fab7e6882006154600648f91205175e7
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, test-only
bugs983000
milestone31.0a2
Bug 983000 - "Intermittent test_ping_aboutnetworking.js | test failed (with xpcshell return code: 0), see following log | -1 != -1 - See following stack" r=mcmanus, a=test-only
netwerk/test/unit/test_ping_aboutnetworking.js
--- a/netwerk/test/unit/test_ping_aboutnetworking.js
+++ b/netwerk/test/unit/test_ping_aboutnetworking.js
@@ -1,74 +1,74 @@
 /* -*- Mode: Javasript; indent-tab-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const gDashboard = Cc['@mozilla.org/network/dashboard;1']
   .getService(Ci.nsIDashboard);
-const serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
-    .createInstance(Ci.nsIServerSocket);
+
 function connectionFailed(status) {
   let status_ok = [
                     "NS_NET_STATUS_RESOLVING_HOST"
                     ,"NS_NET_STATUS_RESOLVED_HOST"
                     ,"NS_NET_STATUS_CONNECTING_TO"
                     ,"NS_NET_STATUS_CONNECTED_TO"
                   ];
   for (let i = 0; i < status_ok.length; i++) {
     if (status == status_ok[i]) {
       return false;
     }
   }
 
   return true;
 }
 
-function test_sockets() {
+function test_sockets(serverSocket) {
   do_test_pending();
   gDashboard.requestSockets(function(data) {
     let index = -1;
+    do_print("requestSockets: " + JSON.stringify(data.sockets));
     for (let i = 0; i < data.sockets.length; i++) {
       if (data.sockets[i].host == "127.0.0.1") {
         index = i;
         break;
       }
     }
     do_check_neq(index, -1);
     do_check_eq(data.sockets[index].port, serverSocket.port);
     do_check_eq(data.sockets[index].tcp, 1);
 
-    serverSocket.close();
-
     do_test_finished();
   });
 }
 
 function run_test() {
+  let serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
+    .createInstance(Ci.nsIServerSocket);
   serverSocket.init(-1, true, -1);
 
   do_test_pending();
   gDashboard.requestConnection("localhost", serverSocket.port,
                                "tcp", 15, function(connInfo) {
     if (connInfo.status == "NS_NET_STATUS_CONNECTED_TO") {
       do_test_pending();
       gDashboard.requestDNSInfo(function(data) {
         let found = false;
+        do_print("requestDNSInfo: " + JSON.stringify(data.entries));
         for (let i = 0; i < data.entries.length; i++) {
           if (data.entries[i].hostname == "localhost") {
             found = true;
             break;
           }
         }
         do_check_eq(found, true);
 
         do_test_finished();
-
-        test_sockets();
+        test_sockets(serverSocket);
       });
 
       do_test_finished();
     }
     if (connectionFailed(connInfo.status)) {
       do_throw(connInfo.status);
     }
   });