diff options
-rw-r--r-- | Makefile.commands | 4 | ||||
-rw-r--r-- | Makefile.tests | 2 | ||||
-rwxr-xr-x | commands/run-tests (renamed from commands/test-ui) | 4 | ||||
-rw-r--r-- | config/modules/sugar.json | 6 | ||||
-rw-r--r-- | devbot/config.py | 1 | ||||
-rw-r--r-- | devbot/test.py | 44 |
6 files changed, 56 insertions, 5 deletions
diff --git a/Makefile.commands b/Makefile.commands index 367f2ab..12ea79d 100644 --- a/Makefile.commands +++ b/Makefile.commands @@ -15,8 +15,8 @@ build: run: @$(COMMANDS_DIR)/run -test-ui: - @$(COMMANDS_DIR)/test-ui +run-tests: + @$(COMMANDS_DIR)/run-tests shell: @$(COMMANDS_DIR)/shell diff --git a/Makefile.tests b/Makefile.tests index d47e558..6416268 100644 --- a/Makefile.tests +++ b/Makefile.tests @@ -6,4 +6,4 @@ test-devbot: TMPDIR=$(TESTS_DATA) PYTHONPATH=$(BASE_DIR) python -m unittest discover rm -rf $(TESTS_DATA) -check: test-devbot test-ui +check: test-devbot run-tests diff --git a/commands/test-ui b/commands/run-tests index 5686ebd..a9919df 100755 --- a/commands/test-ui +++ b/commands/run-tests @@ -7,6 +7,7 @@ import sys import common from devbot import run +from devbot import test common.setup() @@ -14,6 +15,9 @@ os.environ["SUGAR_LOGGER_LEVEL"] = "debug" os.environ["SUGAR_PROFILE"] = "uitests" os.environ["GTK_MODULES"] = "gail:atk-bridge" +if not test.test(): + sys.exit(1) + profile_path = os.path.expanduser("~/.sugar/uitests") shutil.rmtree(profile_path, ignore_errors=True) diff --git a/config/modules/sugar.json b/config/modules/sugar.json index 2c119e5..3d374ab 100644 --- a/config/modules/sugar.json +++ b/config/modules/sugar.json @@ -15,16 +15,18 @@ "auto-install": [ "src" ], + "has_tests": true, "name": "sugar-toolkit-gtk3", - "repo": "git://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3.git" + "repo": "git://git.sugarlabs.org/~dnarvaez/sugar-toolkit-gtk3/dnarvaez.git" }, { "auto-install": [ "src", "extensions" ], + "has_tests": true, "name": "sugar", - "repo": "git://git.sugarlabs.org/sugar/mainline.git" + "repo": "git://git.sugarlabs.org/~dnarvaez/sugar/dnarvaez.git" }, { "name": "sugar-artwork", diff --git a/devbot/config.py b/devbot/config.py index 9cce430..ed0f355 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -37,6 +37,7 @@ class Module: self.auto_install = info.get("auto-install", False) self.options = info.get("options", []) self.options_evaluated = info.get("options_evaluated", []) + self.has_tests = info.get("has_tests", False) if get_pref("BUILD_IN_SOURCE"): self.out_of_source = False 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 |