19e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org#!/usr/bin/env python
29e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
39e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org# Copyright (c) 2012 Google Inc. All rights reserved.
49e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org# Use of this source code is governed by a BSD-style license that can be
59e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org# found in the LICENSE file.
69e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
79e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org"""
89e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.orgMake sure delay load setting is extracted properly.
99e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org"""
109e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
119e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.orgimport TestGyp
129e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
139e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.orgimport sys
149e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
159e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.orgif sys.platform == 'win32':
1689fcd93b01b73e1666ad96aac77e8d04f37d01d9scottmg@chromium.org  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
179e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
189e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  CHDIR = 'linker-flags'
199e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  test.run_gyp('delay-load-dlls.gyp', chdir=CHDIR)
209e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  test.build('delay-load-dlls.gyp', test.ALL, chdir=CHDIR)
219e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
229e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  prefix = 'contains the following delay load imports:'
239e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  shell32_look_for = prefix + '\r\n\r\n    SHELL32.dll'
249e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
259e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  output = test.run_dumpbin(
269e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org      '/all', test.built_file_path('test_dld_none.exe', chdir=CHDIR))
279e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  if prefix in output:
289e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org    test.fail_test()
299e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
309e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  output = test.run_dumpbin(
319e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org      '/all', test.built_file_path('test_dld_shell32.exe', chdir=CHDIR))
329e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  if shell32_look_for not in output:
339e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org    test.fail_test()
349e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org
359e3dccea366171f71109b73ecdf75677c806c6a0scottmg@chromium.org  test.pass_test()
36