Fix run-test --trace option if --host is specified after.

Change-Id: I3911428ba762657c4433ab23e60f1771c9ddb2fe
diff --git a/test/run-test b/test/run-test
index 71a1d70..1ed03ea 100755
--- a/test/run-test
+++ b/test/run-test
@@ -72,6 +72,7 @@
 usage="no"
 build_only="no"
 suffix64=""
+trace="false"
 
 while true; do
     if [ "x$1" = "x--host" ]; then
@@ -176,7 +177,7 @@
         suffix64="64"
         shift
     elif [ "x$1" = "x--trace" ]; then
-        run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file:${DEX_LOCATION}/trace.bin --runtime-option -Xmethod-trace-file-size:2000000"
+        trace="true"
         shift
     elif expr "x$1" : "x--" >/dev/null 2>&1; then
         echo "unknown $0 option: $1" 1>&2
@@ -188,6 +189,10 @@
 done
 mkdir -p $tmp_dir
 
+if [ "$trace" = "true" ]; then
+    run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file:${DEX_LOCATION}/trace.bin --runtime-option -Xmethod-trace-file-size:2000000"
+fi
+
 # Most interesting target architecture variables are Makefile variables, not environment variables.
 # Try to map the suffix64 flag and what we find in ${OUT}/data/art-test to an architecture name.
 function guess_arch_name() {