def find_reftest_dirs(topsrcdir, manifests): from reftest import ReftestManifest dirs = set() for p in manifests: m = ReftestManifest() m.load(os.path.join(topsrcdir, p)) dirs |= m.dirs dirs = {mozpath.normpath(d[len(topsrcdir):]).lstrip('/') for d in dirs} # Filter out children captured by parent directories because duplicates # will confuse things later on. def parents(p): while True: p = mozpath.dirname(p) if not p: break yield p seen = set() for d in sorted(dirs, key=len): if not any(p in seen for p in parents(d)): seen.add(d) return sorted(seen)
def printTestDirs(topsrcdir, topmanifests): """Parse |topmanifests| and print a list of directories containing the tests within (and the manifests including those tests), relative to |topsrcdir|. """ topsrcdir = os.path.abspath(topsrcdir) dirs = set() for path in topmanifests: m = ReftestManifest() m.load(path) dirs |= m.dirs for d in sorted(dirs): d = d[len(topsrcdir):].replace('\\', '/').lstrip('/') print(d)
def find_manifest_dirs(topsrcdir, manifests): """Routine to retrieve directories specified in a manifest, relative to topsrcdir. It does not recurse into manifests, as we currently have no need for that. """ dirs = set() for p in manifests: p = os.path.join(topsrcdir, p) if p.endswith('.ini'): test_manifest = TestManifest() test_manifest.read(p) dirs |= set( [os.path.dirname(m) for m in test_manifest.manifests()]) elif p.endswith('.list'): m = ReftestManifest() m.load(p) dirs |= m.dirs else: raise Exception('"{}" is not a supported manifest format.'.format( os.path.splitext(p)[1])) dirs = {mozpath.normpath(d[len(topsrcdir):]).lstrip('/') for d in dirs} # Filter out children captured by parent directories because duplicates # will confuse things later on. def parents(p): while True: p = mozpath.dirname(p) if not p: break yield p seen = set() for d in sorted(dirs, key=len): if not any(p in seen for p in parents(d)): seen.add(d) return sorted(seen)
def find_manifest_dirs(topsrcdir, manifests): """Routine to retrieve directories specified in a manifest, relative to topsrcdir. It does not recurse into manifests, as we currently have no need for that. """ dirs = set() for p in manifests: p = os.path.join(topsrcdir, p) if p.endswith('.ini'): test_manifest = TestManifest() test_manifest.read(p) dirs |= set([os.path.dirname(m) for m in test_manifest.manifests()]) elif p.endswith('.list'): m = ReftestManifest() m.load(p) dirs |= m.dirs else: raise Exception('"{}" is not a supported manifest format.'.format( os.path.splitext(p)[1])) dirs = {mozpath.normpath(d[len(topsrcdir):]).lstrip('/') for d in dirs} # Filter out children captured by parent directories because duplicates # will confuse things later on. def parents(p): while True: p = mozpath.dirname(p) if not p: break yield p seen = set() for d in sorted(dirs, key=len): if not any(p in seen for p in parents(d)): seen.add(d) return sorted(seen)