Add testcase for issue 64679

Loop through {API_LEVEL x ABI} and check each header
( *.h sys/*.h android/*.h EGL/*.h GLES/*.h GLES2/*.h GLES3/*.h
OMXAL/*.h SLES/*.h) can be included aone

See b.android.com/64679

Change-Id: Ia4c66d75ec1792e14899bc504a3166c36af3e437
diff --git a/tests/build/issue64679-prctl/build.sh b/tests/build/issue64679-prctl/build.sh
new file mode 100755
index 0000000..8195cfe
--- /dev/null
+++ b/tests/build/issue64679-prctl/build.sh
@@ -0,0 +1,30 @@
+# Check if some platform headers can be included alone
+# See b.android.com/64679 for one of them
+#
+
+export ANDROID_NDK_ROOT=$NDK
+
+NDK_BUILDTOOLS_PATH=$NDK/build/tools
+. $NDK/build/tools/prebuilt-common.sh
+
+INTERNAL_HEADERS="sys/_errdefs.h sys/_sigdefs.h sys/_system_properties.h"
+
+for API_LEVEL in $API_LEVELS; do
+    for ARCH in $DEFAULT_ARCHS; do
+        if [ -d $ANDROID_NDK_ROOT/platforms/android-$API_LEVEL/arch-$ARCH ]; then
+            HEADERS=`cd $ANDROID_NDK_ROOT/platforms/android-$API_LEVEL/arch-$ARCH/usr/include ; ls *.h sys/*.h android/*.h EGL/*.h GLES/*.h GLES2/*.h GLES3/*.h OMXAL/*.h SLES/*.h 2> /dev/null`
+            #echo $API_LEVEL $ARCH HEADERS=$HEADERS
+            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"
+                    fi
+                done
+            done
+        fi
+    done
+done
diff --git a/tests/build/issue64679-prctl/jni/Android.mk b/tests/build/issue64679-prctl/jni/Android.mk
new file mode 100644
index 0000000..cbe73c7
--- /dev/null
+++ b/tests/build/issue64679-prctl/jni/Android.mk
@@ -0,0 +1,6 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := issue64679-prctl
+LOCAL_SRC_FILES := issue64679-prctl.c
+include $(BUILD_EXECUTABLE)
diff --git a/tests/build/issue64679-prctl/jni/Application.mk b/tests/build/issue64679-prctl/jni/Application.mk
new file mode 100644
index 0000000..a252a72
--- /dev/null
+++ b/tests/build/issue64679-prctl/jni/Application.mk
@@ -0,0 +1 @@
+APP_ABI := all
diff --git a/tests/build/issue64679-prctl/jni/issue64679-prctl.c b/tests/build/issue64679-prctl/jni/issue64679-prctl.c
new file mode 100644
index 0000000..b76b193
--- /dev/null
+++ b/tests/build/issue64679-prctl/jni/issue64679-prctl.c
@@ -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
+
+int main()
+{
+}