diff options
author | Elliott Hughes <enh@google.com> | 2020-10-26 18:00:10 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-10-26 18:00:10 +0000 |
commit | ca2fb687c354dad20199a9f185206eb5988e3210 (patch) | |
tree | 87bd8f874b32842547352ec049a520f8d7cb03a9 | |
parent | 947b02d03e1aacb98d8d40ef7ad96f7cc9c82027 (diff) | |
parent | b92ea84adbe632271b9f46a64b538e8d61316d85 (diff) | |
download | tinyxml2-ca2fb687c354dad20199a9f185206eb5988e3210.tar.gz |
Merge "Run tinyxml2 tests in presubmit." am: 8ff7e9312b am: 903a7328f9 am: dea5c0c3a8 am: b92ea84adb
Original change: https://android-review.googlesource.com/c/platform/external/tinyxml2/+/1471260
Change-Id: I93aaf1046bbf2282520e63e1ba40adcec8389520
-rw-r--r-- | Android.bp | 13 | ||||
-rw-r--r-- | TEST_MAPPING | 7 | ||||
-rwxr-xr-x | run-tinyxml2-tests-on-android.sh | 41 |
3 files changed, 60 insertions, 1 deletions
@@ -32,10 +32,21 @@ cc_library { } cc_test { - name: "tinyxml2-tests", + name: "tinyxml2-xmltest", srcs: ["xmltest.cpp"], shared_libs: ["libtinyxml2"], data: [ "resources/**/*", ], } + +sh_test { + name: "tinyxml2-tests", + src: "run-tinyxml2-tests-on-android.sh", + filename: "run-tinyxml2-tests-on-android.sh", + test_suites: ["general-tests"], + host_supported: true, + device_supported: false, + require_root: true, + target_required: ["tinyxml2-xmltest"], +} diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..60222f9 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "tinyxml2-tests" + } + ] +} diff --git a/run-tinyxml2-tests-on-android.sh b/run-tinyxml2-tests-on-android.sh new file mode 100755 index 0000000..a3b2a41 --- /dev/null +++ b/run-tinyxml2-tests-on-android.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copy the tests across. +adb sync + +if tty -s; then + green="\033[1;32m" + red="\033[1;31m" + plain="\033[0m" +else + green="" + red="" + plain="" +fi + +failures=0 + +check_failure() { + if [ $? -eq 0 ]; then + echo -e "${green}[PASS]${plain}" + else + failures=$(($failures+1)) + echo -e "${red}[FAIL]${plain}" + fi +} + +if [ -e "$ANDROID_PRODUCT_OUT/data/nativetest/tinyxml2-xmltest/tinyxml2-xmltest" ]; then + adb shell "cd /data/nativetest/tinyxml2-xmltest; ./tinyxml2-xmltest" + check_failure +fi +if [ -e "$ANDROID_PRODUCT_OUT/data/nativetest64/tinyxml2-xmltest/tinyxml2-xmltest" ]; then + adb shell "cd /data/nativetest64/tinyxml2-xmltest; ./tinyxml2-xmltest" + check_failure +fi + +echo "_________________________________________________________________________" +echo +if [ $failures -ne 0 ]; then + echo -e "${red}FAILED${plain}: $failures" +fi +exit $failures |