| Index: test/compiler-override/gyptest-compiler-global-settings.py
|
| diff --git a/test/compiler-override/gyptest-compiler-global-settings.py b/test/compiler-override/gyptest-compiler-global-settings.py
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..7e63bab8fc304747290d0aa669f478c2e1e1f8d7
|
| --- /dev/null
|
| +++ b/test/compiler-override/gyptest-compiler-global-settings.py
|
| @@ -0,0 +1,51 @@
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2012 Google Inc. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +"""
|
| +Verifies that make_global_settings can be used to override the
|
| +compiler settings.
|
| +"""
|
| +
|
| +import TestGyp
|
| +import os
|
| +import copy
|
| +import sys
|
| +from string import Template
|
| +
|
| +if sys.platform == 'win32':
|
| + formats = ['make']
|
| +else:
|
| + formats = ['ninja', 'make']
|
| +
|
| +test = TestGyp.TestGyp(formats=formats)
|
| +
|
| +gypfile = 'compiler-global-settings.gyp'
|
| +
|
| +replacements = { 'PYTHON': '/usr/bin/python', 'PWD': os.getcwd()}
|
| +
|
| +# Process the .in gyp file to produce the final gyp file
|
| +# since we need to include absolute paths in the make_global_settings
|
| +# section.
|
| +replacements['TOOLSET'] = 'target'
|
| +s = Template(open(gypfile + '.in').read())
|
| +output = open(gypfile, 'w')
|
| +output.write(s.substitute(replacements))
|
| +output.close()
|
| +
|
| +test.run_gyp(gypfile)
|
| +test.build(gypfile)
|
| +test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'FOO'])
|
| +
|
| +# Same again but with the host toolset.
|
| +replacements['TOOLSET'] = 'host'
|
| +s = Template(open(gypfile + '.in').read())
|
| +output = open(gypfile, 'w')
|
| +output.write(s.substitute(replacements))
|
| +output.close()
|
| +
|
| +test.run_gyp(gypfile)
|
| +test.build(gypfile)
|
| +test.must_contain_all_lines(test.stdout(), ['my_cc.py', 'my_cxx.py', 'BAR'])
|
| +
|
| +test.pass_test()
|
|
|