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

Unified Diff: test/win/gyptest-link_additional_options.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_additional_options.py
diff --git a/test/win/gyptest-link_additional_options.py b/test/win/gyptest-link_additional_options.py
new file mode 100644
index 0000000000000000000000000000000000000000..d1f0c88bc78a3512d85939d7b978982f456db401
--- /dev/null
+++ b/test/win/gyptest-link_additional_options.py
@@ -0,0 +1,61 @@
+#!/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 additional options are handled.
+"""
+
+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('additional-options.gyp', chdir=CHDIR)
+ test.build('additional-options.gyp', test.ALL, chdir=CHDIR)
+
+ # Confirm /safeseh made it to the final binary
+ exe_path = test.built_file_path('test_additional_few.exe', chdir=CHDIR)
+ pe = pefile.PE(exe_path, fast_load=True)
+ pe.parse_data_directories(directories=[
+ pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG']])
+ NO_SEH_FLAG = 0x0400
+ MACHINE_TYPE_AMD64 = 0x8664
+ if (pe.OPTIONAL_HEADER.DllCharacteristics & NO_SEH_FLAG or
+ (hasattr(pe, "DIRECTORY_ENTRY_LOAD_CONFIG") and
+ pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerCount > 0 and
+ pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerTable != 0) or
+ pe.FILE_HEADER.Machine == MACHINE_TYPE_AMD64):
+ pass
+ else:
+ print 'No /SAFESEH flag on %s.' % exe_path
+ test.fail_test()
+
+
+ if test.format == 'ninja':
+ ninja_file = test.built_file_path('obj/test_additional_none.ninja',
+ chdir=CHDIR)
+ # Just generates OK
+
+ ninja_file = test.built_file_path('obj/test_additional_few.ninja',
+ chdir=CHDIR)
+ test.must_contain(ninja_file, '/safeseh')
+ test.must_contain(ninja_file, '/ignore:4199')
+
+ test.pass_test()

Powered by Google App Engine
This is Rietveld 408576698