diff options
author | Thibault Saunier <tsaunier@igalia.com> | 2018-09-07 15:59:49 -0300 |
---|---|---|
committer | Thibault Saunier <tsaunier@igalia.com> | 2018-09-07 16:15:25 -0300 |
commit | 4fc935d08dc229f14784d8d763c00662c18eceb5 (patch) | |
tree | 6b44bfea93213c558c87bbea2628b50632ed0dee | |
parent | 8a923fdcca018c676a0dbdd9092d4e90ba220541 (diff) |
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
-rw-r--r-- | validate/launcher/vfb_server.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/validate/launcher/vfb_server.py b/validate/launcher/vfb_server.py index fd9433c..07c8a55 100644 --- a/validate/launcher/vfb_server.py +++ b/validate/launcher/vfb_server.py @@ -46,12 +46,11 @@ class Xvfb(VirtualFrameBufferServer): self._logsfile = None self._command = "Xvfb %s -screen 0 1920x1080x24" % self.display_id - def _check_is_up(self, timeout=60): - """ Check if the xvfb is up, running a simple test based on wget. """ + def _check_is_up(self, timeout=3, assume_true=True): + """ Check if the xvfb is up, running a simple test based on xset. """ start = time.time() while True: try: - cdisplay = os.environ.get("DISPLAY", None) os.environ["DISPLAY"] = self.display_id subprocess.check_output(["xset", "q"], stderr=self._logsfile) @@ -59,6 +58,13 @@ class Xvfb(VirtualFrameBufferServer): return True except subprocess.CalledProcessError: 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: return False @@ -69,7 +75,7 @@ class Xvfb(VirtualFrameBufferServer): """ Start xvfb in a subprocess """ self._logsfile = open(os.path.join(self.options.logsdir, "xvfb.logs"), 'w+') - if self._check_is_up(timeout=2): + if self._check_is_up(assume_true=False): print("xvfb already running") return (True, None) |