michael@0: #!/usr/bin/env python michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: # michael@0: # Write a Mochitest manifest for WebGL conformance test files. michael@0: michael@0: import os michael@0: from itertools import chain michael@0: michael@0: CONFORMANCE_DIRS = [ michael@0: "conformance", michael@0: "resources", michael@0: ] michael@0: michael@0: def listfiles(dir, rel): michael@0: """List all files in dir recursively, yielding paths michael@0: relative to rel. michael@0: """ michael@0: for root, folders, files in os.walk(dir): michael@0: for f in files: michael@0: yield os.path.relpath(os.path.join(root, f), rel) michael@0: michael@0: def writemanifest(): michael@0: script_dir = os.path.dirname(__file__) michael@0: list_dirs = [os.path.join(script_dir, d) for d in CONFORMANCE_DIRS] michael@0: with open(os.path.join(script_dir, 'mochitest-conformance-files.ini'), 'w') as f: michael@0: f.write("""[DEFAULT] michael@0: support-files = michael@0: %s michael@0: """ % "\n ".join(sorted(chain.from_iterable(listfiles(d, script_dir) michael@0: for d in list_dirs)))) michael@0: michael@0: if __name__ == '__main__': michael@0: writemanifest() michael@0: