|
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. |
|
8 |
|
9 import os |
|
10 from itertools import chain |
|
11 |
|
12 CONFORMANCE_DIRS = [ |
|
13 "conformance", |
|
14 "resources", |
|
15 ] |
|
16 |
|
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) |
|
24 |
|
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)))) |
|
34 |
|
35 if __name__ == '__main__': |
|
36 writemanifest() |
|
37 |