mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-05 19:47:46 +00:00
validate:launcher: Just wait for a while before considering Xvfb is ready if xset is not present
This is what xvfb-run so let's consider it good enough
This commit is contained in:
parent
f0cfdf9d14
commit
1623f7111c
1 changed files with 10 additions and 4 deletions
|
@ -46,12 +46,11 @@ class Xvfb(VirtualFrameBufferServer):
|
||||||
self._logsfile = None
|
self._logsfile = None
|
||||||
self._command = "Xvfb %s -screen 0 1920x1080x24" % self.display_id
|
self._command = "Xvfb %s -screen 0 1920x1080x24" % self.display_id
|
||||||
|
|
||||||
def _check_is_up(self, timeout=60):
|
def _check_is_up(self, timeout=3, assume_true=True):
|
||||||
""" Check if the xvfb is up, running a simple test based on wget. """
|
""" Check if the xvfb is up, running a simple test based on xset. """
|
||||||
start = time.time()
|
start = time.time()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
cdisplay = os.environ.get("DISPLAY", None)
|
|
||||||
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)
|
||||||
|
@ -59,6 +58,13 @@ class Xvfb(VirtualFrameBufferServer):
|
||||||
return True
|
return True
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
except FileNotFoundError:
|
||||||
|
if assume_true:
|
||||||
|
print('WARNING: xset not preset on the system,'
|
||||||
|
' just wait for %s seconds and hope for the best.'
|
||||||
|
' (this is what xvfb-run itself does anyway.)' % timeout)
|
||||||
|
time.sleep(timeout)
|
||||||
|
return assume_true
|
||||||
|
|
||||||
if time.time() - start > timeout:
|
if time.time() - start > timeout:
|
||||||
return False
|
return False
|
||||||
|
@ -69,7 +75,7 @@ class Xvfb(VirtualFrameBufferServer):
|
||||||
""" Start xvfb in a subprocess """
|
""" Start xvfb in a subprocess """
|
||||||
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(timeout=2):
|
if self._check_is_up(assume_true=False):
|
||||||
print("xvfb already running")
|
print("xvfb already running")
|
||||||
return (True, None)
|
return (True, None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue