From 838abd65365f19c0c2df5b0d13df33b6483db624 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 26 Jan 2021 19:01:39 +0100 Subject: [PATCH] Add script for running unit tests on Android device Maybe a little wonky, but I needed a way to run unit tests on AArch64, and this was the best way of running unit tests on Android that I could come up with. --- Tools/run-unit-tests-android.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Tools/run-unit-tests-android.sh diff --git a/Tools/run-unit-tests-android.sh b/Tools/run-unit-tests-android.sh new file mode 100644 index 0000000000..5476061d95 --- /dev/null +++ b/Tools/run-unit-tests-android.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Runs unit tests (must have been built beforehand) on an Android device connected via adb. +# +# The current working directory must contain test executables. Normally (for AArch64) +# the working directory would be: Source/Android/app/.cxx/cmake/debug/arm64-v8a/Binaries/Tests + +DEVICE_DIR="/data/local/tmp/dolphin-emu-tests" + +# Prevent MingW MSYS from being "smart" and turning the path above into a Windows-style path +export MSYS_NO_PATHCONV=1 +export MSYS2_ARG_CONV_EXCL="*" + +for path in *; do + f=$(basename "$path") + + adb push "$path" "$DEVICE_DIR/$f" && adb shell chmod 775 "$DEVICE_DIR/$f" && adb shell "$DEVICE_DIR/$f" + RESULT=$(($RESULT+$?)) + + # Some of these executables are pretty big, so let's remove them as soon as we're done + adb shell rm "$DEVICE_DIR/$f" +done + +echo "" +echo "Total failed tests: $RESULT" + +exit $RESULT