• 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 invalid strings files cause the build to fail.
9"""
10
11import TestCmd
12import TestGyp
13
14import sys
15
16if sys.platform == 'darwin':
17  print "This test is currently disabled: https://crbug.com/483696."
18  sys.exit(0)
19
20  expected_error = 'Old-style plist parser: missing semicolon in dictionary'
21  saw_expected_error = [False]  # Python2 has no "nonlocal" keyword.
22  def match(a, b):
23    if a == b:
24      return True
25    if not TestCmd.is_List(a):
26      a = a.split('\n')
27    if not TestCmd.is_List(b):
28      b = b.split('\n')
29    if expected_error in '\n'.join(a) + '\n'.join(b):
30      saw_expected_error[0] = True
31      return True
32    return False
33  test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], match=match)
34
35  test.run_gyp('test-error.gyp', chdir='app-bundle')
36
37  test.build('test-error.gyp', test.ALL, chdir='app-bundle')
38
39  # Ninja pipes stderr of subprocesses to stdout.
40  if test.format in ['ninja', 'xcode-ninja'] \
41      and expected_error in test.stdout():
42    saw_expected_error[0] = True
43
44  if saw_expected_error[0]:
45    test.pass_test()
46  else:
47    test.fail_test()
48