| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2013 Google Inc. All rights reserved. | 3 # Copyright (c) 2013 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 Verifies make_global_settings. | 8 Verifies make_global_settings. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 import TestGyp | 13 import TestGyp |
| 14 | 14 |
| 15 test_format = ['ninja'] | 15 test_format = ['ninja'] |
| 16 if sys.platform in ('linux2', 'darwin'): | 16 if sys.platform in ('linux2', 'darwin'): |
| 17 test_format += ['make'] | 17 test_format += ['make'] |
| 18 | 18 |
| 19 test = TestGyp.TestGyp(formats=test_format) | 19 test = TestGyp.TestGyp(formats=test_format) |
| 20 | 20 |
| 21 test.run_gyp('make_global_settings.gyp') | 21 test.run_gyp('make_global_settings.gyp') |
| 22 | 22 |
| 23 if test.format == 'make': | 23 if test.format == 'make': |
| 24 cc_expected = """ifneq (,$(filter $(origin CC), undefined default)) | 24 cc_expected = """ifneq (,$(filter $(origin CC), undefined default)) |
| 25 CC = $(abspath clang) | 25 CC = $(abspath clang) |
| 26 endif | 26 endif |
| 27 """ | 27 """ |
| 28 if sys.platform == 'linux2': | 28 if sys.platform == 'linux2': |
| 29 link_expected = """ | 29 link_expected = """ |
| 30 LINK ?= flock $(builddir)/linker.lock $(abspath clang) | 30 LINK ?= $(abspath clang) |
| 31 """ | 31 """ |
| 32 elif sys.platform == 'darwin': | 32 elif sys.platform == 'darwin': |
| 33 link_expected = """ | 33 link_expected = """ |
| 34 LINK ?= ./gyp-mac-tool flock $(builddir)/linker.lock $(abspath clang) | 34 LINK ?= $(abspath clang) |
| 35 """ | 35 """ |
| 36 test.must_contain('Makefile', cc_expected) | 36 test.must_contain('Makefile', cc_expected) |
| 37 test.must_contain('Makefile', link_expected) | 37 test.must_contain('Makefile', link_expected) |
| 38 if test.format == 'ninja': | 38 if test.format == 'ninja': |
| 39 cc_expected = 'cc = ' + os.path.join('..', '..', 'clang') | 39 cc_expected = 'cc = ' + os.path.join('..', '..', 'clang') |
| 40 ld_expected = 'ld = $cc' | 40 ld_expected = 'ld = $cc' |
| 41 if sys.platform == 'win32': | 41 if sys.platform == 'win32': |
| 42 ld_expected = 'link.exe' | 42 ld_expected = 'link.exe' |
| 43 test.must_contain('out/Default/build.ninja', cc_expected) | 43 test.must_contain('out/Default/build.ninja', cc_expected) |
| 44 test.must_contain('out/Default/build.ninja', ld_expected) | 44 test.must_contain('out/Default/build.ninja', ld_expected) |
| 45 | 45 |
| 46 test.pass_test() | 46 test.pass_test() |
| OLD | NEW |