summaryrefslogtreecommitdiffstats
path: root/media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py')
-rw-r--r--media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py b/media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py
new file mode 100644
index 000000000..d37e3c194
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/no-cpp/gyptest-no-cpp.py
@@ -0,0 +1,51 @@
+#!/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 != 'make':
+ # TODO: This doesn't pass with make.
+ # TODO: Does a test like this make sense with Windows?
+
+ CHDIR = 'src'
+ test.run_gyp('test.gyp', chdir=CHDIR)
+ test.build('test.gyp', 'no_cpp', chdir=CHDIR)
+
+ def LinksLibStdCpp(path):
+ path = test.built_file_path(path, chdir=CHDIR)
+ if sys.platform == 'darwin':
+ proc = subprocess.Popen(['otool', '-L', path], stdout=subprocess.PIPE)
+ else:
+ proc = subprocess.Popen(['ldd', path], stdout=subprocess.PIPE)
+ output = proc.communicate()[0]
+ assert not proc.returncode
+ return 'libstdc++' in output or 'libc++' in output
+
+ 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,
+ 'cmake': 0, # CMake picks the compiler driver based on transitive checks.
+ 'xcode-ninja': [1, 65],
+ }[test.format]
+
+ test.build('test.gyp', 'no_cpp_dep_on_cc_lib', chdir=CHDIR,
+ status=build_error_code)
+
+ test.pass_test()