File: gyptest-app-error.py

package info (click to toggle)
thunderbird 1%3A140.4.0esr-1~deb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,609,412 kB
  • sloc: cpp: 7,672,442; javascript: 5,901,613; ansic: 3,898,954; python: 1,413,343; xml: 653,997; asm: 462,286; java: 180,927; sh: 113,489; makefile: 20,460; perl: 14,288; objc: 13,059; yacc: 4,583; pascal: 3,352; lex: 1,720; ruby: 1,222; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (49 lines) | stat: -rwxr-xr-x 1,321 bytes parent folder | download | duplicates (31)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""
Verifies that invalid strings files cause the build to fail.
"""

from __future__ import print_function

import TestCmd
import TestGyp

import sys

if sys.platform == 'darwin':
  print("This test is currently disabled: https://crbug.com/483696.")
  sys.exit(0)

  expected_error = 'Old-style plist parser: missing semicolon in dictionary'
  saw_expected_error = [False]  # Python2 has no "nonlocal" keyword.
  def match(a, b):
    if a == b:
      return True
    if not TestCmd.is_List(a):
      a = a.split('\n')
    if not TestCmd.is_List(b):
      b = b.split('\n')
    if expected_error in '\n'.join(a) + '\n'.join(b):
      saw_expected_error[0] = True
      return True
    return False
  test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], match=match)

  test.run_gyp('test-error.gyp', chdir='app-bundle')

  test.build('test-error.gyp', test.ALL, chdir='app-bundle')

  # Ninja pipes stderr of subprocesses to stdout.
  if test.format in ['ninja', 'xcode-ninja'] \
      and expected_error in test.stdout():
    saw_expected_error[0] = True

  if saw_expected_error[0]:
    test.pass_test()
  else:
    test.fail_test()