Bug 1452834 [wpt PR 10389] - Improve error message for failed wptserve, a=testonly
authorLuke Bjerring <lukebjerring@users.noreply.github.com>
Wed, 06 Jun 2018 16:38:34 +0000
changeset 806624 3d7d065aa3e436d9078f2c93e213fa9947d2215d
parent 806623 2f13ea4b0ff4a7fa8eef8b3281bf47ce59f73285
child 806625 8fa94bcb9b7c292ea9a48629b7224512d643ae8a
push id112908
push userbmo:gl@mozilla.com
push dateMon, 11 Jun 2018 02:53:29 +0000
reviewerstestonly
bugs1452834, 10389, 10388
milestone62.0a1
Bug 1452834 [wpt PR 10389] - Improve error message for failed wptserve, a=testonly Automatic update from web-platform-testsImprove error message for failed wptserve (#10389) Bad error messages were highligted by wpt#10388 This change now logs a warning as to the exact command that runs (including the config file), and the URL that did not load (in case it's a host file or similar). -- wpt-commits: e4b0f7a069606efdc0d633a94ae19b71b6dcd748 wpt-pr: 10389
testing/web-platform/tests/resources/test/wptserver.py
--- a/testing/web-platform/tests/resources/test/wptserver.py
+++ b/testing/web-platform/tests/resources/test/wptserver.py
@@ -1,8 +1,9 @@
+import logging
 import os
 import subprocess
 import time
 import sys
 import urllib2
 
 
 class WPTServer(object):
@@ -14,33 +15,37 @@ class WPTServer(object):
         self.host = config["browser_host"]
         self.http_port = config["ports"]["http"][0]
         self.https_port = config["ports"]["https"][0]
         self.base_url = 'http://%s:%s' % (self.host, self.http_port)
         self.https_base_url = 'https://%s:%s' % (self.host, self.https_port)
 
     def start(self):
         self.devnull = open(os.devnull, 'w')
+        wptserve_cmd = [os.path.join(self.wpt_root, 'wpt'), 'serve']
+        logging.info('Executing %s' % ' '.join(wptserve_cmd))
         self.proc = subprocess.Popen(
-            [os.path.join(self.wpt_root, 'wpt'), 'serve'],
+            wptserve_cmd,
             stderr=self.devnull,
             cwd=self.wpt_root)
 
         for retry in range(5):
             # Exponential backoff.
             time.sleep(2 ** retry)
-            if self.proc.poll() != None:
+            exit_code = self.proc.poll()
+            if exit_code != None:
+                logging.warn('Command "%s" exited with %s', ' '.join(wptserve_cmd), exit_code)
                 break
             try:
                 urllib2.urlopen(self.base_url, timeout=1)
                 return
             except urllib2.URLError:
                 pass
 
-        raise Exception('Could not start wptserve.')
+        raise Exception('Could not start wptserve on %s' % self.base_url)
 
     def stop(self):
         self.proc.terminate()
         self.proc.wait()
         self.devnull.close()
 
     def url(self, abs_path):
         return self.https_base_url + '/' + os.path.relpath(abs_path, self.wpt_root)