Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--Makefile.check29
-rw-r--r--Makefile.commands4
-rwxr-xr-xcommands/check109
-rwxr-xr-xcommands/run-tests48
-rw-r--r--config/modules/sugar.json2
-rw-r--r--devbot/check.py (renamed from devbot/test.py)12
-rw-r--r--devbot/config.py2
8 files changed, 119 insertions, 88 deletions
diff --git a/Makefile b/Makefile
index 7d36a19..f860a74 100644
--- a/Makefile
+++ b/Makefile
@@ -14,4 +14,3 @@ include Makefile.config
include Makefile.commands
include Makefile.snapshot
include Makefile.docs
-include Makefile.check
diff --git a/Makefile.check b/Makefile.check
deleted file mode 100644
index 2d6e7bc..0000000
--- a/Makefile.check
+++ /dev/null
@@ -1,29 +0,0 @@
-TESTS_TMP=$(TESTS_DIR)/tmp
-
-test-devbot:
- mkdir -p $(TESTS_TMP) && \
- cd tests/devbot && \
- TMPDIR=$(TESTS_TMP) PYTHONPATH=$(BASE_DIR) python -m unittest discover
- rm -rf $(TESTS_TMP)
-
-PYTHON_SCRIPTS = \
- $(COMMANDS_DIR)/build \
- $(COMMANDS_DIR)/clean \
- $(COMMANDS_DIR)/pull \
- $(COMMANDS_DIR)/run-tests \
- $(COMMANDS_DIR)/shell \
- $(COMMANDS_DIR)/check-system \
- $(COMMANDS_DIR)/distribute \
- $(COMMANDS_DIR)/run \
- $(COMMANDS_DIR)/send-patches \
- $(TOOLS_DIR)/json-normalize
-
-pylint:
- PYTHONPATH=$(COMMANDS_DIR) \
- pylint --reports=n --disable=C,W,R,E,F --enable=W0611 \
- devbot $(PYTHON_SCRIPTS)
-
-pep8:
- pep8 commands devbot tests $(PYTHON_SCRIPTS)
-
-check: test-devbot pep8 pylint run-tests
diff --git a/Makefile.commands b/Makefile.commands
index c0c6ad7..70ec612 100644
--- a/Makefile.commands
+++ b/Makefile.commands
@@ -15,8 +15,8 @@ build:
run:
@$(COMMANDS_DIR)/run
-run-tests:
- @$(COMMANDS_DIR)/run-tests
+check:
+ @$(COMMANDS_DIR)/check
shell:
@$(COMMANDS_DIR)/shell
diff --git a/commands/check b/commands/check
new file mode 100755
index 0000000..21b5d75
--- /dev/null
+++ b/commands/check
@@ -0,0 +1,109 @@
+#!/usr/bin/python -u
+
+import argparse
+import os
+import shutil
+import sys
+
+import common
+
+from devbot import run
+from devbot import check
+from devbot import command
+
+
+def _get_profile():
+ profile_path = os.path.expanduser("~/.sugar/uitests")
+ shutil.rmtree(profile_path, ignore_errors=True)
+ return profile_path
+
+
+def _get_test_path(name):
+ return os.path.join(common.base_dir, "tests", "sugar", name)
+
+
+def _get_python_scripts():
+ shebang = "#!/usr/bin/python"
+ dirs = ["commands", "tools"]
+ scripts = []
+
+ for dir_name in dirs:
+ dir_path = os.path.join(common.base_dir, dir_name)
+ for name in os.listdir(dir_path):
+ script_path = os.path.join(dir_path, name)
+ with open(script_path) as f:
+ if f.read(len(shebang)) == shebang:
+ scripts.append(script_path)
+
+ return scripts
+
+
+def _check_devbot():
+ print "* Checking devbot"
+
+ args = ["pep8"]
+
+ for dir_name in ["devbot", "tests"]:
+ args.append(os.path.join(common.base_dir, dir_name))
+
+ args.extend(_get_python_scripts())
+
+ command.run(args)
+
+ args = ["pylint", "--reports=n", "--disable=C,W,R,E,F", "--enable=W0611"]
+ args.append(os.path.join(common.base_dir, "devbot"))
+ args.extend(_get_python_scripts())
+
+ command.run(args)
+
+ tests_tmp = os.path.join(common.base_dir, "tests", "tmp")
+ try:
+ os.mkdir(tests_tmp)
+ except OSError:
+ pass
+
+ os.environ["TESTS_TMP"] = tests_tmp
+ os.environ["PYTHONPATH"] = common.base_dir
+
+ command.run(["python", "-m", "unittest", "discover",
+ os.path.join(common.base_dir, "tests", "devbot")])
+
+ shutil.rmtree(tests_tmp, ignore_errors=True)
+
+
+def _check_ui():
+ print "* Checking UI"
+
+ profile_path = _get_profile()
+ result = run.run_test("sugar-runner", _get_test_path("shell.py"))
+ run.collect_logs(os.path.join(profile_path, "logs"))
+
+ return result
+
+
+def _check_modules():
+ return check.check()
+
+
+parser = argparse.ArgumentParser()
+parser.add_argument("module", nargs="?", help="name of the module to test")
+args = parser.parse_args()
+
+common.setup(log_name="check")
+
+os.environ["SUGAR_LOGGER_LEVEL"] = "debug"
+os.environ["SUGAR_PROFILE"] = "uitests"
+os.environ["GTK_MODULES"] = "gail:atk-bridge"
+
+if args.module:
+ check.check_one(args.module)
+else:
+ print "\n= Checking =\n"
+
+ _check_devbot()
+
+ if not _check_modules():
+ sys.exit(1)
+
+ if not _check_ui():
+ sys.exit(1)
diff --git a/commands/run-tests b/commands/run-tests
deleted file mode 100755
index 1ac1ea4..0000000
--- a/commands/run-tests
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python -u
-
-import argparse
-import os
-import shutil
-import sys
-
-import common
-
-from devbot import run
-from devbot import test
-
-
-def _get_profile():
- profile_path = os.path.expanduser("~/.sugar/uitests")
- shutil.rmtree(profile_path, ignore_errors=True)
- return profile_path
-
-
-def _get_test_path(name):
- return os.path.join(common.base_dir, "tests", "sugar", name)
-
-
-parser = argparse.ArgumentParser()
-parser.add_argument("module", nargs="?", help="name of the module to test")
-args = parser.parse_args()
-
-common.setup(log_name="test")
-
-os.environ["SUGAR_LOGGER_LEVEL"] = "debug"
-os.environ["SUGAR_PROFILE"] = "uitests"
-os.environ["GTK_MODULES"] = "gail:atk-bridge"
-
-if args.module:
- test.test_one(args.module)
-else:
- print "\n= Checking =\n"
-
- if not test.test():
- sys.exit(1)
-
- print "* Running UI test"
-
- profile_path = _get_profile()
- result = run.run_test("sugar-runner", _get_test_path("shell.py"))
- run.collect_logs(os.path.join(profile_path, "logs"))
- if not result:
- sys.exit(1)
diff --git a/config/modules/sugar.json b/config/modules/sugar.json
index b0c9bf6..39293fb 100644
--- a/config/modules/sugar.json
+++ b/config/modules/sugar.json
@@ -34,7 +34,7 @@
},
{
"distribute": true,
- "has_tests": true,
+ "has_checks": true,
"name": "sugar-runner",
"repo": "git://git.sugarlabs.org/sugar-runner/sugar-runner.git"
}
diff --git a/devbot/test.py b/devbot/check.py
index 44ddfa6..aca4fed 100644
--- a/devbot/test.py
+++ b/devbot/check.py
@@ -7,30 +7,30 @@ from devbot import xvfb
from devbot import build
-def test_one(module_name):
+def check_one(module_name):
for module in config.load_modules():
if module.name == module_name:
- return _test_module(module)
+ return _check_module(module)
return False
-def test():
+def check():
if not build.build():
return False
modules = config.load_modules()
for module in modules:
- if not _test_module(module):
+ if not _check_module(module):
return False
return True
-def _test_module(module):
+def _check_module(module):
result = True
- if module.has_tests:
+ if module.has_checks:
print "* Checking %s" % module.name
os.chdir(module.get_build_dir())
diff --git a/devbot/config.py b/devbot/config.py
index e3782f2..fe96f17 100644
--- a/devbot/config.py
+++ b/devbot/config.py
@@ -34,7 +34,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)
+ self.has_checks = info.get("has_checks", False)
self.distribute = info.get("distribute", False)
if get_pref("BUILD_IN_SOURCE"):