1b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org#!/usr/bin/env python
2b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
3b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org# Copyright (c) 2012 Google Inc. All rights reserved.
4b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org# Use of this source code is governed by a BSD-style license that can be
5b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org# found in the LICENSE file.
6b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
7b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org"""
8b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.orgMake sure warning level is extracted properly.
9b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org"""
10b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
11b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.orgimport TestGyp
12b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
13b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.orgimport sys
14b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
15b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.orgif sys.platform == 'win32':
16b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
17b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
18b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  CHDIR = 'compiler-flags'
19b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.run_gyp('warning-level.gyp', chdir=CHDIR)
20b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
21b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  # A separate target for each warning level: one pass (compiling a file
22b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  # containing a warning that's above the specified level); and one fail
23b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  # (compiling a file at the specified level). No pass for 4 of course,
24b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  # because it would have to have no warnings. The default warning level is
25b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  # equivalent to level 1.
26b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
27b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl1_fail', chdir=CHDIR, status=1)
28b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl1_pass', chdir=CHDIR)
29b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
30b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl2_fail', chdir=CHDIR, status=1)
31b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl2_pass', chdir=CHDIR)
32b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
33b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl3_fail', chdir=CHDIR, status=1)
34b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl3_pass', chdir=CHDIR)
35b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
36b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_wl4_fail', chdir=CHDIR, status=1)
37b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
38b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_def_fail', chdir=CHDIR, status=1)
39b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.build('warning-level.gyp', 'test_def_pass', chdir=CHDIR)
40b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org
41b7e497b5513e15e5db18a0e49efb37876d54f241scottmg@chromium.org  test.pass_test()
42