Esempio n. 1
0
def update_expected(test_root, metadata_root, log_file_names, rev_old=None, rev_new="HEAD",
                    ignore_existing=False, sync_root=None):
    """Update the metadata files for web-platform-tests based on
    the results obtained in a previous run"""

    manifest = load_test_manifest(test_root, metadata_root)

    if sync_root is not None:
        if rev_old is not None:
            rev_old = git("rev-parse", rev_old, repo=test_root).strip()
        rev_new = git("rev-parse", rev_new, repo=test_root).strip()

    if rev_old is not None:
        change_data = load_change_data(rev_old, rev_new, repo=test_root)
    else:
        change_data = {}

    expected_map = update_from_logs(metadata_root, manifest, *log_file_names,
                                    ignore_existing=ignore_existing)

    write_changes(metadata_root, expected_map)

    results_changed = [item.test_path for item in expected_map.itervalues() if item.modified]

    return unexpected_changes(change_data, results_changed)
Esempio n. 2
0
def update_expected(test_paths,
                    serve_root,
                    log_file_names,
                    rev_old=None,
                    rev_new="HEAD",
                    ignore_existing=False,
                    sync_root=None):
    """Update the metadata files for web-platform-tests based on
    the results obtained in a previous run"""

    manifests = load_test_manifests(serve_root, test_paths)

    change_data = {}

    if sync_root is not None:
        if rev_old is not None:
            rev_old = git("rev-parse", rev_old, repo=sync_root).strip()
        rev_new = git("rev-parse", rev_new, repo=sync_root).strip()

        if rev_old is not None:
            change_data = load_change_data(rev_old, rev_new, repo=sync_root)

    expected_map_by_manifest = update_from_logs(
        manifests, *log_file_names, ignore_existing=ignore_existing)

    for test_manifest, expected_map in expected_map_by_manifest.iteritems():
        url_base = manifests[test_manifest]["url_base"]
        metadata_path = test_paths[url_base]["metadata_path"]
        write_changes(metadata_path, expected_map)

    results_changed = [
        item.test_path for item in expected_map.itervalues() if item.modified
    ]

    return unexpected_changes(manifests, change_data, results_changed)
Esempio n. 3
0
def update_expected(test_paths, serve_root, log_file_names,
                    rev_old=None, rev_new="HEAD", ignore_existing=False,
                    sync_root=None):
    """Update the metadata files for web-platform-tests based on
    the results obtained in a previous run"""

    manifests = load_test_manifests(serve_root, test_paths)

    change_data = {}

    if sync_root is not None:
        if rev_old is not None:
            rev_old = git("rev-parse", rev_old, repo=sync_root).strip()
        rev_new = git("rev-parse", rev_new, repo=sync_root).strip()

        if rev_old is not None:
            change_data = load_change_data(rev_old, rev_new, repo=sync_root)


    expected_map_by_manifest = update_from_logs(manifests,
                                                *log_file_names,
                                                ignore_existing=ignore_existing)

    for test_manifest, expected_map in expected_map_by_manifest.iteritems():
        url_base = manifests[test_manifest]["url_base"]
        metadata_path = test_paths[url_base]["metadata_path"]
        write_changes(metadata_path, expected_map)

    results_changed = [item.test_path for item in expected_map.itervalues() if item.modified]

    return unexpected_changes(manifests, change_data, results_changed)
Esempio n. 4
0
def update_expected(test_paths,
                    serve_root,
                    log_file_names,
                    rev_old=None,
                    rev_new="HEAD",
                    ignore_existing=False,
                    sync_root=None,
                    property_order=None,
                    boolean_properties=None,
                    stability=None):
    """Update the metadata files for web-platform-tests based on
    the results obtained in a previous run or runs

    If stability is not None, assume log_file_names refers to logs from repeated
    test jobs, disable tests that don't behave as expected on all runs"""

    manifests = load_test_manifests(serve_root, test_paths)

    change_data = {}

    if sync_root is not None:
        if rev_old is not None:
            rev_old = git("rev-parse", rev_old, repo=sync_root).strip()
        rev_new = git("rev-parse", rev_new, repo=sync_root).strip()

        if rev_old is not None:
            change_data = load_change_data(rev_old, rev_new, repo=sync_root)

    expected_map_by_manifest = update_from_logs(
        manifests,
        *log_file_names,
        ignore_existing=ignore_existing,
        property_order=property_order,
        boolean_properties=boolean_properties,
        stability=stability)

    for test_manifest, expected_map in expected_map_by_manifest.iteritems():
        url_base = manifests[test_manifest]["url_base"]
        metadata_path = test_paths[url_base]["metadata_path"]
        write_changes(metadata_path, expected_map)
        if stability is not None:
            for tree in expected_map.itervalues():
                for test in tree.iterchildren():
                    for subtest in test.iterchildren():
                        if subtest.new_disabled:
                            print "disabled: %s" % os.path.dirname(
                                subtest.root.test_path) + "/" + subtest.name
                    if test.new_disabled:
                        print "disabled: %s" % test.root.test_path

    results_changed = [
        item.test_path for item in expected_map.itervalues() if item.modified
    ]

    return unexpected_changes(manifests, change_data, results_changed)
Esempio n. 5
0
def paths_changed(rev_old, rev_new, repo):
    data = git("diff", "--name-status", rev_range(rev_old, rev_new), repo=repo)
    lines = [
        tuple(item.strip() for item in line.strip().split("\t", 1))
        for line in data.split("\n") if line.strip()
    ]
    output = set(lines)
    return output
def update_expected(test_paths, serve_root, log_file_names,
                    rev_old=None, rev_new="HEAD", ignore_existing=False,
                    sync_root=None, property_order=None, boolean_properties=None,
                    stability=None):
    """Update the metadata files for web-platform-tests based on
    the results obtained in a previous run or runs

    If stability is not None, assume log_file_names refers to logs from repeated
    test jobs, disable tests that don't behave as expected on all runs"""

    manifests = load_test_manifests(serve_root, test_paths)

    change_data = {}

    if sync_root is not None:
        if rev_old is not None:
            rev_old = git("rev-parse", rev_old, repo=sync_root).strip()
        rev_new = git("rev-parse", rev_new, repo=sync_root).strip()

        if rev_old is not None:
            change_data = load_change_data(rev_old, rev_new, repo=sync_root)

    expected_map_by_manifest = update_from_logs(manifests,
                                                *log_file_names,
                                                ignore_existing=ignore_existing,
                                                property_order=property_order,
                                                boolean_properties=boolean_properties,
                                                stability=stability)

    for test_manifest, expected_map in expected_map_by_manifest.iteritems():
        url_base = manifests[test_manifest]["url_base"]
        metadata_path = test_paths[url_base]["metadata_path"]
        write_changes(metadata_path, expected_map)
        if stability is not None:
            for tree in expected_map.itervalues():
                for test in tree.iterchildren():
                    for subtest in test.iterchildren():
                        if subtest.new_disabled:
                            print "disabled: %s" % os.path.dirname(subtest.root.test_path) + "/" + subtest.name
                    if test.new_disabled:
                        print "disabled: %s" % test.root.test_path

    results_changed = [item.test_path for item in expected_map.itervalues() if item.modified]

    return unexpected_changes(manifests, change_data, results_changed)
Esempio n. 7
0
 def _submodules(self):
     output = git("submodule", "status", "--recursive", repo=self.repo_path)
     rv = []
     for line in output.split("\n"):
         line = line.strip()
         if not line:
             continue
         parts = line.split(" ")
         rv.append(parts[1])
     return rv
Esempio n. 8
0
    def _tree_paths(self):
        repo_paths = [self.repo_path] + [os.path.join(self.repo_path, path) for path in self._submodules()]

        rv = []

        for repo_path in repo_paths:
            paths = git("ls-tree", "-r", "--name-only", "HEAD", repo=repo_path).split("\n")
            rel_path = os.path.relpath(repo_path, self.repo_path)
            rv.extend([os.path.join(rel_path, item.strip()) for item in paths if item.strip()])

        return rv
Esempio n. 9
0
    def _tree_paths(self):
        repo_paths = [self.repo_path] +  [os.path.join(self.repo_path, path)
                                          for path in self._submodules()]

        rv = []

        for repo_path in repo_paths:
            paths = git("ls-tree", "-r", "--name-only", "HEAD", repo=repo_path).split("\n")
            rel_path = os.path.relpath(repo_path, self.repo_path)
            rv.extend([os.path.join(rel_path, item.strip()) for item in paths if item.strip()])

        return rv
Esempio n. 10
0
 def __init__(self, root=None):
     if root is None:
         root = git("rev-parse", "--show-toplevel").strip()
     self.root = root
     self.git = vcs.bind_to_repo(git, self.root)
     self.message = None
Esempio n. 11
0
 def clean(self):
     git("checkout", self.rev, repo=self.repo_path)
     git("branch", "-D", self.local_branch, repo=self.repo_path)
Esempio n. 12
0
 def rev(self):
     if vcs.is_git_root(self.repo_path):
         return git("rev-parse", "HEAD", repo=self.repo_path).strip()
     else:
         return None
def paths_changed(rev_old, rev_new, repo):
    data = git("diff", "--name-status", rev_range(rev_old, rev_new), repo=repo)
    lines = [tuple(item.strip() for item in line.strip().split("\t", 1))
             for line in data.split("\n") if line.strip()]
    output = set(lines)
    return output
def files_in_repo(repo_root):
    return git("ls-tree", "-r", "--name-only", "HEAD").split("\n")
Esempio n. 15
0
 def is_type(cls, path):
     try:
         git("rev-parse", "--show-toplevel", repo=path)
     except:
         return False
     return True
Esempio n. 16
0
    def update(self):
        if not os.path.exists(self.repo_path):
            os.makedirs(self.repo_path)
        if not vcs.is_git_root(self.repo_path):
            git("clone", self.remote_url, ".", repo=self.repo_path)
            git("checkout", "-b", self.local_branch, self.target_rev, repo=self.repo_path)
            assert vcs.is_git_root(self.repo_path)
        else:
            if git("status", "--porcelain", repo=self.repo_path):
                raise RepositoryError("Repository in %s not clean" % self.repo_path)

            git("fetch",
                self.remote_url,
                "%s:%s" % (self.target_rev,
                           self.local_branch),
                repo=self.repo_path)
            git("checkout", self.local_branch, repo=self.repo_path)
        git("submodule", "init", repo=self.repo_path)
        git("submodule", "update", "--init", "--recursive", repo=self.repo_path)
Esempio n. 17
0
def files_in_repo(repo_root):
    return git("ls-tree", "-r", "--name-only", "HEAD").split("\n")