1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/test/webgl-conformance/writemanifest.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +#!/usr/bin/env python 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 +# 1.10 +# Write a Mochitest manifest for WebGL conformance test files. 1.11 + 1.12 +import os 1.13 +from itertools import chain 1.14 + 1.15 +CONFORMANCE_DIRS = [ 1.16 + "conformance", 1.17 + "resources", 1.18 +] 1.19 + 1.20 +def listfiles(dir, rel): 1.21 + """List all files in dir recursively, yielding paths 1.22 + relative to rel. 1.23 + """ 1.24 + for root, folders, files in os.walk(dir): 1.25 + for f in files: 1.26 + yield os.path.relpath(os.path.join(root, f), rel) 1.27 + 1.28 +def writemanifest(): 1.29 + script_dir = os.path.dirname(__file__) 1.30 + list_dirs = [os.path.join(script_dir, d) for d in CONFORMANCE_DIRS] 1.31 + with open(os.path.join(script_dir, 'mochitest-conformance-files.ini'), 'w') as f: 1.32 + f.write("""[DEFAULT] 1.33 +support-files = 1.34 + %s 1.35 +""" % "\n ".join(sorted(chain.from_iterable(listfiles(d, script_dir) 1.36 + for d in list_dirs)))) 1.37 + 1.38 +if __name__ == '__main__': 1.39 + writemanifest() 1.40 +