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 PREfast (code analysis) setting is extracted properly.
9"""
10
11import TestGyp
12
13import os
14import sys
15
16if (sys.platform == 'win32' and
17    int(os.environ.get('GYP_MSVS_VERSION', 0)) >= 2012):
18  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
19
20  CHDIR = 'compiler-flags'
21  test.run_gyp('analysis.gyp', chdir=CHDIR)
22
23  # Analysis enabled, should fail.
24  test.build('analysis.gyp', 'test_analysis_on', chdir=CHDIR, status=1)
25
26  # Analysis not enabled, or unspecified, should pass.
27  test.build('analysis.gyp', 'test_analysis_off', chdir=CHDIR)
28  test.build('analysis.gyp', 'test_analysis_unspec', chdir=CHDIR)
29
30  test.pass_test()
31