def run(self): self.logger = structuredlog.getOutputLogger("WPT") self.init() while True: commands = {"test_ended":self.test_ended, "setup_succeeded": self.setup_succeeded, "setup_failed": self.setup_failed} has_data = self.command_pipe.poll(1) if has_data: command, data = self.command_pipe.recv() if commands[command](*data) is Stop: break else: if self.stop_flag.is_set(): self.stop_runner(graceful=True) break elif not self.test_runner_proc.is_alive(): #This happens when we run out of tests; #We ask the runner to stop, it shuts itself #down and then we end up here #An alternate implementation strategy would be to have the #runner signal that it is done just before it terminates self.firefox_runner.stop() break
import sys import os import subprocess from collections import defaultdict import copy import manifestparser import structuredlog import metadata import test as test_ import expected logger = structuredlog.getOutputLogger("wptrunner.manifests") def git(command, *args): return subprocess.check_output(["git", command] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE) def rev_range(rev_old, rev_new, symmetric=False): joiner = ".." if not symmetric else ".." return "".join([rev_old, joiner, rev_new]) def paths_changed(rev_old, rev_new): data = git("diff", "--name-status", rev_range(rev_old, rev_new)) output = set(fields.strip() for fields in line.strip().split(" ", 1) for line in data.split("\n") if line.strip()) return output def load_change_data(rev_old, rev_new):
DEFAULT_TIMEOUT = 10 #seconds LONG_TIMEOUT = 60 #seconds import structuredlog import mozinfo import metadata logger = structuredlog.getOutputLogger("WPT") class RunInfo(object): def __init__(self, debug): self.platform = mozinfo.info self.debug = debug class Test(object): def __init__(self, url, expected, timeout=None, path=None): self.url = url self.expected = expected self.timeout = timeout self.path = path @property def id(self): return self.url def disabled(self, run_info, subtest=None): if subtest is None: subtest = "FILE"
import sys import os import subprocess from collections import defaultdict import copy import manifestparser import structuredlog import metadata import test as test_ import expected logger = structuredlog.getOutputLogger("wptrunner.manifests") def git(command, *args): return subprocess.check_output(["git", command] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE) def rev_range(rev_old, rev_new, symmetric=False): joiner = ".." if not symmetric else ".." return "".join([rev_old, joiner, rev_new]) def paths_changed(rev_old, rev_new): data = git("diff", "--name-status", rev_range(rev_old, rev_new)) output = set(fields.strip() for fields in line.strip().split(" ", 1) for line in data.split("\n") if line.strip())
import structuredlog import metadata import test as test_ #TODO # reftest details (window size+ lots more) # logging # Documentation # better status report # correct output format # webdriver tests # HTTP server crashes # Expected test results logger = structuredlog.getOutputLogger("WPT") def setup_stdlib_logger(): logging.root.handlers = [] adapter_cls = structuredlog.get_adapter_cls() logging.root.addHandler(adapter_cls()) def do_test_relative_imports(test_root): global serve sys.path.insert(0, os.path.join(test_root)) sys.path.insert(0, os.path.join(test_root, "tools", "scripts")) import serve def make_wrapper(cmd, cmd_args): class WrappedCommand(type):