Bug 878914 - Fix race condition in marionette testrunner;r=jgriffin
authorWilliam Lachance <wlach@mozilla.com>
Mon, 03 Jun 2013 14:54:07 -0400
changeset 133846 2dd5420680af3e47c7ce2e3cc74fe074691c8562
parent 133845 bd6a9518088cb5aa9eaf109a8db2d6da32610b6d
child 133847 a2de97d3a53fd1dcef9a23d5a325c295d4fe9aac
push id24773
push userryanvm@gmail.com
push dateTue, 04 Jun 2013 00:43:28 +0000
treeherdermozilla-central@7e3a4ebcf067 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs878914
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 878914 - Fix race condition in marionette testrunner;r=jgriffin
testing/marionette/client/marionette/runtests.py
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -237,26 +237,22 @@ class MarionetteTestRunner(object):
     def reset_test_stats(self):
         self.passed = 0
         self.failed = 0
         self.todo = 0
         self.failures = []
 
     def start_httpd(self):
         host = moznetwork.get_ip()
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.bind(("",0))
-        port = s.getsockname()[1]
-        s.close()
-        self.baseurl = 'http://%s:%d/' % (host, port)
-        self.logger.info('running webserver on %s' % self.baseurl)
         self.httpd = MozHttpd(host=host,
-                              port=port,
+                              port=0,
                               docroot=os.path.join(os.path.dirname(__file__), 'www'))
         self.httpd.start()
+        self.baseurl = 'http://%s:%d/' % (host, self.httpd.httpd.server_port)
+        self.logger.info('running webserver on %s' % self.baseurl)
 
     def start_marionette(self):
         assert(self.baseurl is not None)
         if self.bin:
             if self.address:
                 host, port = self.address.split(':')
             else:
                 host = 'localhost'