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