Index: jhbuild/commands/base.py
===================================================================
--- jhbuild/commands/base.py	(révision 1452)
+++ jhbuild/commands/base.py	(copie de travail)
@@ -139,6 +139,9 @@
             make_option('-D', metavar='DATE-SPEC',
                         action='store', dest='sticky_date', default=None,
                         help='set a sticky date when checking out modules'),
+            make_option('-x', '--no-xvfb',
+                        action='store_true', dest='noxvfb', default=False,
+                        help='Run tests in real X and not in Xvfb')
             ])
 
     def run(self, config, options, args):
@@ -156,6 +159,8 @@
             config.skip += item.split(',')
         if options.sticky_date is not None:
             config.sticky_date = options.sticky_date
+        if options.noxvfb is not None:
+            config.noxvfb = options.noxvfb
 
         module_set = jhbuild.moduleset.load(config)
         module_list = module_set.get_module_list(args or config.modules,
@@ -199,6 +204,9 @@
             make_option('-D', metavar='DATE-SPEC',
                         action='store', dest='sticky_date', default=None,
                         help='set a sticky date when checking out modules'),
+            make_option('-x', '--no-xvfb',
+                        action='store_true', dest='noxvfb', default=False,
+                        help='Run tests in real X and not in Xvfb')
             ])
 
     def run(self, config, options, args):
@@ -214,6 +222,8 @@
             config.nonetwork = True
         if options.sticky_date is not None:
             config.sticky_date = options.sticky_date
+        if options.noxvfb is not None:
+            config.noxvfb = options.noxvfb
 
         module_set = jhbuild.moduleset.load(config)
         try:
Index: jhbuild/frontends/autobuild.py
===================================================================
--- jhbuild/frontends/autobuild.py	(révision 1452)
+++ jhbuild/frontends/autobuild.py	(copie de travail)
@@ -34,6 +34,7 @@
 
 from tinderbox import get_distro
 from terminal import TerminalBuildScript, trayicon, t_bold, t_reset
+import jhbuild.moduleset
 
 def escape(string):
     return string.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
@@ -87,6 +88,7 @@
         self.server = None
         self.modulefp = None
         self.phasefp = None
+        self.modules = {}
 
         # cleanup environment
         os.environ['TERM'] = 'dumb'
@@ -247,6 +249,14 @@
     def end_phase(self, module, state, error):
         log = fix_encoding(self.phasefp.getvalue())
         self.phasefp = None
+
+        if state == 'test':
+            if self.modules == {}:
+                self.modules = jhbuild.moduleset.load_tests(self.config)
+
+            if module in self.modules.modules.keys() \
+                   and self.modules.modules[module].test_type == 'ldtp':
+                self._upload_logfile(module)
         self.server.end_phase(self.build_id, module, state, compress_data(log), error)
 
     def handle_error(self, module, state, nextstate, error, altstates):
@@ -254,5 +264,21 @@
         print 'handle error!'
         return 'fail'
 
+    def _upload_ldtp_logfile (self, module):
+        test_module = self.modules.modules[module]
+        src_dir =  test_module.get_srcdir()
+        if not os.path.exists (os.path.join(src_dir,'run.xml')):
+            return
+        logfile = test_module.get_ldtp_log_file (os.path.join(src_dir,'run.xml'))
+        if not os.path.exists (logfile):
+            return
+        self._upload_logfile (module, logfile, 'application/x-ldtp+xml')
 
+    def _upload_logfile (self, module, logfile, mimetype):
+        log = open (logfile, 'r')
+        basename = os.path.basename (logfile)
+        self.server.attach_file (self.build_id, module, 'test', basename,
+                                 compress_data(log.read()), mimetype)
+        log.close()
+
 BUILD_SCRIPT = AutobuildBuildScript
Index: jhbuild/frontends/terminal.py
===================================================================
--- jhbuild/frontends/terminal.py	(révision 1452)
+++ jhbuild/frontends/terminal.py	(copie de travail)
@@ -57,7 +57,7 @@
     'configure':      'configure.png',
     #'clean':          'clean.png',
     'build':          'build.png',
-    #'check':          'check.png',
+    'check':          'check.png',
     'install':        'install.png',
     }
 
Index: jhbuild/frontends/tinderbox.py
===================================================================
--- jhbuild/frontends/tinderbox.py	(révision 1452)
+++ jhbuild/frontends/tinderbox.py	(copie de travail)
@@ -137,7 +137,9 @@
     return None
 
 def escape(string):
-    return string.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
+    return string.replace('&','&amp;').replace('<','&lt;').replace(
+            '>','&gt;').replace('\n','<br/>').replace(
+            '\t','&nbsp;&nbsp;&nbsp;&nbsp;')
 
 class TinderboxBuildScript(buildscript.BuildScript):
     def __init__(self, config, module_list):
Index: jhbuild/moduleset.py
===================================================================
--- jhbuild/moduleset.py	(révision 1452)
+++ jhbuild/moduleset.py	(copie de travail)
@@ -33,8 +33,9 @@
 from jhbuild import modtypes
 from jhbuild.versioncontrol import get_repo_type
 from jhbuild.utils import httpcache
+from jhbuild.modtypes import testmodule
 
-__all__ = [ 'load' ]
+__all__ = ['load', 'load_tests']
 
 class ModuleSet:
     def __init__(self):
@@ -118,6 +119,16 @@
     
     def get_full_module_list(self, skip=[]):
         return self.get_module_list(self.modules.keys(), skip=skip)
+
+    def get_test_module_list (self, seed, skip=[]):
+        test_modules = []
+        if seed == []:
+            return
+        for mod in self.modules.values():
+            for test_app in seed:
+                if test_app in mod.tested_pkgs:
+                    test_modules.append(mod)
+        return test_modules
     
     def write_dot(self, modules=None, fp=sys.stdout):
         from jhbuild.modtypes import MetaModule
@@ -173,6 +184,14 @@
         ms.modules.update(_parse_module_set(config, uri).modules)
     return ms
 
+def load_tests (config, uri=None):
+    ms = load (config, uri)
+    ms_tests = ModuleSet()
+    for app, module in ms.modules.iteritems():
+        if module.__class__ == testmodule.TestModule:
+            ms_tests.modules[app] = module
+    return ms_tests
+
 def _child_elements(parent):
     for node in parent.childNodes:
         if node.nodeType == node.ELEMENT_NODE:
Index: jhbuild/main.py
===================================================================
--- jhbuild/main.py	(révision 1452)
+++ jhbuild/main.py	(copie de travail)
@@ -34,6 +34,7 @@
         ('updateone', 'update a fixed set of modules'),
         ('list', 'list what modules would be built'),
         ('info', 'prints information about modules'),
+        ('test', 'Runs LDTP/Dogtail tests on the respective modules'),
         ('tinderbox', 'build non-interactively with logging'),
         ('gui', 'build targets from a gui app'),
         ('run', 'run a command in the build environment'),
Index: jhbuild/config.py
===================================================================
--- jhbuild/config.py	(révision 1452)
+++ jhbuild/config.py	(copie de travail)
@@ -30,7 +30,7 @@
 
 _known_keys = [ 'moduleset', 'modules', 'skip', 'prefix',
                 'checkoutroot', 'buildroot', 'autogenargs', 'makeargs',
-                'repos', 'branches',
+                'repos', 'branches', 'noxvfb', 'xvfbargs',
                 'builddir_pattern', 'module_autogenargs', 'module_makeargs',
                 'interact', 'buildscript', 'nonetwork',
                 'alwaysautogen', 'nobuild', 'makeclean', 'makecheck',
@@ -193,3 +193,10 @@
                 if x.find('libgdkxft.so') >= 0:
                     valarr.remove(x)
             os.environ['LD_PRELOAD'] = ' '.join(valarr)
+
+
+        # For getting rid of verbose output for LDTP tests
+        if os.environ.has_key('LDTP_DEBUG'):
+            del os.environ['LDTP_DEBUG']
+        if not os.environ.has_key('GNOME_ACCESSIBILITY') or os.environ['GNOME_ACCESSIBILITY'] != 1:
+            os.environ['GNOME_ACCESSIBILITY'] = '1'
Index: jhbuild/defaults.jhbuildrc
===================================================================
--- jhbuild/defaults.jhbuildrc	(révision 1452)
+++ jhbuild/defaults.jhbuildrc	(copie de travail)
@@ -75,3 +75,7 @@
 
 # whether not to emit notifications through the notification daemon
 nonotify = False
+
+# whether to run tests in real X and not in Xvfb
+noxvfb = False
+
Index: modulesets/gnome-2.14.modules
===================================================================
--- modulesets/gnome-2.14.modules	(révision 1452)
+++ modulesets/gnome-2.14.modules	(copie de travail)
@@ -44,6 +44,8 @@
   <repository type="cvs" name="openh323.sf.net"
      cvsroot=":pserver:anonymous@openh323.cvs.sourceforge.net:/cvsroot/openh323"
      password="" />
+  <repository type="cvs" name="ldtp.freedesktop.org"
+     cvsroot=":pserver:anoncvs@cvs.freedesktop.org:/cvs/ldtp" password="" />
 
   <tarball id="scrollkeeper" version="0.3.14" supports-non-srcdir-builds="no">
     <source href="http://easynews.dl.sourceforge.net/sourceforge/scrollkeeper/scrollkeeper-0.3.14.tar.gz"
@@ -2011,4 +2013,12 @@
       <dep package="gnonlin"/>
     </dependencies>
   </autotools>
+  <autotools id="ldtp">
+    <branch repo="ldtp.freedesktop.org" module="ldtp"/>
+    <dependencies>
+      <dep package="at-spi"/>
+      <dep package="libgnomeui"/>
+      <dep package="atk"/>
+    </dependencies>
+  </autotools>	
 </moduleset>
