Merge "ART: Do not load wrong libart(d)/libdexfile(d).so for tests."
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 43684f8..86adb73 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -865,7 +865,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