Merge "Tests with build.sh check for BROKEN_BUILD and incompatible ABI"
diff --git a/tests/build/check-armeabi-v7a-prebuilts/jni/Android.mk b/tests/build/check-armeabi-v7a-prebuilts/jni/Android.mk
new file mode 100644
index 0000000..2f42ab6
--- /dev/null
+++ b/tests/build/check-armeabi-v7a-prebuilts/jni/Android.mk
@@ -0,0 +1 @@
+LOCAL_PATH:= $(call my-dir)
diff --git a/tests/build/check-armeabi-v7a-prebuilts/jni/Application.mk b/tests/build/check-armeabi-v7a-prebuilts/jni/Application.mk
new file mode 100644
index 0000000..af9052a
--- /dev/null
+++ b/tests/build/check-armeabi-v7a-prebuilts/jni/Application.mk
@@ -0,0 +1 @@
+APP_ABI := armeabi-v7a
\ No newline at end of file
diff --git a/tests/build/mips-fp4/build.sh b/tests/build/mips-fp4/build.sh
index b07e8ae..4bad419 100755
--- a/tests/build/mips-fp4/build.sh
+++ b/tests/build/mips-fp4/build.sh
@@ -1,32 +1,5 @@
cd $(dirname "$0")
-# check if this test should be skipped
-get_build_var ()
-{
- if [ -z "$GNUMAKE" ] ; then
- GNUMAKE=make
- fi
- $GNUMAKE --no-print-dir -f $NDK/build/core/build-local.mk DUMP_$1 | tail -1
-}
-
-if [ -f "BROKEN_BUILD" ] ; then
- TESTPATH=`pwd`
- if [ ! -s "BROKEN_BUILD" ] ; then
- # skip all
- echo "Skipping `basename $TESTPATH`: (build)"
- exit 0
- else
- # only skip listed in file
- TARGET_TOOLCHAIN=`get_build_var TARGET_TOOLCHAIN`
- TARGET_TOOLCHAIN_VERSION=`echo $TARGET_TOOLCHAIN | tr '-' '\n' | tail -1`
- grep -q -w -e "$TARGET_TOOLCHAIN_VERSION" "BROKEN_BUILD"
- if [ $? = 0 ] ; then
- echo "Skipping `basename $TESTPATH`: (no build for $TARGET_TOOLCHAIN_VERSION)"
- exit 0
- fi
- fi
-fi
-
$NDK/ndk-build -B "$@"
# Find instruction in file
diff --git a/tests/build/warn-noabi/jni/Android.mk b/tests/build/warn-noabi/jni/Android.mk
new file mode 100644
index 0000000..2f42ab6
--- /dev/null
+++ b/tests/build/warn-noabi/jni/Android.mk
@@ -0,0 +1 @@
+LOCAL_PATH:= $(call my-dir)
diff --git a/tests/build/warn-noabi/jni/Application.mk b/tests/build/warn-noabi/jni/Application.mk
new file mode 100644
index 0000000..d0a1e39
--- /dev/null
+++ b/tests/build/warn-noabi/jni/Application.mk
@@ -0,0 +1 @@
+APP_ABI := armeabi armeabi-v7a
\ No newline at end of file
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 0ed414f..690e911 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -459,6 +459,31 @@
return 1
}
+# check if $ABI is incompatible and shouldn't be built
+# $1: project directory
+is_incompatible_abi ()
+{
+ local PROJECT="$1"
+
+ if [ "$ABI" != "default" ] ; then
+ # check APP_ABI
+ local APP_ABIS=`get_build_var $PROJECT APP_ABI`
+ APP_ABIS=$APP_ABIS" "
+ if [ "$APP_ABIS" != "${APP_ABIS%%all*}" ] ; then
+ # replace the first "all" with all available ABIs
+ ALL_ABIS=`get_build_var $PROJECT NDK_ALL_ABIS`
+ APP_ABIS_FRONT="${APP_ABIS%%all*}"
+ APP_ABIS_BACK="${APP_ABIS#*all}"
+ APP_ABIS="${APP_ABIS_FRONT}${ALL_ABIS}${APP_ABIS_BACK}"
+ fi
+ if [ "$APP_ABIS" = "${APP_ABIS%$ABI *}" ] ; then
+ echo "Skipping `basename $PROJECT`: incompatible ABI, needs $APP_ABIS"
+ return 0
+ fi
+ fi
+ return 1
+}
+
build_project ()
{
local NAME=`basename $1`
@@ -468,23 +493,12 @@
if is_broken_build $1; then
return 0;
fi
- rm -rf "$DIR" && cp -r "$1" "$DIR"
- if [ "$ABI" != "default" -a "$CHECK_ABI" = "yes" ] ; then
- # check APP_ABI
- local APP_ABIS=`get_build_var $DIR APP_ABI`
- APP_ABIS=$APP_ABIS" "
- if [ "$APP_ABIS" != "${APP_ABIS%%all*}" ] ; then
- # replace the first "all" with all available ABIs
- ALL_ABIS=`get_build_var $DIR NDK_ALL_ABIS`
- APP_ABIS_FRONT="${APP_ABIS%%all*}"
- APP_ABIS_BACK="${APP_ABIS#*all}"
- APP_ABIS="${APP_ABIS_FRONT}${ALL_ABIS}${APP_ABIS_BACK}"
- fi
- if [ "$APP_ABIS" = "${APP_ABIS%$ABI *}" ] ; then
- echo "Skipping `basename $1`: incompatible ABI, needs $APP_ABIS"
+ if [ "$CHECK_ABI" = "yes" ] ; then
+ if is_incompatible_abi $1 ; then
return 0
fi
fi
+ rm -rf "$DIR" && cp -r "$1" "$DIR"
# build it
(run cd "$DIR" && run_ndk_build $NDK_BUILD_FLAGS)
RET=$?
@@ -567,6 +581,15 @@
echo "Building NDK build test: `basename $1`"
if [ -f $1/build.sh ]; then
local DIR="$BUILD_DIR/$NAME"
+ if [ -f "$1/jni/Android.mk" -a -f "$1/jni/Application.mk" ] ; then
+ # exclude jni/Android.mk with import-module because it needs NDK_MODULE_PATH
+ grep -q "call import-module" "$1/jni/Android.mk"
+ if [ $? != 0 ] ; then
+ if (is_broken_build $1 || is_incompatible_abi $1) then
+ return 0;
+ fi
+ fi
+ fi
rm -rf "$DIR" && cp -r "$1" "$DIR"
export NDK
(cd "$DIR" && run ./build.sh $NDK_BUILD_FLAGS)