Working dex2oat and oatexec

adb shell dex2oatd --dex-file=/system/framework/core.jar     --image=/system/framework/boot.oat --base=0x50000000 "'--method=Ljava/lang/System;logI(Ljava/lang/String;)V'" "'--method=Ljava/lang/System;log(CLjava/lang/String;Ljava/lang/Throwable;)V'"
adb shell dex2oatd --boot-dex-file=/system/framework/core.jar --boot=/system/framework/boot.oat --dex-file=/system/framework/art-test-dex-HelloWorld.jar --image=/system/framework/art-test-dex-HelloWorld.oat
adb shell oatexecd -Xbootclasspath:/system/framework/core.jar -Xbootimage:/system/framework/boot.oat -classpath /system/framework/art-test-dex-HelloWorld.jar -Ximage:/system/framework/art-test-dex-HelloWorld.oat HelloWorld

09-05 17:58:18.912  2385  2385 I System  : Hello, world!

Change-Id: I53e534068584f0c3a837313e4d517a0e4a7154fc
diff --git a/src/common_test.h b/src/common_test.h
index 7916640..98d9127 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -85,7 +85,8 @@
       setenv("ANDROID_ROOT", root.c_str(), 1);
     }
 
-    android_data_ = (is_host_ ? "/tmp/art-data-XXXXXX" : "/mnt/sdcard/art-data-XXXXXX");
+    // On target, Cannot use /mnt/sdcard because it is mounted noexec, so use subdir of art-cache
+    android_data_ = (is_host_ ? "/tmp/art-data-XXXXXX" : "/data/art-cache/art-data-XXXXXX");
     if (mkdtemp(&android_data_[0]) == NULL) {
       PLOG(FATAL) << "mkdtemp(\"" << &android_data_[0] << "\") failed";
     }
@@ -99,8 +100,12 @@
 
     boot_class_path_.push_back(java_lang_dex_file_.get());
 
-    runtime_.reset(Runtime::Create(boot_class_path_));
+    Runtime::Options options;
+    options.push_back(std::make_pair("bootclasspath", &boot_class_path_));
+    options.push_back(std::make_pair("-Xcheck:jni", reinterpret_cast<void*>(NULL)));
+    runtime_.reset(Runtime::Create(options, false));
     ASSERT_TRUE(runtime_.get() != NULL);
+    runtime_->Start();
     class_linker_ = runtime_->GetClassLinker();
 
     Heap::VerifyHeap();  // Check for heap corruption before the test
@@ -167,7 +172,7 @@
         return i;
       }
     }
-    CHECK(false) << "Could not find type index for " << descriptor;
+    CHECK(false) << "Failed to find type index for " << descriptor;
     return 0;
   }
 
@@ -181,11 +186,11 @@
         return i;
       }
     }
-    CHECK(false) << "Could not find field index for " << class_descriptor << " " << field_name;
+    CHECK(false) << "Failed to find field index for " << class_descriptor << " " << field_name;
     return 0;
   }
 
-  const PathClassLoader* AllocPathClassLoader(const DexFile* dex_file) {
+  const ClassLoader* AllocPathClassLoader(const DexFile* dex_file) {
     CHECK(dex_file != NULL);
     class_linker_->RegisterDexFile(*dex_file);
     std::vector<const DexFile*> dex_files;
@@ -204,7 +209,7 @@
     filename += name;
     filename += ".jar";
     const DexFile* dex_file = DexFile::OpenZip(filename);
-    CHECK(dex_file != NULL) << "Could not open " << filename;
+    CHECK(dex_file != NULL) << "Failed to open " << filename;
     return dex_file;
   }