• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2
3# Copyright (c) 2016 The Chromium Authors. 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 excluded files are listed in sources_for_indexing.xcodeproj by
9default, and that the generator flag xcode_ninja_list_excluded_files can be
10used to override the default behavior.
11"""
12
13import os
14import TestGyp
15
16
17test = TestGyp.TestGyp()
18
19if test.format != 'xcode-ninja':
20  test.skip_test()
21
22
23# With the generator flag not set.
24test.run_gyp('hello_exclude.gyp')
25test.must_contain(
26  'sources_for_indexing.xcodeproj/project.pbxproj', 'hello_excluded.cpp')
27
28
29# With the generator flag set to 0.
30try:
31  os.environ['GYP_GENERATOR_FLAGS'] = 'xcode_ninja_list_excluded_files=0'
32  test.run_gyp('hello_exclude.gyp')
33finally:
34  del os.environ['GYP_GENERATOR_FLAGS']
35test.must_not_contain(
36  'sources_for_indexing.xcodeproj/project.pbxproj', 'hello_excluded.cpp')
37
38
39# With the generator flag explicitly set to 1.
40try:
41  os.environ['GYP_GENERATOR_FLAGS'] = 'xcode_ninja_list_excluded_files=1'
42  test.run_gyp('hello_exclude.gyp')
43finally:
44  del os.environ['GYP_GENERATOR_FLAGS']
45test.must_contain(
46  'sources_for_indexing.xcodeproj/project.pbxproj', 'hello_excluded.cpp')
47
48
49test.pass_test()
50