From bb257a5f55bb2cbbf41c9faca3f73b74fcd895de Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Fri, 14 Nov 2014 11:12:26 +0800 Subject: Revise testcsae issue64679-prctl which validates each header Revise test which validates each header can be included alone. What's changed: 1. Exclude time64.h (and sys/user.h for now) from 64-bit ABI 2. Compile in -std=c++11 to get char16_t and char32_t (needed inuchar.h) defined 3. Rename HEADER -> HEADER_UNDER_TESTING to avoid name collision of struct name exist in header Change-Id: I586511a54a667a25e232b1179c4dad9406fdbe8a --- tests/build/issue64679-prctl/build.sh | 17 ++++++++++----- tests/build/issue64679-prctl/jni/Android.mk | 3 ++- .../build/issue64679-prctl/jni/issue64679-prctl.c | 24 ---------------------- .../build/issue64679-prctl/jni/issue64679-prctl.cc | 24 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 30 deletions(-) delete mode 100644 tests/build/issue64679-prctl/jni/issue64679-prctl.c create mode 100644 tests/build/issue64679-prctl/jni/issue64679-prctl.cc (limited to 'tests') diff --git a/tests/build/issue64679-prctl/build.sh b/tests/build/issue64679-prctl/build.sh index 8195cfef8..1c3359a2e 100755 --- a/tests/build/issue64679-prctl/build.sh +++ b/tests/build/issue64679-prctl/build.sh @@ -8,6 +8,7 @@ NDK_BUILDTOOLS_PATH=$NDK/build/tools . $NDK/build/tools/prebuilt-common.sh INTERNAL_HEADERS="sys/_errdefs.h sys/_sigdefs.h sys/_system_properties.h" +INVALID_HEADERS_FOR_64BIT="time64.h sys/user.h" # ToDo: remove sys/user.h later once __u64 and __u32 are defined for x86_64 for API_LEVEL in $API_LEVELS; do for ARCH in $DEFAULT_ARCHS; do @@ -17,12 +18,18 @@ for API_LEVEL in $API_LEVELS; do ABIS=$(commas_to_spaces $(convert_arch_to_abi $ARCH)) for ABI in $ABIS; do for HEADER in $HEADERS; do - if [ "$INTERNAL_HEADERS" = "${INTERNAL_HEADERS%%$HEADER*}" ] ; then - #echo Compiling with $HEADER - $ANDROID_NDK_ROOT/ndk-build -B APP_CFLAGS=-DHEADER=\"\<$HEADER\>\" APP_PLATFORM=android-$API_LEVEL APP_ABI=$ABI 1>/dev/null 2>&1 - fail_panic "Can't compile header $ANDROID_NDK_ROOT/platforms/android-$API_LEVEL/arch-$ARCH/usr/include/$HEADER alone. -To reproduce: $ANDROID_NDK_ROOT/ndk-build -B APP_CFLAGS=-DHEADER=\"\<$HEADER\>\" APP_PLATFORM=android-$API_LEVEL APP_ABI=$ABI" + if [ "$INTERNAL_HEADERS" != "${INTERNAL_HEADERS%%$HEADER*}" ] ; then + continue; fi + if [ "$ABI" != "${ABI%%64*}" ] ; then + if [ "$INVALID_HEADERS_FOR_64BIT" != "${INVALID_HEADERS_FOR_64BIT%%$HEADER*}" ] ; then + continue; + fi + fi + #echo Compiling with $HEADER + $ANDROID_NDK_ROOT/ndk-build -B APP_CFLAGS=-DHEADER_UNDER_TESTING=\"\<$HEADER\>\" APP_PLATFORM=android-$API_LEVEL APP_ABI=$ABI 1>/dev/null 2>&1 + fail_panic "Can't compile header $ANDROID_NDK_ROOT/platforms/android-$API_LEVEL/arch-$ARCH/usr/include/$HEADER alone. +To reproduce: $ANDROID_NDK_ROOT/ndk-build -B APP_CFLAGS=-DHEADER_UNDER_TESTING=\"\<$HEADER\>\" APP_PLATFORM=android-$API_LEVEL APP_ABI=$ABI" done done fi diff --git a/tests/build/issue64679-prctl/jni/Android.mk b/tests/build/issue64679-prctl/jni/Android.mk index cbe73c744..3f3a82794 100644 --- a/tests/build/issue64679-prctl/jni/Android.mk +++ b/tests/build/issue64679-prctl/jni/Android.mk @@ -2,5 +2,6 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := issue64679-prctl -LOCAL_SRC_FILES := issue64679-prctl.c +LOCAL_SRC_FILES := issue64679-prctl.cc +LOCAL_CPPFLAGS += -std=c++11 include $(BUILD_EXECUTABLE) diff --git a/tests/build/issue64679-prctl/jni/issue64679-prctl.c b/tests/build/issue64679-prctl/jni/issue64679-prctl.c deleted file mode 100644 index b76b19363..000000000 --- a/tests/build/issue64679-prctl/jni/issue64679-prctl.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#undef linux -#define linux linux - -#include HEADER - -int main() -{ -} diff --git a/tests/build/issue64679-prctl/jni/issue64679-prctl.cc b/tests/build/issue64679-prctl/jni/issue64679-prctl.cc new file mode 100644 index 000000000..c07a18ac6 --- /dev/null +++ b/tests/build/issue64679-prctl/jni/issue64679-prctl.cc @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#undef linux +#define linux linux + +#include HEADER_UNDER_TESTING + +int main() +{ +} -- cgit v1.2.3