Have testrunner honor ART_TEST_CHROOT only for target tests.

Chroot-based testing is only supported on devices, and
art/test/run-test would complain if `--host` and `--chroot` were to be
used together.

Also have the same behavior for ART_TEST_ANDROID_ROOT, as it only
makes sense for target tests.

Test: ART_TEST_CHROOT=/data/local/art-test-chroot art/test/testrunner/testrunner.py --host
Bug: 34729697
Change-Id: I617fbcf719d3c59dbcbd632e69bf52e3498b4cff
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 09b9b21..540acd8 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -320,12 +320,6 @@
   if env.ART_TEST_BISECTION:
     options_all += ' --bisection-search'
 
-  if env.ART_TEST_CHROOT:
-    options_all += ' --chroot ' + env.ART_TEST_CHROOT
-
-  if env.ART_TEST_ANDROID_ROOT:
-    options_all += ' --android-root ' + env.ART_TEST_ANDROID_ROOT
-
   if gdb:
     options_all += ' --gdb'
     if gdb_arg:
@@ -401,6 +395,13 @@
       elif target == 'jvm':
         options_test += ' --jvm'
 
+      # Honor ART_TEST_CHROOT and ART_TEST_ANDROID_ROOT, but only for target tests.
+      if target == 'target':
+        if env.ART_TEST_CHROOT:
+          options_test += ' --chroot ' + env.ART_TEST_CHROOT
+        if env.ART_TEST_ANDROID_ROOT:
+          options_test += ' --android-root ' + env.ART_TEST_ANDROID_ROOT
+
       if run == 'ndebug':
         options_test += ' -O'