Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/usr/bin/env python |
michael@0 | 2 | # Copyright (c) 2012 Google Inc. All rights reserved. |
michael@0 | 3 | # Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | # found in the LICENSE file. |
michael@0 | 5 | """ |
michael@0 | 6 | Verifies that make_global_settings can be used to override the |
michael@0 | 7 | compiler settings. |
michael@0 | 8 | """ |
michael@0 | 9 | |
michael@0 | 10 | import TestGyp |
michael@0 | 11 | import os |
michael@0 | 12 | import copy |
michael@0 | 13 | import sys |
michael@0 | 14 | from string import Template |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | if sys.platform == 'win32': |
michael@0 | 18 | # cross compiling not support by ninja on windows |
michael@0 | 19 | # and make not supported on windows at all. |
michael@0 | 20 | sys.exit(0) |
michael@0 | 21 | |
michael@0 | 22 | test = TestGyp.TestGyp(formats=['ninja', 'make']) |
michael@0 | 23 | |
michael@0 | 24 | gypfile = 'compiler-global-settings.gyp' |
michael@0 | 25 | |
michael@0 | 26 | replacements = { 'PYTHON': '/usr/bin/python', 'PWD': os.getcwd()} |
michael@0 | 27 | |
michael@0 | 28 | # Process the .in gyp file to produce the final gyp file |
michael@0 | 29 | # since we need to include absolute paths in the make_global_settings |
michael@0 | 30 | # section. |
michael@0 | 31 | replacements['TOOLSET'] = 'target' |
michael@0 | 32 | s = Template(open(gypfile + '.in').read()) |
michael@0 | 33 | output = open(gypfile, 'w') |
michael@0 | 34 | output.write(s.substitute(replacements)) |
michael@0 | 35 | output.close() |
michael@0 | 36 | |
michael@0 | 37 | test.run_gyp(gypfile) |
michael@0 | 38 | test.build(gypfile) |
michael@0 | 39 | test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'FOO']) |
michael@0 | 40 | |
michael@0 | 41 | # Same again but with the host toolset. |
michael@0 | 42 | replacements['TOOLSET'] = 'host' |
michael@0 | 43 | s = Template(open(gypfile + '.in').read()) |
michael@0 | 44 | output = open(gypfile, 'w') |
michael@0 | 45 | output.write(s.substitute(replacements)) |
michael@0 | 46 | output.close() |
michael@0 | 47 | |
michael@0 | 48 | test.run_gyp(gypfile) |
michael@0 | 49 | test.build(gypfile) |
michael@0 | 50 | test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'BAR']) |
michael@0 | 51 | |
michael@0 | 52 | test.pass_test() |