aboutsummaryrefslogtreecommitdiff
path: root/tests/build/issue64679-prctl/build.sh
blob: 1c3359a2e445516920f5d3f65a74e83b74957d96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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"
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
        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
                        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
    done
done