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

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

mercurial