Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/test.py
blob: fc2839bd927555f7f0583e95638ee050519bc40c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import subprocess

from devbot import config
from devbot import environ
from devbot import command
from devbot import xvfb

def test_one(module_name):
    environ.setup()

    for module in config.load_modules():
        if module.name == module_name:
            return _test_module(module)

    return False

def test():
    environ.setup()

    modules = config.load_modules()
    for module in modules:
        if not _test_module(module):
            return False

    return True

def _test_module(module):
    result = True

    if module.has_tests:
        os.chdir(module.get_build_dir())

        xvfb_proc, orig_display = xvfb.start()

        try:
            command.run(["make", "test"])
        except subprocess.CalledProcessError:
            result = False

        xvfb.stop(xvfb_proc, orig_display)

    return result