ART: Do not load wrong libart(d)/libdexfile(d).so for tests.

Test: run-test --gdb 570-checker-osr (with and without -O),
      set breakpoint in dlopen and observe that only the
      correct libraries are loaded.
Change-Id: I4922b6bc5f6d99ed59a810fcedc3991c4509d2a2
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 6444eb9..a60c858 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -868,7 +868,12 @@
     fi
 
     # System libraries needed by libarttestd.so
-    PUBLIC_LIBS=libart.so:libartd.so:libc++.so:libbacktrace.so:libdexfile.so:libdexfiled.so:libbase.so:libnativehelper.so
+    PUBLIC_LIBS=libc++.so:libbacktrace.so:libbase.so:libnativehelper.so
+    if [ "$TEST_IS_NDEBUG" = "y" ]; then
+      PUBLIC_LIBS=$PUBLIC_LIBS:libart.so:libdexfile.so
+    else
+      PUBLIC_LIBS=$PUBLIC_LIBS:libartd.so:libdexfiled.so
+    fi
 
     # Create a script with the command. The command can get longer than the longest
     # allowed adb command and there is no way to get the exit status from a adb shell