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"""
8Make sure delay load setting is extracted properly.
9"""
10
11import TestGyp
12
13import sys
14
15if sys.platform == 'win32':
16  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
17
18  CHDIR = 'linker-flags'
19  test.run_gyp('delay-load-dlls.gyp', chdir=CHDIR)
20  test.build('delay-load-dlls.gyp', test.ALL, chdir=CHDIR)
21
22  prefix = 'contains the following delay load imports:'
23  shell32_look_for = prefix + '\r\n\r\n    SHELL32.dll'
24
25  output = test.run_dumpbin(
26      '/all', test.built_file_path('test_dld_none.exe', chdir=CHDIR))
27  if prefix in output:
28    test.fail_test()
29
30  output = test.run_dumpbin(
31      '/all', test.built_file_path('test_dld_shell32.exe', chdir=CHDIR))
32  if shell32_look_for not in output:
33    test.fail_test()
34
35  test.pass_test()
36