Add a test for transitive C++ dependencies.

This test checks that a C-only library will correctly link libc++ if
it depends on a static library that uses libc++.

Test: ./run_tests.py --rebuild --filter cxx_only_from_deps
Bug: None
Change-Id: I17991c95af7419c1961b0435a14688ecdf2881f7
diff --git a/tests/build/cxx_only_from_deps/jni/Android.mk b/tests/build/cxx_only_from_deps/jni/Android.mk
new file mode 100644
index 0000000..20ad00e
--- /dev/null
+++ b/tests/build/cxx_only_from_deps/jni/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libfoo
+LOCAL_SRC_FILES := foo.cpp
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libbar
+LOCAL_SRC_FILES := bar.c
+LOCAL_STATIC_LIBRARIES := libfoo
+include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/build/cxx_only_from_deps/jni/Application.mk b/tests/build/cxx_only_from_deps/jni/Application.mk
new file mode 100644
index 0000000..3b7baf1
--- /dev/null
+++ b/tests/build/cxx_only_from_deps/jni/Application.mk
@@ -0,0 +1 @@
+APP_STL := c++_shared
diff --git a/tests/build/cxx_only_from_deps/jni/bar.c b/tests/build/cxx_only_from_deps/jni/bar.c
new file mode 100644
index 0000000..ceced3a
--- /dev/null
+++ b/tests/build/cxx_only_from_deps/jni/bar.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+extern const char* foo();
+
+void bar() {
+    printf("foo returned %s\n", foo());
+}
diff --git a/tests/build/cxx_only_from_deps/jni/foo.cpp b/tests/build/cxx_only_from_deps/jni/foo.cpp
new file mode 100644
index 0000000..c9baa30
--- /dev/null
+++ b/tests/build/cxx_only_from_deps/jni/foo.cpp
@@ -0,0 +1,7 @@
+#include <string>
+
+static const std::string kMyString = "foo";
+
+extern "C" const char* foo() {
+    return kMyString.c_str();
+}