initial import
[vuplus_webkit] / Source / ThirdParty / gyp / test / variants / gyptest-variants.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2009 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """
8 Verify handling of build variants.
9
10 TODO:  Right now, only the SCons generator supports this, so the
11 test case is SCons-specific.  In particular, it relise on SCons'
12 ability to rebuild in response to changes on the command line.  It
13 may be simpler to just drop this feature if the other generators
14 can't be made to behave the same way.
15 """
16
17 import TestGyp
18
19 test = TestGyp.TestGyp(formats=['scons'])
20
21 test.run_gyp('variants.gyp', chdir='src')
22
23 test.relocate('src', 'relocate/src')
24
25 test.build('variants.gyp', chdir='relocate/src')
26
27 test.run_built_executable('variants',
28                           chdir='relocate/src',
29                           stdout="Hello, world!\n")
30
31 test.sleep()
32 test.build('variants.gyp', 'VARIANT1=1', chdir='relocate/src')
33
34 test.run_built_executable('variants',
35                           chdir='relocate/src',
36                           stdout="Hello from VARIANT1\n")
37
38 test.sleep()
39 test.build('variants.gyp', 'VARIANT2=1', chdir='relocate/src')
40
41 test.run_built_executable('variants',
42                           chdir='relocate/src',
43                           stdout="Hello from VARIANT2\n")
44
45 test.pass_test()