aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar jingwen <jingwen@google.com>2018-02-23 09:58:53 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-23 10:00:44 -0800
commit5f2648255967c776e72ec72790db733a22ed7c27 (patch)
tree137d6212649e3492882b6970b38454e30e7e6f95 /src/test/shell
parentc791415dea389d60b495806905bf8cd008af1953 (diff)
Set the correct include path for r13b's llvm-libc++ headers and fix compilation with @androidndk//:toolchain-libcpp with missing link time files.
This fix needs a way to compare revision numbers, so the type of NdkRelease.majorRevision has been changed to Integer. This also paves the way for r15+ support. Fixes https://github.com/bazelbuild/bazel/issues/3641 Fixes https://github.com/bazelbuild/bazel/issues/3923 Fixes https://github.com/bazelbuild/bazel/issues/4677 TESTED=bazel test //src/test/shell/bazel/android:android_ndk_integration_test with r11, r12, r13, r14, r15 RELNOTES: Fixed include paths for NDK r13+ llvm-libc++ headers to `ndk/sources/cxx-stl/llvm-libc++/include` and `ndk/sources/cxx-stl/llvm-libc++abi/include` PiperOrigin-RevId: 186783465
Diffstat (limited to 'src/test/shell')
-rwxr-xr-xsrc/test/shell/bazel/android/android_ndk_integration_test.sh108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/test/shell/bazel/android/android_ndk_integration_test.sh b/src/test/shell/bazel/android/android_ndk_integration_test.sh
index d87cac31ca..b40103afbc 100755
--- a/src/test/shell/bazel/android/android_ndk_integration_test.sh
+++ b/src/test/shell/bazel/android/android_ndk_integration_test.sh
@@ -323,4 +323,112 @@ EOF
|| fail "build failed"
}
+function test_crosstool_stlport() {
+ create_new_workspace
+ setup_android_ndk_support
+ cat > BUILD <<EOF
+cc_binary(
+ name = "foo",
+ srcs = ["foo.cc"],
+ linkopts = ["-ldl"],
+)
+EOF
+ cat > foo.cc <<EOF
+#include <string>
+#include <jni.h>
+#include <android/log.h>
+#include <cstdio>
+#include <iostream>
+
+using namespace std;
+int main(){
+ string foo = "foo";
+ string bar = "bar";
+ string foobar = foo + bar;
+ return 0;
+}
+EOF
+ assert_build //:foo \
+ --cpu=armeabi-v7a \
+ --crosstool_top=@androidndk//:toolchain-stlport \
+ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
+}
+
+function test_crosstool_libcpp() {
+ create_new_workspace
+ setup_android_ndk_support
+ cat > BUILD <<EOF
+cc_binary(
+ name = "foo",
+ srcs = ["foo.cc"],
+ linkopts = ["-ldl", "-lm"],
+)
+EOF
+ cat > foo.cc <<EOF
+#include <string>
+#include <jni.h>
+#include <android/log.h>
+#include <cstdio>
+#include <iostream>
+
+using namespace std;
+int main(){
+ string foo = "foo";
+ string bar = "bar";
+ string foobar = foo + bar;
+ return 0;
+}
+EOF
+ assert_build //:foo \
+ --cpu=armeabi-v7a \
+ --crosstool_top=@androidndk//:toolchain-libcpp \
+ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
+}
+
+function test_crosstool_gnu_libstdcpp() {
+ create_new_workspace
+ setup_android_ndk_support
+ cat > BUILD <<EOF
+cc_binary(
+ name = "foo",
+ srcs = ["foo.cc"],
+)
+EOF
+ cat > foo.cc <<EOF
+#include <string>
+#include <jni.h>
+#include <android/log.h>
+#include <cstdio>
+#include <iostream>
+
+using namespace std;
+int main(){
+ string foo = "foo";
+ string bar = "bar";
+ string foobar = foo + bar;
+ return 0;
+}
+EOF
+ assert_build //:foo \
+ --cpu=armeabi-v7a \
+ --crosstool_top=@androidndk//:toolchain-gnu-libstdcpp \
+ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
+}
+
+function test_crosstool_libcpp_with_multiarch() {
+ create_new_workspace
+ setup_android_sdk_support
+ setup_android_ndk_support
+ create_android_binary
+
+ cpus="armeabi,armeabi-v7a,arm64-v8a,x86,x86_64"
+
+ assert_build //java/bazel:bin \
+ --fat_apk_cpu="$cpus" \
+ --android_crosstool_top=@androidndk//:toolchain-libcpp \
+ --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
+ check_num_sos
+ check_soname
+}
+
run_suite "Android NDK integration tests"