diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2014-05-15 13:04:20 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2014-05-15 13:05:56 +0800 |
commit | 1b0beb84382db0b7b84b4a33d665aaf9eb44784c (patch) | |
tree | da3109889a9ada9183ecabb50cf911ac0e24704f /tests | |
parent | 352a1eea121a0d2407b48d5ca52adc1a8bebaebf (diff) | |
download | ndk-1b0beb84382db0b7b84b4a33d665aaf9eb44784c.tar.gz |
Fix test issue17144-byteswap to respond to APP_ABI in arg
Otherwise test may fail when ABI isn't one of armeabi-v7a, x86, or mips
Change-Id: I130ee64f5dfa80231c8ac3c6ad5b170917d86ee2
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/build/issue17144-byteswap/build.sh | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/tests/build/issue17144-byteswap/build.sh b/tests/build/issue17144-byteswap/build.sh index 9cd5ca517..158ff1393 100755 --- a/tests/build/issue17144-byteswap/build.sh +++ b/tests/build/issue17144-byteswap/build.sh @@ -10,30 +10,45 @@ fail_panic () fi } -# checking armeabi-v7a -$NDK/ndk-build -B APP_ABI=armeabi-v7a APP_CFLAGS=-save-temps NDK_DEBUG=1 -fail_panic "can't compile for APP_ABI=armeabi-v7a" -grep -qw rev16 issue17144-byteswap.s -fail_panic "armeabi-v7a doesn't use rev16 instruction for __swap16()" -grep -qw rev issue17144-byteswap.s -fail_panic "armeabi-v7a doesn't use rev instruciton for __swap32()" +for opt do + optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` + case "$opt" in + APP_ABI=*) + APP_ABI=$optarg + ;; + esac +done -# checking x86 -$NDK/ndk-build -B APP_ABI=x86 APP_CFLAGS=-save-temps NDK_DEBUG=1 -fail_panic "can't compile for x86" -grep -qw rorw issue17144-byteswap.s -fail_panic "x86 doesn't use rorw instruction for __swap16()" -grep -qw bswap issue17144-byteswap.s -fail_panic "x86 doesn't use bswap instruciton for __swap32()" +if [ -z "$APP_ABI" -o "$APP_ABI" = "all" -o "$APP_ABI" != "${APP_ABI%%armeabi-v7a*}" ]; then + # checking armeabi-v7a + $NDK/ndk-build -B APP_ABI=armeabi-v7a APP_CFLAGS=-save-temps NDK_DEBUG=1 + fail_panic "can't compile for APP_ABI=armeabi-v7a" + grep -qw rev16 issue17144-byteswap.s + fail_panic "armeabi-v7a doesn't use rev16 instruction for __swap16()" + grep -qw rev issue17144-byteswap.s + fail_panic "armeabi-v7a doesn't use rev instruciton for __swap32()" +fi -# checking mips -# Note that MD_SWAP in machine/endian.h is only defined for r2. Add -# -mips32r2 because default Android toolchain support r1 -$NDK/ndk-build -B APP_ABI=mips APP_CFLAGS="-save-temps -mips32r2" NDK_DEBUG=1 -fail_panic "can't compile for mips" -grep -qw wsbh issue17144-byteswap.s -fail_panic "mips doesn't use wsbh instruction for __swap16()" -grep -w rotr issue17144-byteswap.s | grep -qw rotr -fail_panic "mips doesn't use wsbh/rotr instruciton for __swap32()" +if [ -z "$APP_ABI" -o "$APP_ABI" = "all" -o "$APP_ABI" != "${APP_ABI%%x86*}" ]; then + # checking x86 + $NDK/ndk-build -B APP_ABI=x86 APP_CFLAGS=-save-temps NDK_DEBUG=1 + fail_panic "can't compile for x86" + grep -qw rorw issue17144-byteswap.s + fail_panic "x86 doesn't use rorw instruction for __swap16()" + grep -qw bswap issue17144-byteswap.s + fail_panic "x86 doesn't use bswap instruciton for __swap32()" +fi + +if [ -z "$APP_ABI" -o "$APP_ABI" = "all" -o "$APP_ABI" != "${APP_ABI%%mips*}" ]; then + # checking mips + # Note that MD_SWAP in machine/endian.h is only defined for r2. Add + # -mips32r2 because default Android toolchain support r1 + $NDK/ndk-build -B APP_ABI=mips APP_CFLAGS="-save-temps -mips32r2" NDK_DEBUG=1 + fail_panic "can't compile for mips" + grep -qw wsbh issue17144-byteswap.s + fail_panic "mips doesn't use wsbh instruction for __swap16()" + grep -w rotr issue17144-byteswap.s | grep -qw rotr + fail_panic "mips doesn't use wsbh/rotr instruciton for __swap32()" +fi rm -rf libs obj issue17144-byteswap.*
\ No newline at end of file |