summaryrefslogtreecommitdiffstats
path: root/media/webrtc/trunk/tools/gyp/test/standalone-static-library
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/standalone-static-library
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/standalone-static-library')
-rw-r--r--media/webrtc/trunk/tools/gyp/test/standalone-static-library/gyptest-standalone-static-library.py50
-rw-r--r--media/webrtc/trunk/tools/gyp/test/standalone-static-library/invalid.gyp16
-rw-r--r--media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.c7
-rw-r--r--media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.gyp26
-rw-r--r--media/webrtc/trunk/tools/gyp/test/standalone-static-library/prog.c7
5 files changed, 106 insertions, 0 deletions
diff --git a/media/webrtc/trunk/tools/gyp/test/standalone-static-library/gyptest-standalone-static-library.py b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/gyptest-standalone-static-library.py
new file mode 100644
index 000000000..50535abfc
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/gyptest-standalone-static-library.py
@@ -0,0 +1,50 @@
+#!/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 build of a static_library with the standalone_static_library flag set.
+"""
+
+import os
+import subprocess
+import sys
+import TestGyp
+
+# standalone_static_library currently means two things: a specific output
+# location for the built target and non-thin archive files.
+test = TestGyp.TestGyp()
+
+# Verify that types other than static_library cause a failure.
+test.run_gyp('invalid.gyp', status=1, stderr=None)
+target_str = 'invalid.gyp:bad#target'
+err = ['gyp: Target %s has type executable but standalone_static_library flag '
+ 'is only valid for static_library type.' % target_str]
+test.must_contain_all_lines(test.stderr(), err)
+
+# Build a valid standalone_static_library.
+test.run_gyp('mylib.gyp')
+test.build('mylib.gyp', target='prog')
+
+# Verify that the static library is copied to the correct location.
+# We expect the library to be copied to $PRODUCT_DIR.
+standalone_static_library_dir = test.EXECUTABLE
+path_to_lib = os.path.split(
+ test.built_file_path('mylib', type=standalone_static_library_dir))[0]
+lib_name = test.built_file_basename('mylib', type=test.STATIC_LIB)
+path = os.path.join(path_to_lib, lib_name)
+test.must_exist(path)
+
+# Verify that the program runs properly.
+expect = 'hello from mylib.c\n'
+test.run_built_executable('prog', stdout=expect)
+
+# Verify that libmylib.a contains symbols. "ar -x" fails on a 'thin' archive.
+supports_thick = ('make', 'ninja', 'cmake')
+if test.format in supports_thick and sys.platform.startswith('linux'):
+ retcode = subprocess.call(['ar', '-x', path])
+ assert retcode == 0
+
+test.pass_test()
diff --git a/media/webrtc/trunk/tools/gyp/test/standalone-static-library/invalid.gyp b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/invalid.gyp
new file mode 100644
index 000000000..54b32117e
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/invalid.gyp
@@ -0,0 +1,16 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'bad',
+ 'type': 'executable',
+ 'standalone_static_library': 1,
+ 'sources': [
+ 'prog.c',
+ ],
+ },
+ ],
+} \ No newline at end of file
diff --git a/media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.c b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.c
new file mode 100644
index 000000000..108be618c
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void print(void)
+{
+ printf("hello from mylib.c\n");
+ return;
+}
diff --git a/media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.gyp b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.gyp
new file mode 100644
index 000000000..2d191de31
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/mylib.gyp
@@ -0,0 +1,26 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'mylib',
+ 'type': 'static_library',
+ 'standalone_static_library': 1,
+ 'sources': [
+ 'mylib.c',
+ ],
+ },
+ {
+ 'target_name': 'prog',
+ 'type': 'executable',
+ 'sources': [
+ 'prog.c',
+ ],
+ 'dependencies': [
+ 'mylib',
+ ],
+ },
+ ],
+}
diff --git a/media/webrtc/trunk/tools/gyp/test/standalone-static-library/prog.c b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/prog.c
new file mode 100644
index 000000000..8af5c9084
--- /dev/null
+++ b/media/webrtc/trunk/tools/gyp/test/standalone-static-library/prog.c
@@ -0,0 +1,7 @@
+extern void print(void);
+
+int main(void)
+{
+ print();
+ return 0;
+}