Clear odex/vdex/art file before running run-test

This allows individual tests to call the RUN script
multiple times.

Test: ./test/testrunner/testrunner.py [--host|--target] [--no-prebuild]
Bug: 38213479

(cherry picked from commit 24bd3f9d63c81f448b7fe1854742fda0343a2297)

Change-Id: I9243b448f3601dec02615699a5bca7dd7472de53
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 97aa212..5d7e0ff 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -643,7 +643,7 @@
     adb root > /dev/null
     adb wait-for-device
     if [ "$QUIET" = "n" ]; then
-      adb shell rm -r $DEX_LOCATION
+      adb shell rm -rf $DEX_LOCATION
       adb shell mkdir -p $DEX_LOCATION
       adb push $TEST_NAME.jar $DEX_LOCATION
       adb push $TEST_NAME-ex.jar $DEX_LOCATION
@@ -711,6 +711,7 @@
 
     rm -f $cmdfile
 else
+    # Host run.
     export ANDROID_PRINTF_LOG=brief
 
     # By default, and for prebuild dex2oat, we are interested in errors being logged. In dev mode
@@ -767,7 +768,12 @@
 
     cd $ANDROID_BUILD_TOP
 
+    # Make sure we delete any existing compiler artifacts.
+    # This enables tests to call the RUN script multiple times in a row
+    # without worrying about interference.
+    rm -rf ${DEX_LOCATION}/oat
     rm -rf ${DEX_LOCATION}/dalvik-cache/
+
     mkdir -p ${mkdir_locations} || exit 1
     $profman_cmdline || { echo "Profman failed." >&2 ; exit 2; }
     $dex2oat_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }