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

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


def check_one(module_name):
    for module in config.load_modules():
        if module.name == module_name:
            return _check_module(module)

    return False


def check():
    if not build.build():
        return False

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

    return True


def _check_module(module):
    result = True

    if module.has_checks:
        print("* Checking %s" % module.name)

        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