ART: Change meaning of run-test's --no-image

Do not test runtime image generation. Instead test running without
an image by disabling image patching.

Bug: 67596919
Test: m test-art-host
Test: art/test/testrunner/run_build_test_target.py art-no-image
Change-Id: Idf6f0368ea94efbc61285457711af896a80e2ffb
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 753fc39..31f43fc 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -545,9 +545,17 @@
     bpath="${bpath}:${framework}/bouncycastle${bpath_suffix}.jar"
     # Pass down the bootclasspath
     FLAGS="${FLAGS} -Xbootclasspath:${bpath}"
-    # Add 5 minutes to give some time to generate the boot image.
-    TIME_OUT_VALUE=$((${TIME_OUT_VALUE} + 300))
-    DALVIKVM_BOOT_OPT="-Ximage:/system/non-existant/core.art"
+    # Disable image dex2oat - this will forbid the runtime to patch or compile an image.
+    FLAGS="${FLAGS} -Xnoimage-dex2oat"
+
+    # We'll abuse a second flag here to test different behavior. If --relocate, use the
+    # existing image - relocation will fail as patching is disallowed. If --no-relocate,
+    # pass a non-existent image - compilation will fail as dex2oat is disallowed.
+    if [ "${RELOCATE}" = "y" ] ; then
+      DALVIKVM_BOOT_OPT="-Ximage:${BOOT_IMAGE}"
+    else
+      DALVIKVM_BOOT_OPT="-Ximage:/system/non-existant/core.art"
+    fi
 else
     DALVIKVM_BOOT_OPT="-Ximage:${BOOT_IMAGE}"
 fi
@@ -935,6 +943,10 @@
           # All tests would log the error of failing dex2oat/patchoat. Be silent here and only
           # log fatal events.
           export ANDROID_LOG_TAGS='*:s'
+      elif [ "$HAVE_IMAGE" = "n" ]; then
+          # All tests would log the error of missing image. Be silent here and only log fatal
+          # events.
+          export ANDROID_LOG_TAGS='*:s'
       else
           # We are interested in LOG(ERROR) output.
           export ANDROID_LOG_TAGS='*:e'
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 47b2f22..c6b6574 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -384,6 +384,12 @@
         "variant": "jvmti-stress & jit | redefine-stress & jit"
     },
     {
+        "test_patterns": ["616-cha"],
+        "description": ["The test assumes a boot image exists."],
+        "bug": "http://b/34193647",
+        "variant": "no-image"
+    },
+    {
         "tests": [ "663-odd-dex-size",
                    "663-odd-dex-size2",
                    "663-odd-dex-size3",