OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 | |
3 # Copyright (c) 2014 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 safeseh setting is extracted properly. | |
9 """ | |
10 | |
11 import TestGyp | |
12 | |
13 import sys | |
14 | |
15 if sys.platform == 'win32': | |
16 test = TestGyp.TestGyp(formats=['ninja']) | |
wtc
2014/04/10 22:21:43
If I add the 'msvs' format here, the test emits th
scottmg
2014/04/10 22:57:08
OK, I've probably led you astray then, or somethin
| |
17 | |
18 CHDIR = 'linker-flags' | |
19 test.run_gyp('safeseh.gyp', chdir=CHDIR) | |
20 test.build('safeseh.gyp', test.ALL, chdir=CHDIR) | |
21 | |
22 def HasSafeExceptionHandlers(exe): | |
23 full_path = test.built_file_path(exe, chdir=CHDIR) | |
24 output = test.run_dumpbin('/LOADCONFIG', full_path) | |
wtc
2014/04/10 22:21:43
The dumpbin flag is /LOADCONFIG:
$ dumpbin -loadc
| |
25 return ' Safe Exception Handler Table' in output | |
wtc
2014/04/10 22:21:43
Should I insist on the leading spaces? I am imitat
| |
26 | |
27 # From MSDN: http://msdn.microsoft.com/en-us/library/9a89h429.aspx | |
28 # If /SAFESEH is not specified, the linker will produce an image with a | |
29 # table of safe exceptions handlers if all modules are compatible with | |
30 # the safe exception handling feature. If any modules were not | |
31 # compatible with safe exception handling feature, the resulting image | |
32 # will not contain a table of safe exception handlers. | |
33 if HasSafeExceptionHandlers('test_safeseh_default.exe'): | |
34 test.fail_test() | |
35 if HasSafeExceptionHandlers('test_safeseh_no.exe'): | |
36 test.fail_test() | |
37 if not HasSafeExceptionHandlers('test_safeseh_yes.exe'): | |
38 test.fail_test() | |
39 | |
40 test.pass_test() | |
OLD | NEW |