summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/win/gyptest-link-aslr.py
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/win/gyptest-link-aslr.py')
-rw-r--r--third_party/python/gyp/test/win/gyptest-link-aslr.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/win/gyptest-link-aslr.py b/third_party/python/gyp/test/win/gyptest-link-aslr.py
new file mode 100644
index 0000000000..e765017d3b
--- /dev/null
+++ b/third_party/python/gyp/test/win/gyptest-link-aslr.py
@@ -0,0 +1,35 @@
+#!/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 sys
+
+if sys.platform == 'win32':
+ test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
+
+ CHDIR = 'linker-flags'
+ test.run_gyp('aslr.gyp', chdir=CHDIR)
+ test.build('aslr.gyp', test.ALL, chdir=CHDIR)
+
+ def HasDynamicBase(exe):
+ full_path = test.built_file_path(exe, chdir=CHDIR)
+ output = test.run_dumpbin('/headers', full_path)
+ return ' Dynamic base' in output
+
+ # Default is to be on.
+ if not HasDynamicBase('test_aslr_default.exe'):
+ test.fail_test()
+ if HasDynamicBase('test_aslr_no.exe'):
+ test.fail_test()
+ if not HasDynamicBase('test_aslr_yes.exe'):
+ test.fail_test()
+
+ test.pass_test()