aboutsummaryrefslogtreecommitdiff
path: root/tests/standalone/builtin-macros
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2013-07-20 00:49:37 +0200
committerDavid 'Digit' Turner <digit@android.com>2013-07-20 00:49:37 +0200
commit1fce92f9024e84c77777ba2a050c90af17790d80 (patch)
tree9d6288d5e3e043455eef3519c74e0672b505884a /tests/standalone/builtin-macros
parent81c782a08a9cc11e7395e0aaf493bea7314b2210 (diff)
downloadndk-1fce92f9024e84c77777ba2a050c90af17790d80.tar.gz
Update the wchar-related tests.
This updates all wchar_t related definitions to match the fix currently uploaded at: https://android-review.googlesource.com/#/c/62320/ + Fix a typo in <minitest/minitest.h> See http://b.android.com/57749 Change-Id: Iaa30eb026c27bac1d3cb4e1870f787f9ca22414e
Diffstat (limited to 'tests/standalone/builtin-macros')
-rw-r--r--tests/standalone/builtin-macros/run.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/standalone/builtin-macros/run.sh b/tests/standalone/builtin-macros/run.sh
index 27a11a746..b40a418a4 100644
--- a/tests/standalone/builtin-macros/run.sh
+++ b/tests/standalone/builtin-macros/run.sh
@@ -72,6 +72,31 @@ macro_check () {
COUNT=$(( $COUNT + 1 ))
}
+# Check the definition of a given macro against multiple values
+# $1: macro name
+# $2+: list of acceptable values.
+macro_multi_check () {
+ echo -n "Checking $1: "
+ local VAL=$(macro_val $1)
+ if [ -z "$VAL" ]; then
+ echo "Missing built-in macro definition: $1"
+ return 1
+ fi
+ local VAL2 FOUND
+ shift
+ for VAL2 in "$@"; do
+ if [ "$VAL2" = "$VAL" ]; then
+ FOUND=true
+ break
+ fi
+ done
+ if [ -z "$FOUND" ]; then
+ echo "Invalid built-in macro definition: '$VAL', expected one of: $@"
+ return 1
+ fi
+ return 0
+}
+
# Check that a given macro is undefined
macro_check_undef () {
if [ -n "$2" ]; then
@@ -114,6 +139,9 @@ case $ABI in
macro_check __ARMEL__ 1 "ARM little-endian"
macro_check __THUMB_INTERWORK__ 1 "ARM thumb-interwork"
macro_check __PIC__ 1 "Position independent code (-fpic)"
+ macro_check __WCHAR_TYPE__ "unsigned"
+ macro_check __WCHAR_MAX__ "4294967295U"
+ # Clang doesn't define __WCHAR_MIN__ so don't check it"
case $ABI in
armeabi)
@@ -148,6 +176,10 @@ case $ABI in
macro_check __SSE3__ 1 "SSE3 instruction set"
macro_check __SSE_MATH__ 1 "Use SSE for math operations"
macro_check __SSE2_MATH__ 1 "Use SSE2 for math operations"
+ # GCC defines is as 'long', and Clang as 'int'
+ macro_multi_check __WCHAR_TYPE__ "long" "int"
+ # GCC defines it with an L suffix, Clang doesn't.
+ macro_multi_check __WCHAR_MAX__ "2147483647L" "2147483647"
;;
mips)
@@ -155,6 +187,9 @@ case $ABI in
macro_check _MIPS_ARCH_MIPS32 1 "Mips 32-bit ABI"
macro_check __MIPSEL__ 1 "Mips little-endian"
macro_check __PIC__ 1 "Position independent code (-fpic)"
+ # GCC defines it as "signed int", and Clang as "int"
+ macro_multi_check __WCHAR_TYPE__ "signed int" "int"
+ macro_check __WCHAR_MAX__ "2147483647"
;;
*)
echo "Unknown ABI: $ABI"