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

Side by Side Diff: test/win/gyptest-link_aslr.py

Issue 9443044: Beginnings of some msvs_... emulation (windows ninja) (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: better place for normpath to remove need for $!-no-escape Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 # Copyright (c) 2012 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 aslr setting is extracted properly.
9 """
10
11 import TestGyp
12
13 import os
14 import subprocess
15 import sys
16
17 # Find /third_party/pefile based on current directory and script path.
18 sys.path.append(os.path.join(
19 os.path.dirname(__file__), '..', '..', '..', '..', 'third_party', 'pefile'))
20 sys.path.append(os.path.join(
21 os.path.dirname(__file__), '..', '..', '..', '..', '..',
22 'third_party', 'pefile'))
23 import pefile
24
25 if sys.platform == 'win32':
26 test = TestGyp.TestGyp(formats=['ninja', 'msvs'])
27
28 CHDIR = 'linker_flags'
29 test.run_gyp('aslr.gyp', chdir=CHDIR)
30 test.build('aslr.gyp', test.ALL, chdir=CHDIR)
31
32 exe_path = test.built_file_path('test_aslr_yes.exe', chdir=CHDIR)
33 pe = pefile.PE(exe_path, fast_load=True)
34 pe.parse_data_directories(directories=[
35 pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG']])
36 DYNAMICBASE_FLAG = 0x0040
37 if not (pe.OPTIONAL_HEADER.DllCharacteristics & DYNAMICBASE_FLAG):
38 print 'DYNAMICBASE not found.'
39 test.fail_test()
40
41
42 if test.format == 'ninja':
43 ninja_file = test.built_file_path('obj/test_aslr_default.ninja',
44 chdir=CHDIR)
45 test.must_not_contain(ninja_file, '/DYNAMICBASE')
46
47 ninja_file = test.built_file_path('obj/test_aslr_no.ninja', chdir=CHDIR)
48 test.must_contain(ninja_file, '/DYNAMICBASE:NO')
49
50 ninja_file = test.built_file_path('obj/test_aslr_yes.ninja', chdir=CHDIR)
51 test.must_contain(ninja_file, '/DYNAMICBASE')
52 test.must_not_contain(ninja_file, '/DYNAMICBASE:NO')
53
54 test.pass_test()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698