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