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 exception handling settings are extracted properly.
9"""
10
11import TestGyp
12
13import sys
14
15if sys.platform == 'win32':
16  test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
17
18  CHDIR = 'compiler-flags'
19  test.run_gyp('exception-handling.gyp', chdir=CHDIR)
20
21  # Must fail.
22  test.build('exception-handling.gyp', 'test_eh_off', chdir=CHDIR,
23      status=1)
24
25  # Must succeed.
26  test.build('exception-handling.gyp', 'test_eh_s', chdir=CHDIR)
27  test.build('exception-handling.gyp', 'test_eh_a', chdir=CHDIR)
28
29  # Error code must be 1 if EHa, and 2 if EHsc.
30  test.run_built_executable('test_eh_a', chdir=CHDIR, status=1)
31  test.run_built_executable('test_eh_s', chdir=CHDIR, status=2)
32
33  test.pass_test()
34