diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-08 14:54:01 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-08 14:54:01 (GMT) |
commit | 3f05816ea746124ca2b91842ba5f8bb5175c2068 (patch) | |
tree | 65b60ba9fc590c965d172545bf653b84205267ff /devbot/test.py | |
parent | ce2d2cdd3372d4a58806f0a178f0a410357f96a2 (diff) |
Add per module tests to the check target
Diffstat (limited to 'devbot/test.py')
-rw-r--r-- | devbot/test.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/devbot/test.py b/devbot/test.py new file mode 100644 index 0000000..eec2afc --- /dev/null +++ b/devbot/test.py @@ -0,0 +1,44 @@ +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: + print module.name + 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 |