content/canvas/test/webgl-conformance/writemanifest.py

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #!/usr/bin/env python
     2 #
     3 # This Source Code Form is subject to the terms of the Mozilla Public
     4 # License, v. 2.0. If a copy of the MPL was not distributed with this
     5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6 #
     7 # Write a Mochitest manifest for WebGL conformance test files.
     9 import os
    10 from itertools import chain
    12 CONFORMANCE_DIRS = [
    13     "conformance",
    14     "resources",
    15 ]
    17 def listfiles(dir, rel):
    18     """List all files in dir recursively, yielding paths
    19     relative to rel.
    20     """
    21     for root, folders, files in os.walk(dir):
    22         for f in files:
    23             yield os.path.relpath(os.path.join(root, f), rel)
    25 def writemanifest():
    26     script_dir = os.path.dirname(__file__)
    27     list_dirs = [os.path.join(script_dir, d) for d in CONFORMANCE_DIRS]
    28     with open(os.path.join(script_dir, 'mochitest-conformance-files.ini'), 'w') as f:
    29         f.write("""[DEFAULT]
    30 support-files =
    31   %s
    32 """ % "\n  ".join(sorted(chain.from_iterable(listfiles(d, script_dir)
    33                                              for d in list_dirs))))
    35 if __name__ == '__main__':
    36     writemanifest()

mercurial