MediaSession2: Fix bug in runtest.sh for finding test apk
The script had searched the apk under the ${OUT}, but it sometimes match
with the invalid apk under ${OUT}/obj/PACKAGING.
Limits the search directory to ${OUT}/system and ${OUT}/data to exclude
obj directory.
Test: Run all MediaComponents tests once
Change-Id: I733b381cbc8e56b5c28515bc93931ce1e5d67e40
diff --git a/packages/MediaComponents/test/runtest.sh b/packages/MediaComponents/test/runtest.sh
index 920fa96..edce230 100644
--- a/packages/MediaComponents/test/runtest.sh
+++ b/packages/MediaComponents/test/runtest.sh
@@ -146,9 +146,10 @@
fi
target_dir=$(dirname ${target_dir})
local package=$(sed -n 's/^.*\bpackage\b="\([a-z0-9\._]*\)".*$/\1/p' ${target_dir}/AndroidManifest.xml)
- local apk_path=$(find ${OUT} -name ${target}.apk)
- if [[ -z "${apk_path}" ]]; then
- echo "Cannot locate ${target}.apk" && break
+ local apk_path=$(find ${OUT}/system ${OUT}/data -name ${target}.apk)
+ local apk_num=$(find ${OUT}/system ${OUT}/data -name ${target}.apk | wc -l)
+ if [[ "${apk_num}" != "1" ]]; then
+ echo "Cannot locate a ${target}.apk. Found ${apk_num} apks" && break
fi
echo "Installing ${target}.apk. path=${apk_path}"
${adb} install -r ${apk_path}