Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/test.py
blob: d3bd0a0cbd2913e217dec284b69a6946b880de0d (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
import os
import subprocess

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


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

    return False


def test():
    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", "check"])
        except subprocess.CalledProcessError:
            result = False

        xvfb.stop(xvfb_proc, orig_display)

    return result