OLD | NEW |
(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 delay load setting is extracted properly. |
| 9 """ |
| 10 |
| 11 import TestGyp |
| 12 |
| 13 import subprocess |
| 14 import sys |
| 15 |
| 16 if sys.platform == 'win32': |
| 17 test = TestGyp.TestGyp(formats=['ninja', 'msvs']) |
| 18 |
| 19 CHDIR = 'linker_flags' |
| 20 test.run_gyp('delay-load-dlls.gyp', chdir=CHDIR) |
| 21 test.build('delay-load-dlls.gyp', test.ALL, chdir=CHDIR) |
| 22 |
| 23 def CheckForDumpedString(binary, string): |
| 24 proc = subprocess.Popen(['dumpbin', '/all', binary], |
| 25 stdout=subprocess.PIPE) |
| 26 output = proc.communicate()[0] |
| 27 assert not proc.returncode |
| 28 if string not in output: |
| 29 print 'Did not find "%s" in %s' % (string, binary) |
| 30 test.fail_test() |
| 31 |
| 32 CheckForDumpedString(test.built_file_path('test_dld_few.exe', chdir=CHDIR), |
| 33 'contains the following delay load imports:\r\n\r\n SHELL32.dll') |
| 34 |
| 35 if test.format == 'ninja': |
| 36 ninja_file = test.built_file_path('obj/test_dld_none.ninja', chdir=CHDIR) |
| 37 test.must_not_contain(ninja_file, '/DELAYLOAD') |
| 38 |
| 39 ninja_file = test.built_file_path('obj/test_dld_empty.ninja', chdir=CHDIR) |
| 40 test.must_not_contain(ninja_file, '/DELAYLOAD') |
| 41 |
| 42 ninja_file = test.built_file_path('obj/test_dld_one.ninja', chdir=CHDIR) |
| 43 test.must_contain(ninja_file, '/DELAYLOAD:dwmapi') |
| 44 |
| 45 ninja_file = test.built_file_path('obj/test_dld_few.ninja', chdir=CHDIR) |
| 46 test.must_contain(ninja_file, '/DELAYLOAD:dbghelp') |
| 47 test.must_contain(ninja_file, '/DELAYLOAD:shell32') |
| 48 test.must_contain(ninja_file, '/DELAYLOAD:uxtheme') |
| 49 |
| 50 test.pass_test() |
OLD | NEW |