Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: test/no-cpp/gyptest-no-cpp.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 Checks that C-only targets aren't linked against libstdc++. 8 Checks that C-only targets aren't linked against libstdc++.
9 """ 9 """
10 10
11 import TestGyp 11 import TestGyp
12 12
13 import re 13 import re
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 16
17 # set |match| to ignore build stderr output. 17 # set |match| to ignore build stderr output.
18 test = TestGyp.TestGyp(match = lambda a, b: True) 18 test = TestGyp.TestGyp(match = lambda a, b: True)
19 if sys.platform != 'win32' and test.format != 'make': 19 if sys.platform != 'win32' and test.format != 'make':
20 # TODO: This doesn't pass with make. 20 # TODO: This doesn't pass with make.
21 # TODO: Does a test like this make sense with Windows? 21 # TODO: Does a test like this make sense with Windows?
22 22
23 CHDIR = 'src' 23 CHDIR = 'src'
24 test.run_gyp('test.gyp', chdir=CHDIR) 24 test.run_gyp('test.gyp', chdir=CHDIR)
25 test.build('test.gyp', 'no_cpp', chdir=CHDIR) 25 test.build('test.gyp', 'no_cpp', chdir=CHDIR)
26 26
27 def LinksLibStdCpp(path): 27 def LinksLibStdCpp(path):
28 path = test.built_file_path(path, chdir=CHDIR) 28 path = test.built_file_path(path, chdir=CHDIR)
29 if sys.platform == 'darwin': 29 if sys.platform == 'darwin':
30 proc = subprocess.Popen(['otool', '-L', path], stdout=subprocess.PIPE) 30 proc = subprocess.Popen(['otool', '-L', path], stdout=subprocess.PIPE,
31 universal_newlines=True)
31 else: 32 else:
32 proc = subprocess.Popen(['ldd', path], stdout=subprocess.PIPE) 33 proc = subprocess.Popen(['ldd', path], stdout=subprocess.PIPE,
34 universal_newlines=True)
33 output = proc.communicate()[0] 35 output = proc.communicate()[0]
34 assert not proc.returncode 36 assert not proc.returncode
35 return 'libstdc++' in output or 'libc++' in output 37 return 'libstdc++' in output or 'libc++' in output
36 38
37 if LinksLibStdCpp('no_cpp'): 39 if LinksLibStdCpp('no_cpp'):
38 test.fail_test() 40 test.fail_test()
39 41
40 build_error_code = { 42 build_error_code = {
41 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`) 43 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`)
42 'make': 2, 44 'make': 2,
43 'ninja': 1, 45 'ninja': 1,
44 'cmake': 0, # CMake picks the compiler driver based on transitive checks. 46 'cmake': 0, # CMake picks the compiler driver based on transitive checks.
45 'xcode-ninja': [1, 65], 47 'xcode-ninja': [1, 65],
46 }[test.format] 48 }[test.format]
47 49
48 test.build('test.gyp', 'no_cpp_dep_on_cc_lib', chdir=CHDIR, 50 test.build('test.gyp', 'no_cpp_dep_on_cc_lib', chdir=CHDIR,
49 status=build_error_code) 51 status=build_error_code)
50 52
51 test.pass_test() 53 test.pass_test()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698