Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/make_global_settings/ar/gyptest-make_global_settings_ar.py

Issue 421453003: Add TestGypXcodeNinja to run tests against the xcode-ninja generator (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase onto origin/master Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2014 Google Inc. All rights reserved. 3 # Copyright (c) 2014 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 'AR' in make_global_settings. 8 Verifies 'AR' in 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 def resolve_path(test, path): 15 def resolve_path(test, path):
16 if path is None: 16 if path is None:
17 return None 17 return None
18 elif test.format == 'make': 18 elif test.format == 'make':
19 return '$(abspath %s)' % path 19 return '$(abspath %s)' % path
20 elif test.format == 'ninja': 20 elif test.format in ['ninja', 'xcode-ninja']:
21 return os.path.join('..', '..', path) 21 return os.path.join('..', '..', path)
22 else: 22 else:
23 test.fail_test() 23 test.fail_test()
24 24
25 25
26 def verify_ar_target(test, ar=None, rel_path=False): 26 def verify_ar_target(test, ar=None, rel_path=False):
27 if rel_path: 27 if rel_path:
28 ar_expected = resolve_path(test, ar) 28 ar_expected = resolve_path(test, ar)
29 else: 29 else:
30 ar_expected = ar 30 ar_expected = ar
31 # Resolve default values 31 # Resolve default values
32 if ar_expected is None: 32 if ar_expected is None:
33 if test.format == 'make': 33 if test.format == 'make':
34 # Make generator hasn't set the default value for AR. 34 # Make generator hasn't set the default value for AR.
35 # You can remove the following assertion as long as it doesn't 35 # You can remove the following assertion as long as it doesn't
36 # break existing projects. 36 # break existing projects.
37 test.must_not_contain('Makefile', 'AR ?= ') 37 test.must_not_contain('Makefile', 'AR ?= ')
38 return 38 return
39 elif test.format == 'ninja': 39 elif test.format in ['ninja', 'xcode-ninja']:
40 if sys.platform == 'win32': 40 if sys.platform == 'win32':
41 ar_expected = 'lib.exe' 41 ar_expected = 'lib.exe'
42 else: 42 else:
43 ar_expected = 'ar' 43 ar_expected = 'ar'
44 if test.format == 'make': 44 if test.format == 'make':
45 test.must_contain('Makefile', 'AR ?= %s' % ar_expected) 45 test.must_contain('Makefile', 'AR ?= %s' % ar_expected)
46 elif test.format == 'ninja': 46 elif test.format in ['ninja', 'xcode-ninja']:
47 test.must_contain('out/Default/build.ninja', 'ar = %s' % ar_expected) 47 test.must_contain('out/Default/build.ninja', 'ar = %s' % ar_expected)
48 else: 48 else:
49 test.fail_test() 49 test.fail_test()
50 50
51 51
52 def verify_ar_host(test, ar=None, rel_path=False): 52 def verify_ar_host(test, ar=None, rel_path=False):
53 if rel_path: 53 if rel_path:
54 ar_expected = resolve_path(test, ar) 54 ar_expected = resolve_path(test, ar)
55 else: 55 else:
56 ar_expected = ar 56 ar_expected = ar
57 # Resolve default values 57 # Resolve default values
58 if ar_expected is None: 58 if ar_expected is None:
59 ar_expected = 'ar' 59 ar_expected = 'ar'
60 if test.format == 'make': 60 if test.format == 'make':
61 test.must_contain('Makefile', 'AR.host ?= %s' % ar_expected) 61 test.must_contain('Makefile', 'AR.host ?= %s' % ar_expected)
62 elif test.format == 'ninja': 62 elif test.format in ['ninja', 'xcode-ninja']:
63 test.must_contain('out/Default/build.ninja', 'ar_host = %s' % ar_expected) 63 test.must_contain('out/Default/build.ninja', 'ar_host = %s' % ar_expected)
64 else: 64 else:
65 test.fail_test() 65 test.fail_test()
66 66
67 67
68 test_format = ['ninja'] 68 test_format = ['ninja']
69 if sys.platform in ('linux2', 'darwin'): 69 if sys.platform in ('linux2', 'darwin'):
70 test_format += ['make'] 70 test_format += ['make']
71 71
72 test = TestGyp.TestGyp(formats=test_format) 72 test = TestGyp.TestGyp(formats=test_format)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 # Test 'AR' in 'make_global_settings' with $AR_host environment variable. 115 # Test 'AR' in 'make_global_settings' with $AR_host environment variable.
116 with TestGyp.LocalEnv({'AR_host': 'my_ar_host3'}): 116 with TestGyp.LocalEnv({'AR_host': 'my_ar_host3'}):
117 test.run_gyp('make_global_settings_ar.gyp', 117 test.run_gyp('make_global_settings_ar.gyp',
118 '-Dcustom_ar_target=my_ar_target3') 118 '-Dcustom_ar_target=my_ar_target3')
119 verify_ar_target(test, ar='my_ar_target3', rel_path=True) 119 verify_ar_target(test, ar='my_ar_target3', rel_path=True)
120 verify_ar_host(test, ar='my_ar_host3', rel_path=False) 120 verify_ar_host(test, ar='my_ar_host3', rel_path=False)
121 121
122 122
123 test.pass_test() 123 test.pass_test()
OLDNEW
« no previous file with comments | « test/mac/gyptest-type-envvars.py ('k') | test/make_global_settings/full-toolchain/gyptest-make_global_settings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698