summaryrefslogtreecommitdiffstats
path: root/media/webrtc/trunk/tools/gyp/test/cxxflags/gyptest-cxxflags.py
blob: 117a1800de49d3202a0244a9822140c80585940d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/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 the use of the environment during regeneration when the gyp file
changes, specifically via build of an executable with C++ flags specified by
CXXFLAGS.

In this test, gyp happens within a local environment, but build outside of it.
"""

import TestGyp

FORMATS = ('ninja',)

test = TestGyp.TestGyp(formats=FORMATS)

# We reset the environ after calling gyp. When the auto-regeneration happens,
# the same define should be reused anyway.
with TestGyp.LocalEnv({'CXXFLAGS': ''}):
  test.run_gyp('cxxflags.gyp')

test.build('cxxflags.gyp')

expect = """\
No define
"""
test.run_built_executable('cxxflags', stdout=expect)

test.sleep()

with TestGyp.LocalEnv({'CXXFLAGS': '-DABC'}):
  test.run_gyp('cxxflags.gyp')

test.build('cxxflags.gyp')

expect = """\
With define
"""
test.run_built_executable('cxxflags', stdout=expect)

test.pass_test()