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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: test/win/gyptest-link_aslr.py
diff --git a/test/win/gyptest-link_aslr.py b/test/win/gyptest-link_aslr.py
new file mode 100644
index 0000000000000000000000000000000000000000..138e97a7d4df092dce3a698ac175b77a1a0cecd2
--- /dev/null
+++ b/test/win/gyptest-link_aslr.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Make sure aslr setting is extracted properly.
+"""
+
+import TestGyp
+
+import os
+import subprocess
+import sys
+
+# Find /third_party/pefile based on current directory and script path.
+sys.path.append(os.path.join(
+ os.path.dirname(__file__), '..', '..', '..', '..', 'third_party', 'pefile'))
+sys.path.append(os.path.join(
+ os.path.dirname(__file__), '..', '..', '..', '..', '..',
+ 'third_party', 'pefile'))
+import pefile
+
+if sys.platform == 'win32':
+ test = TestGyp.TestGyp(formats=['ninja', 'msvs'])
+
+ CHDIR = 'linker_flags'
+ test.run_gyp('aslr.gyp', chdir=CHDIR)
+ test.build('aslr.gyp', test.ALL, chdir=CHDIR)
+
+ exe_path = test.built_file_path('test_aslr_yes.exe', chdir=CHDIR)
+ pe = pefile.PE(exe_path, fast_load=True)
+ pe.parse_data_directories(directories=[
+ pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG']])
+ DYNAMICBASE_FLAG = 0x0040
+ if not (pe.OPTIONAL_HEADER.DllCharacteristics & DYNAMICBASE_FLAG):
+ print 'DYNAMICBASE not found.'
+ test.fail_test()
+
+
+ if test.format == 'ninja':
+ ninja_file = test.built_file_path('obj/test_aslr_default.ninja',
+ chdir=CHDIR)
+ test.must_not_contain(ninja_file, '/DYNAMICBASE')
+
+ ninja_file = test.built_file_path('obj/test_aslr_no.ninja', chdir=CHDIR)
+ test.must_contain(ninja_file, '/DYNAMICBASE:NO')
+
+ ninja_file = test.built_file_path('obj/test_aslr_yes.ninja', chdir=CHDIR)
+ test.must_contain(ninja_file, '/DYNAMICBASE')
+ test.must_not_contain(ninja_file, '/DYNAMICBASE:NO')
+
+ test.pass_test()

Powered by Google App Engine
This is Rietveld 408576698