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 debug format settings are extracted properly.
9"""
10
11import TestGyp
12
13import sys
14
15if sys.platform == 'win32':
16  test = TestGyp.TestGyp(formats=['ninja'])
17
18  CHDIR = 'compiler-flags'
19  test.run_gyp('debug-format.gyp', chdir=CHDIR)
20
21  # While there's ways to via .pdb contents, the .pdb doesn't include
22  # which style the debug information was created from, so we resort to just
23  # verifying the flags are correct on the command line.
24
25  ninja_file = test.built_file_path('obj/test-debug-format-off.ninja',
26      chdir=CHDIR)
27  test.must_not_contain(ninja_file, '/Z7')
28  test.must_not_contain(ninja_file, '/Zi')
29  test.must_not_contain(ninja_file, '/ZI')
30
31  ninja_file = test.built_file_path('obj/test-debug-format-oldstyle.ninja',
32      chdir=CHDIR)
33  test.must_contain(ninja_file, '/Z7')
34
35  ninja_file = test.built_file_path('obj/test-debug-format-pdb.ninja',
36      chdir=CHDIR)
37  test.must_contain(ninja_file, '/Zi')
38
39  ninja_file = test.built_file_path('obj/test-debug-format-editcontinue.ninja',
40      chdir=CHDIR)
41  test.must_contain(ninja_file, '/ZI')
42
43  test.pass_test()
44