Fixes for 071-dexfile

Ensure dex2oat has the correct process group.
Don't unmap dex file in DexFile.open.
Diagnostic warning messages in DexFile.open in particular as the class
loader will swallow the IOExceptions without logging.
Fix location of test-ex.jar for test 068-classloader.

Change-Id: Ie54ebb98b687db1eb30091c86de9beb860c26c3d
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 1a9618c..1c9f064 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -608,6 +608,10 @@
   pid_t pid = fork();
   if (pid == 0) {
     // no allocation allowed between fork and exec
+
+    // change process groups, so we don't get reaped by ProcessManager
+    setpgid(0, 0);
+
     execl(dex2oat, dex2oat,
           "--runtime-arg", "-Xms64m",
           "--runtime-arg", "-Xmx64m",
diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc
index 41110d3..de3e6d6 100644
--- a/src/dalvik_system_DexFile.cc
+++ b/src/dalvik_system_DexFile.cc
@@ -104,31 +104,37 @@
     ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
     UniquePtr<File> file(OS::OpenFile(outputName.c_str(), true));
     if (file.get() == NULL) {
+      LOG(WARNING) << "unable to create oat file: " << outputName.c_str();
       jniThrowExceptionFmt(env, "java/io/IOException", "unable to create oat file: %s",
                            outputName.c_str());
       return 0;
     }
     if (!class_linker->GenerateOatFile(sourceName.c_str(), file->Fd(), outputName.c_str())) {
+      LOG(WARNING) << "unable to generate oat file: " << outputName.c_str();
       jniThrowExceptionFmt(env, "java/io/IOException", "unable to generate oat file: %s",
                            outputName.c_str());
       return 0;
     }
     UniquePtr<OatFile> oat_file(OatFile::Open(outputName.c_str(), "", NULL));
     if (oat_file.get() == NULL) {
+      LOG(WARNING) << "unable to open oat file: " << outputName.c_str();
       jniThrowExceptionFmt(env, "java/io/IOException", "unable to open oat file: %s",
                            outputName.c_str());
       return 0;
     }
     const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(sourceName.c_str());
     if (oat_dex_file == NULL) {
+      LOG(WARNING) << "unable to find dex file in oat file: " << outputName.c_str();
       jniThrowExceptionFmt(env, "java/io/IOException", "unable to find dex file in oat file: %s",
                            outputName.c_str());
       return 0;
     }
+    Runtime::Current()->GetClassLinker()->RegisterOatFile(*oat_file.release());
     dex_file = oat_dex_file->OpenDexFile();
   }
 
   if (dex_file == NULL) {
+    LOG(WARNING) << "unable to open dex file: " << sourceName.c_str();
     jniThrowExceptionFmt(env, "java/io/IOException", "unable to open dex file: %s",
                          sourceName.c_str());
     return 0;
diff --git a/test/068-classloader/src/FancyLoader.java b/test/068-classloader/src/FancyLoader.java
index 173b08f..28c17a8 100644
--- a/test/068-classloader/src/FancyLoader.java
+++ b/test/068-classloader/src/FancyLoader.java
@@ -35,10 +35,10 @@
  */
 public class FancyLoader extends ClassLoader {
     /* this is where the "alternate" .class files live */
-    static final String CLASS_PATH = "classes-ex/";
+    static final String CLASS_PATH = "/data/art-test";
 
     /* this is the "alternate" DEX/Jar file */
-    static final String DEX_FILE = "test-ex.jar";
+    static final String DEX_FILE = "068-classloader-ex.jar";
 
     /* on Dalvik, this is a DexFile; otherwise, it's null */
     private Class mDexClass;
@@ -94,7 +94,7 @@
                 }
 
                 try {
-                    mDexFile = ctor.newInstance(DEX_FILE);
+                    mDexFile = ctor.newInstance(CLASS_PATH + File.separator + DEX_FILE);
                 } catch (InstantiationException ie) {
                     throw new ClassNotFoundException("newInstance failed", ie);
                 } catch (IllegalAccessException iae) {