OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 7 """ |
| 8 Make sure msvs_large_pdb works correctly. |
| 9 """ |
| 10 |
| 11 import TestGyp |
| 12 |
| 13 import struct |
| 14 import sys |
| 15 |
| 16 |
| 17 CHDIR = 'large-pdb' |
| 18 |
| 19 |
| 20 def CheckImageAndPdb(test, image_basename, expected_page_size): |
| 21 pdb_basename = image_basename + '.pdb' |
| 22 test.built_file_must_exist(image_basename, chdir=CHDIR) |
| 23 test.built_file_must_exist(pdb_basename, chdir=CHDIR) |
| 24 |
| 25 # We expect the PDB to have the given page size. For full details of the |
| 26 # header look here: https://code.google.com/p/pdbparser/wiki/MSF_Format |
| 27 # We read the little-endian 4-byte unsigned integer at position 32 of the |
| 28 # file. |
| 29 pdb_path = test.built_file_path(pdb_basename, chdir=CHDIR) |
| 30 pdb_file = open(pdb_path, 'rb') |
| 31 pdb_file.seek(32, 0) |
| 32 page_size = struct.unpack('<I', pdb_file.read(4))[0] |
| 33 if page_size != expected_page_size: |
| 34 print "Expected page size of %d, got %d for PDB file `%s'." % ( |
| 35 expected_page_size, page_size, pdb_path) |
| 36 |
| 37 |
| 38 if sys.platform == 'win32': |
| 39 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
| 40 |
| 41 test.run_gyp('large-pdb.gyp', chdir=CHDIR) |
| 42 test.build('large-pdb.gyp', test.ALL, chdir=CHDIR) |
| 43 |
| 44 CheckImageAndPdb(test, 'large_pdb_exe.exe', 4096) |
| 45 CheckImageAndPdb(test, 'small_pdb_exe.exe', 1024) |
| 46 CheckImageAndPdb(test, 'large_pdb_dll.dll', 4096) |
| 47 CheckImageAndPdb(test, 'small_pdb_dll.dll', 1024) |
| 48 |
| 49 test.pass_test() |
OLD | NEW |