diff options
author | Dan Albert <danalbert@google.com> | 2015-12-15 15:12:16 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2016-01-29 15:30:09 -0800 |
commit | 0b6cb5d01cea47e6e7b88cc4bf3b1d150dd7a79f (patch) | |
tree | 4bfd1af6f56d49835d47f212c6854373e5d0a379 /tests | |
parent | e9c7fdda471d72051359f389f90adf7f7368fdad (diff) | |
download | ndk-0b6cb5d01cea47e6e7b88cc4bf3b1d150dd7a79f.tar.gz |
Add a test for unwinder compatibility in libc++.
The libgcc and LLVM unwinders like to fight. This test will fail if
the unwinder is not linked to be tolerant of this.
Bug: http://b/26194502
Change-Id: I0d03f67edae1e53dac44fff3557666eb08e77a4a
Diffstat (limited to 'tests')
-rw-r--r-- | tests/device/libcxx-unwind/jni/Android.mk | 7 | ||||
-rw-r--r-- | tests/device/libcxx-unwind/jni/Application.mk | 4 | ||||
-rw-r--r-- | tests/device/libcxx-unwind/jni/foo.cpp | 26 |
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/device/libcxx-unwind/jni/Android.mk b/tests/device/libcxx-unwind/jni/Android.mk new file mode 100644 index 000000000..5202e5d5b --- /dev/null +++ b/tests/device/libcxx-unwind/jni/Android.mk @@ -0,0 +1,7 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE := foo +LOCAL_SRC_FILES := foo.cpp +LOCAL_CPPFLAGS := -std=c++11 -fexceptions -frtti -UNDEBUG -O0 +include $(BUILD_EXECUTABLE) diff --git a/tests/device/libcxx-unwind/jni/Application.mk b/tests/device/libcxx-unwind/jni/Application.mk new file mode 100644 index 000000000..e29ff010d --- /dev/null +++ b/tests/device/libcxx-unwind/jni/Application.mk @@ -0,0 +1,4 @@ +APP_STL := c++_shared +APP_ABI := armeabi-v7a +APP_PLATFORM := android-21 +NDK_TOOLCHAIN_VERSION := clang diff --git a/tests/device/libcxx-unwind/jni/foo.cpp b/tests/device/libcxx-unwind/jni/foo.cpp new file mode 100644 index 000000000..1ee5fa2d9 --- /dev/null +++ b/tests/device/libcxx-unwind/jni/foo.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <cassert> +#include <map> + +int main() { + typedef std::pair<const int, double> V; + V ar[] = { + V(1, 1.5), V(2, 2.5), V(3, 3.5), V(4, 4.5), + V(5, 5.5), V(7, 7.5), V(8, 8.5), + }; + std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0])); + m.at(1) = -1.5; + try { + m.at(6); + assert(0); + } catch (std::out_of_range &) { + } +} |