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

Side by Side Diff: test/win/gyptest-cl-function-level-linking.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 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 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 Make sure function-level linking setting is extracted properly. 8 Make sure function-level linking setting is extracted properly.
9 """ 9 """
10 10
11 from __future__ import print_function
12
11 import TestGyp 13 import TestGyp
12 14
13 import sys 15 import sys
14 16
15 if sys.platform == 'win32': 17 if sys.platform == 'win32':
16 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) 18 test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
17 19
18 CHDIR = 'compiler-flags' 20 CHDIR = 'compiler-flags'
19 test.run_gyp('function-level-linking.gyp', chdir=CHDIR) 21 test.run_gyp('function-level-linking.gyp', chdir=CHDIR)
20 test.build('function-level-linking.gyp', test.ALL, chdir=CHDIR) 22 test.build('function-level-linking.gyp', test.ALL, chdir=CHDIR)
21 23
22 def CheckForSectionString(binary, search_for, should_exist): 24 def CheckForSectionString(binary, search_for, should_exist):
23 output = test.run_dumpbin('/headers', binary) 25 output = test.run_dumpbin('/headers', binary)
24 if should_exist and search_for not in output: 26 if should_exist and search_for not in output:
25 print 'Did not find "%s" in %s' % (search_for, binary) 27 print('Did not find "%s" in %s' % (search_for, binary))
26 test.fail_test() 28 test.fail_test()
27 elif not should_exist and search_for in output: 29 elif not should_exist and search_for in output:
28 print 'Found "%s" in %s (and shouldn\'t have)' % (search_for, binary) 30 print('Found "%s" in %s (and shouldn\'t have)' % (search_for, binary))
29 test.fail_test() 31 test.fail_test()
30 32
31 def Object(proj, obj): 33 def Object(proj, obj):
32 sep = '.' if test.format == 'ninja' else '\\' 34 sep = '.' if test.format == 'ninja' else '\\'
33 return 'obj\\%s%s%s' % (proj, sep, obj) 35 return 'obj\\%s%s%s' % (proj, sep, obj)
34 36
35 look_for = '''COMDAT; sym= "int __cdecl comdat_function''' 37 look_for = '''COMDAT; sym= "int __cdecl comdat_function'''
36 38
37 # When function level linking is on, the functions should be listed as 39 # When function level linking is on, the functions should be listed as
38 # separate comdat entries. 40 # separate comdat entries.
39 41
40 CheckForSectionString( 42 CheckForSectionString(
41 test.built_file_path(Object('test_fll_on', 'function-level-linking.obj'), 43 test.built_file_path(Object('test_fll_on', 'function-level-linking.obj'),
42 chdir=CHDIR), 44 chdir=CHDIR),
43 look_for, 45 look_for,
44 should_exist=True) 46 should_exist=True)
45 47
46 CheckForSectionString( 48 CheckForSectionString(
47 test.built_file_path(Object('test_fll_off', 'function-level-linking.obj'), 49 test.built_file_path(Object('test_fll_off', 'function-level-linking.obj'),
48 chdir=CHDIR), 50 chdir=CHDIR),
49 look_for, 51 look_for,
50 should_exist=False) 52 should_exist=False)
51 53
52 test.pass_test() 54 test.pass_test()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698