Fix argument parsing in uiautomator shell script.
When only jar files were provided as arguments to runtest command
the script would display a help message rather than running the test.
BUG: 11634975
Change-Id: I3ce9060ffbdcc9a7e39bbd04de491eb9f0cbfc9f
diff --git a/uiautomator/cmds/uiautomator/uiautomator b/uiautomator/cmds/uiautomator/uiautomator
index 9aec2c4..fe2c735 100755
--- a/uiautomator/cmds/uiautomator/uiautomator
+++ b/uiautomator/cmds/uiautomator/uiautomator
@@ -69,11 +69,14 @@
if [ "${cmd}" == "runtest" ]; then
# first parse the jar paths
while [ true ]; do
- if [ -z "${1}" ]; then
+ if [ -z "${1}" ] && [ -z "${jars}" ]; then
echo "Error: more parameters expected for runtest; please see usage for details"
cmd="help"
break
fi
+ if [ -z "${1}" ]; then
+ break
+ fi
jar=${1}
if [ "${1:0:1}" = "-" ]; then
# we are done with jars, starting with parameters now