1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/imptests/writeBuildFiles.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 +# You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +from __future__ import unicode_literals 1.9 + 1.10 +import string 1.11 + 1.12 +manifest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT 1.13 +[DEFAULT] 1.14 +support-files = 1.15 +${supportfiles} 1.16 + 1.17 +${tests} 1.18 +""" 1.19 + 1.20 +reftest_template = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT 1.21 + 1.22 +${reftests} 1.23 +""" 1.24 + 1.25 + 1.26 + 1.27 +def substManifest(caller, test_files, support_files): 1.28 + test_files = [f.lstrip('/') for f in test_files] 1.29 + support_files = [f.lstrip('/') for f in support_files] 1.30 + 1.31 + return string.Template(manifest_template).substitute({ 1.32 + 'caller': caller, 1.33 + 'supportfiles': '\n'.join(' %s' % f for f in sorted(support_files)), 1.34 + 'tests': '\n'.join('[%s]' % f for f in sorted(test_files)) 1.35 + }) 1.36 + 1.37 + 1.38 +def substReftestList(caller, tests): 1.39 + def reftests(tests): 1.40 + return "\n".join(" ".join(line) for line in tests) 1.41 + 1.42 + return string.Template(reftest_template).substitute({ 1.43 + "caller": caller, 1.44 + "reftests": reftests(tests), 1.45 + }) 1.46 +