blob: 67735cce6a872bad15bee733263434e41540ea75 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001#!/usr/bin/env python
2
3# Copyright (c) 2012 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"""
8Verifies that when multiple values are supplied for a gyp define, the last one
9is used.
10"""
11
12import os
13import TestGyp
14
15test = TestGyp.TestGyp()
16
17os.environ['GYP_DEFINES'] = 'key=value1 key=value2 key=value3'
18test.run_gyp('defines.gyp')
19
20test.build('defines.gyp')
21test.must_contain('action.txt', 'value3')
22
23# The last occurrence of a repeated set should take precedence over other
24# values.
25os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value'
26test.run_gyp('defines.gyp')
27
28if test.format == 'msvs' and not test.uses_msbuild:
29 # msvs versions before 2010 don't detect build rule changes not reflected
30 # in file system timestamps. Rebuild to see differences.
31 test.build('defines.gyp', rebuild=True)
32else:
33 test.build('defines.gyp')
34test.must_contain('action.txt', 'repeated_value')
35
36test.pass_test()