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 CheckExeAndPdb(test, target_name, expected_page_size): |
| 21 exe_basename = target_name + '.exe' |
| 22 pdb_basename = exe_basename + '.pdb' |
| 23 test.built_file_must_exist(exe_basename, chdir=CHDIR) |
| 24 test.built_file_must_exist(pdb_basename, chdir=CHDIR) |
| 25 |
| 26 # We expect the PDB to have the given page size. For full details of the |
| 27 # header look here: https://code.google.com/p/pdbparser/wiki/MSF_Format |
| 28 # We read the little-endian 4-byte unsigned integer at position 32 of the |
| 29 # file. |
| 30 pdb_path = test.built_file_path(pdb_basename, chdir=CHDIR) |
| 31 pdb_file = open(pdb_path, 'rb') |
| 32 pdb_file.seek(32, 0) |
| 33 page_size = struct.unpack('<I', pdb_file.read(4))[0] |
| 34 if page_size != expected_page_size: |
| 35 print "Expected page size of %d, got %d for PDB file `%s'." % ( |
| 36 expected_page_size, page_size, pdb_path) |
| 37 |
| 38 |
| 39 if sys.platform == 'win32': |
| 40 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
| 41 |
| 42 test.run_gyp('large-pdb.gyp', chdir=CHDIR) |
| 43 test.build('large-pdb.gyp', test.ALL, chdir=CHDIR) |
| 44 |
| 45 CheckExeAndPdb(test, 'large_pdb', 4096) |
| 46 CheckExeAndPdb(test, 'small_pdb', 1024) |
| 47 |
| 48 test.pass_test() |
OLD | NEW |