Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2008-08-04 23:04:37 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2008-08-04 23:04:37 (GMT)
commit26985ff913995e4d0305ab60400687dfbc6b13c6 (patch)
tree45d1dee43490a60433773160558987eacbfb9a22 /scripts
parent8b8b237bbfc1edf136a799e95b3975553a9956f8 (diff)
Use Xvfb when available to run the tests in.
Unhappy with having to pick a random port, but I don't see how it could cause problems in practice.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/check.py b/scripts/check.py
index a49fc29..77fa4eb 100644
--- a/scripts/check.py
+++ b/scripts/check.py
@@ -1,4 +1,6 @@
import os
+from optparse import make_option
+import random
import subprocess
from jhbuild.commands import Command, register_command
@@ -12,6 +14,27 @@ class cmd_check(Command):
name = 'check'
usage_args = ''
+ def __init__(self):
+ Command.__init__(self, [
+ make_option('-x', '--xvfb-port', action='store',
+ dest='xvfb_port', default=None,
+ help='specify the port of the xvfb server')
+ ])
+
+ def start_xvfb(self, port):
+ if port is None:
+ port = ':%d' % random.randrange(1000, 50000)
+
+ try:
+ subprocess.Popen(['Xvfb', '-ac', port], stderr=subprocess.PIPE)
+ os.environ['DISPLAY'] = port
+ except OSError:
+ print 'Cannot execute xfvb, will use the default display.'
+
+ def stop_xvfb(self):
+ if self._xvfb_pid:
+ os.kill(self._xvfb_pid)
+
def run_pylint(self, args):
p = subprocess.Popen([ 'pylint' ] + args, stdout=subprocess.PIPE)
@@ -43,6 +66,8 @@ class cmd_check(Command):
def run(self, config, options, args):
result = True
+ self.start_xvfb(options.xvfb_port)
+
print 'Pylint the sugar shell...'
sugar_path = os.path.join(config.prefix, 'share', 'sugar')