validate:launcher: Enhance and standardize output

This commit is contained in:
Thibault Saunier 2019-03-16 21:37:37 -03:00 committed by Thibault Saunier
parent fca2411e77
commit 8d00a74f1a
3 changed files with 13 additions and 9 deletions

View file

@ -1026,10 +1026,12 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
* Blacklisted tests
* Test generators
"""
printc("-> Registering default 'validate' tests... ", end='')
self.register_default_scenarios()
self.register_default_encoding_formats()
self.register_default_blacklist()
self.register_default_test_generators()
printc("OK", Colors.OKGREEN)
def register_default_scenarios(self):
"""

View file

@ -26,6 +26,8 @@ import urllib.request
import urllib.error
import urllib.parse
from .utils import printc, Colors
logcat = "httpserver"
@ -63,7 +65,7 @@ class HTTPServer(loggable.Loggable):
if self._check_is_up(timeout=2):
return True
print("Starting Server")
printc("-> Starting HTTP server... ", end='')
try:
self.debug("Launching http server")
cmd = "%s %s %d %s" % (sys.executable, os.path.join(os.path.dirname(__file__),
@ -87,14 +89,14 @@ class HTTPServer(loggable.Loggable):
time.sleep(1)
if self._check_is_up():
print("Started")
printc("OK", Colors.OKGREEN)
return True
else:
print("Failed starting server")
printc("FAILURE", Colors.FAIL)
self._process.terminate()
self._process = None
except OSError as ex:
print("Failed starting server")
printc("FAILURE", Colors.FAIL)
self.warning(logcat, "Could not launch server %s" % ex)
return False

View file

@ -19,6 +19,7 @@
import os
import time
from .utils import printc, Colors
from . import loggable
import subprocess
@ -54,7 +55,6 @@ class Xvfb(VirtualFrameBufferServer):
os.environ["DISPLAY"] = self.display_id
subprocess.check_output(["xset", "q"],
stderr=self._logsfile)
print(("DISPLAY set to %s" % self.display_id))
return True
except subprocess.CalledProcessError:
pass
@ -76,10 +76,10 @@ class Xvfb(VirtualFrameBufferServer):
self._logsfile = open(os.path.join(self.options.logsdir,
"xvfb.logs"), 'w+')
if self._check_is_up(assume_true=False):
print("xvfb already running")
self.info("xvfb already running")
return (True, None)
print("Starting xvfb")
printc("-> Starting xvfb... ", end="")
try:
self.debug("Launching xvfb: %s (logs in %s)", self._command, self._logsfile)
self._process = subprocess.Popen(self._command.split(" "),
@ -92,10 +92,10 @@ class Xvfb(VirtualFrameBufferServer):
time.sleep(1)
if self._check_is_up():
print("Xvfb tarted")
printc("OK", Colors.OKGREEN)
return (True, None)
else:
print("Failed starting xvfb")
printc("ERROR", Colors.FAIL)
self._process.terminate()
self._process = None
except Exception as ex: