layout/tools/reftest/print-manifest-dirs.py
author Gregory Szorc <gps@mozilla.com>
Tue, 17 Jun 2014 17:37:09 -0700
changeset 210618 ab997ac497a0bb14d6d91cddce91085a13275431
parent 123455 febc983734f78e05d0fe287cbe22ed7396f2e0cc
permissions -rw-r--r--
Bug 1027215 - Rewrite print-manifest-dirs.py to use new manifest parser; r=roc Now that we've established a slightly better Python reftest manifest parser, switch the existing manifest parsing code in print-manifest-dirs.py to use it.

#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import sys
from reftest import ReftestManifest

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)

if __name__ == '__main__':
    if len(sys.argv) < 3:
      print >>sys.stderr, "Usage: %s topsrcdir reftest.list [reftest.list]*" % sys.argv[0]
      sys.exit(1)
    printTestDirs(sys.argv[1], sys.argv[2:])