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

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

Issue 336953002: Revise unittest for 'AR' in 'make_global_settings' (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if test.format == 'make': 59 ar_expected = 'ar'
60 ar_expected = '$(AR)'
61 elif test.format == 'ninja':
62 if sys.platform == 'win32':
63 # TODO(yukawa): Make sure if this is an expected result or not.
64 ar_expected = 'ar'
65 else:
66 ar_expected = '$ar'
67 if test.format == 'make': 60 if test.format == 'make':
68 test.must_contain('Makefile', 'AR.host ?= %s' % ar_expected) 61 test.must_contain('Makefile', 'AR.host ?= %s' % ar_expected)
69 elif test.format == 'ninja': 62 elif test.format == 'ninja':
70 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)
71 else: 64 else:
72 test.fail_test() 65 test.fail_test()
73 66
74 67
75 test_format = ['ninja'] 68 test_format = ['ninja']
76 if sys.platform in ('linux2', 'darwin'): 69 if sys.platform in ('linux2', 'darwin'):
77 test_format += ['make'] 70 test_format += ['make']
78 71
79 test = TestGyp.TestGyp(formats=test_format) 72 test = TestGyp.TestGyp(formats=test_format)
80 73
81 # Check default values 74 # Check default values
82 test.run_gyp('make_global_settings_ar.gyp') 75 test.run_gyp('make_global_settings_ar.gyp')
83 verify_ar_target(test) 76 verify_ar_target(test)
84 77
85 78
79 # Check default values with GYP_CROSSCOMPILE enabled.
80 with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
81 test.run_gyp('make_global_settings_ar.gyp')
82 verify_ar_target(test)
83 verify_ar_host(test)
84
85
86 # Test 'AR' in 'make_global_settings'. 86 # Test 'AR' in 'make_global_settings'.
87 test.run_gyp('make_global_settings_ar.gyp', '-Dcustom_ar_target=my_ar') 87 with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
88 test.run_gyp('make_global_settings_ar.gyp', '-Dcustom_ar_target=my_ar')
88 verify_ar_target(test, ar='my_ar', rel_path=True) 89 verify_ar_target(test, ar='my_ar', rel_path=True)
89 90
90 91
91 # Test 'AR'/'AR.host' in 'make_global_settings'. 92 # Test 'AR'/'AR.host' in 'make_global_settings'.
92 test.run_gyp('make_global_settings_ar.gyp', 93 with TestGyp.LocalEnv({'GYP_CROSSCOMPILE': '1'}):
93 '-Dcustom_ar_target=my_ar_target1', 94 test.run_gyp('make_global_settings_ar.gyp',
94 '-Dcustom_ar_host=my_ar_host1') 95 '-Dcustom_ar_target=my_ar_target1',
96 '-Dcustom_ar_host=my_ar_host1')
95 verify_ar_target(test, ar='my_ar_target1', rel_path=True) 97 verify_ar_target(test, ar='my_ar_target1', rel_path=True)
96 # TODO(yukawa): Support 'AR.host' in Ninja generator 98 # TODO(yukawa): Support 'AR.host' in Ninja generator
97 if test.format == 'make': 99 if test.format == 'make':
98 verify_ar_host(test, ar='my_ar_host1', rel_path=True) 100 verify_ar_host(test, ar='my_ar_host1', rel_path=True)
99 101
100 102
101 # Test $AR and $AR_host environment variables. 103 # Test $AR and $AR_host environment variables.
102 with TestGyp.LocalEnv({'AR': 'my_ar_target2', 104 with TestGyp.LocalEnv({'AR': 'my_ar_target2',
103 'AR_host': 'my_ar_host2'}): 105 'AR_host': 'my_ar_host2'}):
104 test.run_gyp('make_global_settings_ar.gyp') 106 test.run_gyp('make_global_settings_ar.gyp')
105 # Ninja generator resolves $AR in gyp phase. Make generator doesn't. 107 # Ninja generator resolves $AR in gyp phase. Make generator doesn't.
106 if test.format == 'ninja': 108 if test.format == 'ninja':
107 if sys.platform == 'win32': 109 if sys.platform == 'win32':
108 # TODO(yukawa): Make sure if this is an expected result or not. 110 # TODO(yukawa): Make sure if this is an expected result or not.
109 verify_ar_target(test, ar='lib.exe', rel_path=False) 111 verify_ar_target(test, ar='lib.exe', rel_path=False)
110 else: 112 else:
111 verify_ar_target(test, ar='my_ar_target2', rel_path=False) 113 verify_ar_target(test, ar='my_ar_target2', rel_path=False)
112 verify_ar_host(test, ar='my_ar_host2', rel_path=False) 114 verify_ar_host(test, ar='my_ar_host2', rel_path=False)
113 115
114 116
115 # Test 'AR' in 'make_global_settings' with $AR_host environment variable. 117 # Test 'AR' in 'make_global_settings' with $AR_host environment variable.
116 with TestGyp.LocalEnv({'AR_host': 'my_ar_host3'}): 118 with TestGyp.LocalEnv({'AR_host': 'my_ar_host3'}):
117 test.run_gyp('make_global_settings_ar.gyp', 119 test.run_gyp('make_global_settings_ar.gyp',
118 '-Dcustom_ar_target=my_ar_target3') 120 '-Dcustom_ar_target=my_ar_target3')
119 verify_ar_target(test, ar='my_ar_target3', rel_path=True) 121 verify_ar_target(test, ar='my_ar_target3', rel_path=True)
120 verify_ar_host(test, ar='my_ar_host3', rel_path=False) 122 verify_ar_host(test, ar='my_ar_host3', rel_path=False)
121 123
122 124
123 test.pass_test() 125 test.pass_test()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698