diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-10 15:07:37 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-01-10 15:07:37 (GMT) |
commit | 05767660ffd552fd0c231e8a265f8feb6c6e35b7 (patch) | |
tree | 2beff8b25850516ace6d4eb4368a522ec460d8fa /devbot | |
parent | c287fda229d5157b47a5d8f0218e813e5d96dd75 (diff) |
Run tests inside the sugar environment
Cleanup and tries to solve a race between at-spi2
starting and the test trying to use it.
Diffstat (limited to 'devbot')
-rw-r--r-- | devbot/run.py | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/devbot/run.py b/devbot/run.py index caf9bad..076217b 100644 --- a/devbot/run.py +++ b/devbot/run.py @@ -2,8 +2,6 @@ import os import string import random import subprocess -import time -import tempfile from devbot import config from devbot import command @@ -24,48 +22,13 @@ def run(cmd): def run_test(test_cmd, test_path): - temp_dir = tempfile.mkdtemp("devbot-test-display") - display_path = os.path.join(temp_dir, "display") - args = [test_cmd, - "--display-path", display_path, + "--test-command", "python -u %s" % test_path, "--virtual"] - output_fd, output_name = tempfile.mkstemp("devbot-test-output") - output_file = os.fdopen(output_fd) - - test_cmd_process = subprocess.Popen(args, - stdout=output_file, - stderr=subprocess.STDOUT) - - while True: - if not os.path.exists(display_path): - time.sleep(1) - else: - break - - with open(display_path) as f: - os.environ["DISPLAY"] = f.read() - - os.unlink(display_path) - os.rmdir(temp_dir) - - try: - command.run(["python", "-u", test_path]) - result = True - except subprocess.CalledProcessError: - result = False - - test_cmd_process.terminate() - - output_file.seek(0) with open(config.log_path, "a") as f: - f.write(output_file.read()) - - output_file.close() - os.unlink(output_name) - - return result + result = subprocess.call(args, stdout=f, stderr=subprocess.STDOUT) + return result == 0 def collect_logs(source_path): |