Chromium Code Reviews| Index: test/no-cpp/gyptest-no-cpp.py |
| =================================================================== |
| --- test/no-cpp/gyptest-no-cpp.py (revision 0) |
| +++ test/no-cpp/gyptest-no-cpp.py (revision 0) |
| @@ -0,0 +1,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. |
| + |
| +""" |
| +Checks that C-only targets aren't linked against libstdc++. |
| +""" |
| + |
| +import TestGyp |
| + |
| +import re |
| +import subprocess |
| +import sys |
| + |
| +# set |match| to ignore build stderr output. |
| +test = TestGyp.TestGyp(match = lambda a, b: True) |
| +if sys.platform != 'win32' and test.format not in ('make', 'android'): |
| + # TODO: This doesn't pass with make. |
| + # TODO: Does a test like this make sense with Windows? Android? |
|
Nico
2013/09/10 21:11:45
Does msvs automatically link a c++ runtime if ther
scottmg
2013/09/10 21:31:33
I'm actually not sure how it decides to depend on
|
| + |
| + CHDIR = 'src' |
| + test.run_gyp('test.gyp', chdir=CHDIR) |
| + test.build('test.gyp', 'no_cpp', chdir=CHDIR) |
| + |
| + def LinksLibStdCpp(p): |
|
scottmg
2013/09/10 21:09:15
nit; p -> path
Nico
2013/09/10 21:11:45
Done.
|
| + p = test.built_file_path(p, chdir=CHDIR) |
| + if sys.platform == 'darwin': |
| + proc = subprocess.Popen(['otool', '-L', p], stdout=subprocess.PIPE) |
| + else: |
| + proc = subprocess.Popen(['ldd', p], stdout=subprocess.PIPE) |
| + o = proc.communicate()[0] |
|
scottmg
2013/09/10 21:09:15
nit; o -> out or output
Nico
2013/09/10 21:11:45
Done.
|
| + assert not proc.returncode |
| + return 'libstdc++' in o or 'libc++' in o |
| + |
| + if LinksLibStdCpp('no_cpp'): |
| + test.fail_test() |
| + |
| + build_error_code = { |
| + 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`) |
| + 'make': 2, |
| + 'ninja': 1, |
| + }[test.format] |
| + |
| + test.build('test.gyp', 'no_cpp_dep_on_cc_lib', chdir=CHDIR, |
| + status=build_error_code) |
| + |
| + test.pass_test() |
| Property changes on: test/no-cpp/gyptest-no-cpp.py |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |