Clean up run_unit_tests a little
Since run_tests() is only ever called once, and now has much more complex
arguments, it makes sense for it just to be the mainline of the script.
Change-Id: I64cef03212e76b0058f80e0d9450ed6cf607b9ed
diff --git a/system/test/run_unit_tests.sh b/system/test/run_unit_tests.sh
index 167ead7..59774c9 100755
--- a/system/test/run_unit_tests.sh
+++ b/system/test/run_unit_tests.sh
@@ -23,45 +23,7 @@
done
}
-run_tests() {
- adb="adb${1:+ -s $1}"
- shift
-
- test_args=()
- for arg
- do
- shift
- if [ "$arg" == "--" ]; then
- break
- else
- test_args+=( "$arg" )
- fi
- done
-
- failed_tests=''
- for spec in $*
- do
- name="${spec%%.*}"
- if [ "${name}" != "${spec}" ]; then
- filter="${spec#*.}"
- fi
- echo "--- $name ---"
- echo "pushing..."
- $adb push {$ANDROID_PRODUCT_OUT,}/data/nativetest/$name/$name
- echo "running..."
- $adb shell data/nativetest/$name/$name${filter:+ "--gtest_filter=${filter}"} ${test_args[*]}
- if [ $? != 0 ]; then
- failed_tests="$failed_tests$CR!!! FAILED TEST: $name !!!";
- fi
- done
-
- if [ "$failed_tests" != "" ]; then
- echo "$failed_tests";
- return 1
- fi
- return 0
-}
-
+device=
tests=()
test_args=()
while [ $# -gt 0 ]; do
@@ -99,4 +61,28 @@
tests+=( ${known_tests[*]} )
fi
-run_tests "$device" ${test_args[*]} -- ${tests[*]} || exit 1
+adb="adb${device:+ -s $device}"
+
+failed_tests=''
+for spec in ${tests[*]}
+do
+ name="${spec%%.*}"
+ if [ "${name}" != "${spec}" ]; then
+ filter="${spec#*.}"
+ fi
+ echo "--- $name ---"
+ echo "pushing..."
+ $adb push {$ANDROID_PRODUCT_OUT,}/data/nativetest/$name/$name
+ echo "running..."
+ $adb shell data/nativetest/$name/$name${filter:+ "--gtest_filter=${filter}"} ${test_args[*]}
+ if [ $? != 0 ]; then
+ failed_tests="$failed_tests$CR!!! FAILED TEST: $name !!!";
+ fi
+done
+
+if [ "$failed_tests" != "" ]; then
+ echo "$failed_tests";
+ exit 1
+fi
+
+exit 0