Fix test scripts to account for new linker behavior

Remove /system/lib from the java.library.path to
avoid loading system libraries in classloader-namespace
by dependencies originated from libarttestd.so

Add additional libraries used by libarttestd.so to
the list of public libraries.

Bug: http://b/26833548
Test: m -j32 test-art-target
Change-Id: I8cfb1b1bec17ca32b2c691597a97b4e9d1667a2f
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 186a151..5ef645c 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -589,7 +589,8 @@
       LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBRARY_DIRECTORY:$LD_LIBRARY_PATH
     fi
 
-    PUBLIC_LIBS=libart.so:libartd.so
+    # System libraries needed by libarttestd.so
+    PUBLIC_LIBS=libart.so:libartd.so:libc++.so:libbacktrace.so:libbase.so:libnativehelper.so
 
     # 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
diff --git a/test/run-test b/test/run-test
index 27c700e..7bf7b30 100755
--- a/test/run-test
+++ b/test/run-test
@@ -495,7 +495,7 @@
         run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}:${ANDROID_HOST_OUT}/nativetest${suffix64}"
     else
         guess_target_arch_name
-        run_args="${run_args} --runtime-option -Djava.library.path=/data/nativetest${suffix64}/art/${target_arch_name}:${android_root}/lib${suffix64}"
+        run_args="${run_args} --runtime-option -Djava.library.path=/data/nativetest${suffix64}/art/${target_arch_name}"
         run_args="${run_args} --boot /data/art-test/core${image_suffix}${pic_image_suffix}${multi_image_suffix}.art"
     fi
     if [ "$relocate" = "yes" ]; then