summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/win/gyptest-link-base-address.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/python/gyp/test/win/gyptest-link-base-address.py
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/gyp/test/win/gyptest-link-base-address.py')
-rw-r--r--third_party/python/gyp/test/win/gyptest-link-base-address.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/win/gyptest-link-base-address.py b/third_party/python/gyp/test/win/gyptest-link-base-address.py
new file mode 100644
index 0000000000..d58527ad7e
--- /dev/null
+++ b/third_party/python/gyp/test/win/gyptest-link-base-address.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2013 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 the base address setting is extracted properly.
+"""
+
+import TestGyp
+
+import re
+import sys
+
+if sys.platform == 'win32':
+ test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
+
+ CHDIR = 'linker-flags'
+ test.run_gyp('base-address.gyp', chdir=CHDIR)
+ test.build('base-address.gyp', test.ALL, chdir=CHDIR)
+
+ def GetHeaders(exe):
+ full_path = test.built_file_path(exe, chdir=CHDIR)
+ return test.run_dumpbin('/headers', full_path)
+
+ # Extract the image base address from the headers output.
+ image_base_reg_ex = re.compile(r'.*\s+([0-9]+) image base.*', re.DOTALL)
+
+ exe_headers = GetHeaders('test_base_specified_exe.exe')
+ exe_match = image_base_reg_ex.match(exe_headers)
+
+ if not exe_match or not exe_match.group(1):
+ test.fail_test()
+ if exe_match.group(1) != '420000':
+ test.fail_test()
+
+ dll_headers = GetHeaders('test_base_specified_dll.dll')
+ dll_match = image_base_reg_ex.match(dll_headers)
+
+ if not dll_match or not dll_match.group(1):
+ test.fail_test()
+ if dll_match.group(1) != '10420000':
+ test.fail_test()
+
+ default_exe_headers = GetHeaders('test_base_default_exe.exe')
+ default_exe_match = image_base_reg_ex.match(default_exe_headers)
+
+ if not default_exe_match or not default_exe_match.group(1):
+ test.fail_test()
+ if default_exe_match.group(1) != '400000':
+ test.fail_test()
+
+ default_dll_headers = GetHeaders('test_base_default_dll.dll')
+ default_dll_match = image_base_reg_ex.match(default_dll_headers)
+
+ if not default_dll_match or not default_dll_match.group(1):
+ test.fail_test()
+ if default_dll_match.group(1) != '10000000':
+ test.fail_test()
+
+ test.pass_test()