OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 # Copyright (c) 2015 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 StackReserveSize and StackCommitSize settings are extracted properly. |
| 9 """ |
| 10 |
| 11 import TestGyp |
| 12 |
| 13 import sys |
| 14 |
| 15 if sys.platform == 'win32': |
| 16 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
| 17 |
| 18 CHDIR = 'linker-flags' |
| 19 test.run_gyp('stacksize.gyp', chdir=CHDIR) |
| 20 test.build('stacksize.gyp', test.ALL, chdir=CHDIR) |
| 21 |
| 22 def GetHeaders(exe): |
| 23 return test.run_dumpbin('/headers', test.built_file_path(exe, chdir=CHDIR)) |
| 24 |
| 25 # Verify default sizes as reported by dumpbin: |
| 26 # 100000h = 1MB |
| 27 # 1000h = 4KB |
| 28 default_headers = GetHeaders('test_default.exe') |
| 29 if '100000 size of stack reserve' not in default_headers: |
| 30 test.fail_test() |
| 31 if '1000 size of stack commit' not in default_headers: |
| 32 test.fail_test() |
| 33 |
| 34 # Verify that reserved size is changed, but commit size is unchanged: |
| 35 # 200000h = 2MB |
| 36 # 1000h = 4KB |
| 37 set_reserved_size_headers = GetHeaders('test_set_reserved_size.exe') |
| 38 if '200000 size of stack reserve' not in set_reserved_size_headers: |
| 39 test.fail_test() |
| 40 if '1000 size of stack commit' not in set_reserved_size_headers: |
| 41 test.fail_test() |
| 42 |
| 43 # Verify that setting the commit size, without the reserve size, has no |
| 44 # effect: |
| 45 # 100000h = 1MB |
| 46 # 1000h = 4KB |
| 47 set_commit_size_headers = GetHeaders('test_set_commit_size.exe') |
| 48 if '100000 size of stack reserve' not in set_commit_size_headers: |
| 49 test.fail_test() |
| 50 if '1000 size of stack commit' not in set_commit_size_headers: |
| 51 test.fail_test() |
| 52 |
| 53 # Verify that setting both works: |
| 54 # 200000h = 2MB |
| 55 # 2000h = 8KB |
| 56 set_both_headers = GetHeaders('test_set_both.exe') |
| 57 if '200000 size of stack reserve' not in set_both_headers: |
| 58 test.fail_test() |
| 59 if '2000 size of stack commit' not in set_both_headers: |
| 60 test.fail_test() |
| 61 |
| 62 test.pass_test() |
OLD | NEW |