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 * Blacklisted tests
* Test generators * Test generators
""" """
printc("-> Registering default 'validate' tests... ", end='')
self.register_default_scenarios() self.register_default_scenarios()
self.register_default_encoding_formats() self.register_default_encoding_formats()
self.register_default_blacklist() self.register_default_blacklist()
self.register_default_test_generators() self.register_default_test_generators()
printc("OK", Colors.OKGREEN)
def register_default_scenarios(self): def register_default_scenarios(self):
""" """

View file

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

View file

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