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

Side by Side Diff: test/win/gyptest-link-large-pdb.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) 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 Make sure msvs_large_pdb works correctly. 8 Make sure msvs_large_pdb works correctly.
9 """ 9 """
10 10
11 from __future__ import print_function
12
11 import TestGyp 13 import TestGyp
12 14
13 import struct 15 import struct
14 import sys 16 import sys
15 17
16 if sys.platform == 'win32': 18 if sys.platform == 'win32':
17 print "This test is currently disabled: https://crbug.com/483696." 19 print("This test is currently disabled: https://crbug.com/483696.")
18 sys.exit(0) 20 sys.exit(0)
19 21
20 22
21 CHDIR = 'large-pdb' 23 CHDIR = 'large-pdb'
22 24
23 25
24 def CheckImageAndPdb(test, image_basename, expected_page_size, 26 def CheckImageAndPdb(test, image_basename, expected_page_size,
25 pdb_basename=None): 27 pdb_basename=None):
26 if not pdb_basename: 28 if not pdb_basename:
27 pdb_basename = image_basename + '.pdb' 29 pdb_basename = image_basename + '.pdb'
28 test.built_file_must_exist(image_basename, chdir=CHDIR) 30 test.built_file_must_exist(image_basename, chdir=CHDIR)
29 test.built_file_must_exist(pdb_basename, chdir=CHDIR) 31 test.built_file_must_exist(pdb_basename, chdir=CHDIR)
30 32
31 # We expect the PDB to have the given page size. For full details of the 33 # We expect the PDB to have the given page size. For full details of the
32 # header look here: https://code.google.com/p/pdbparser/wiki/MSF_Format 34 # header look here: https://code.google.com/p/pdbparser/wiki/MSF_Format
33 # We read the little-endian 4-byte unsigned integer at position 32 of the 35 # We read the little-endian 4-byte unsigned integer at position 32 of the
34 # file. 36 # file.
35 pdb_path = test.built_file_path(pdb_basename, chdir=CHDIR) 37 pdb_path = test.built_file_path(pdb_basename, chdir=CHDIR)
36 pdb_file = open(pdb_path, 'rb') 38 pdb_file = open(pdb_path, 'rb')
37 pdb_file.seek(32, 0) 39 pdb_file.seek(32, 0)
38 page_size = struct.unpack('<I', pdb_file.read(4))[0] 40 page_size = struct.unpack('<I', pdb_file.read(4))[0]
39 if page_size != expected_page_size: 41 if page_size != expected_page_size:
40 print "Expected page size of %d, got %d for PDB file `%s'." % ( 42 print("Expected page size of %d, got %d for PDB file `%s'." % (
41 expected_page_size, page_size, pdb_path) 43 expected_page_size, page_size, pdb_path))
42 44
43 45
44 if sys.platform == 'win32': 46 if sys.platform == 'win32':
45 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) 47 test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
46 48
47 test.run_gyp('large-pdb.gyp', chdir=CHDIR) 49 test.run_gyp('large-pdb.gyp', chdir=CHDIR)
48 50
49 test.build('large-pdb.gyp', 'large_pdb_exe', chdir=CHDIR) 51 test.build('large-pdb.gyp', 'large_pdb_exe', chdir=CHDIR)
50 CheckImageAndPdb(test, 'large_pdb_exe.exe', 4096) 52 CheckImageAndPdb(test, 'large_pdb_exe.exe', 4096)
51 53
(...skipping 13 matching lines...) Expand all
65 # 'msvs_large_pdb_path' variable. 67 # 'msvs_large_pdb_path' variable.
66 test.build('large-pdb.gyp', 'large_pdb_variable_exe', chdir=CHDIR) 68 test.build('large-pdb.gyp', 'large_pdb_variable_exe', chdir=CHDIR)
67 CheckImageAndPdb(test, 'large_pdb_variable_exe.exe', 4096, 69 CheckImageAndPdb(test, 'large_pdb_variable_exe.exe', 4096,
68 pdb_basename='foo.pdb') 70 pdb_basename='foo.pdb')
69 71
70 # This target has a different output name because it uses 'product_name'. 72 # This target has a different output name because it uses 'product_name'.
71 test.build('large-pdb.gyp', 'large_pdb_product_exe', chdir=CHDIR) 73 test.build('large-pdb.gyp', 'large_pdb_product_exe', chdir=CHDIR)
72 CheckImageAndPdb(test, 'bar.exe', 4096) 74 CheckImageAndPdb(test, 'bar.exe', 4096)
73 75
74 test.pass_test() 76 test.pass_test()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698