• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"""
8Verifies that missing 'sources' files are treated as fatal errors when the
9the generator flag 'msvs_error_on_missing_sources' is set.
10"""
11
12import TestGyp
13import os
14import sys
15
16if sys.platform == 'win32':
17  test = TestGyp.TestGyp(formats=['msvs', 'ninja'], workdir='workarea_all')
18
19  # With the flag not set
20  test.run_gyp('hello_missing.gyp')
21
22  # With the flag explicitly set to 0
23  try:
24    os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=0'
25    test.run_gyp('hello_missing.gyp')
26  finally:
27    del os.environ['GYP_GENERATOR_FLAGS']
28
29  # With the flag explicitly set to 1
30  try:
31    os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=1'
32    # Test to make sure GYP raises an exception (exit status 1). Since this will
33    # also print a backtrace, ensure that TestGyp is not checking that stderr is
34    # empty by specifying None, which means do not perform any checking.
35    # Instead, stderr is checked below to ensure it contains the expected
36    # output.
37    test.run_gyp('hello_missing.gyp', status=1, stderr=None)
38  finally:
39    del os.environ['GYP_GENERATOR_FLAGS']
40  test.must_contain_any_line(test.stderr(),
41                            ["Missing input files:"])
42
43  test.pass_test()
44