Make run-{libcore,jdwp}-tests work with OUT_DIR set.

Change the two scripts to use the value of the OUT_DIR environment
variable if it is set to find the build directory. If OUT_DIR is not
set just fall back to the default 'out/'.

Change-Id: I19824d792d5dcbed32846912fb36654894fcc0ac
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index 104cba7..edec362 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -20,7 +20,7 @@
 fi
 
 # Jar containing all the tests.
-test_jar=out/host/linux-x86/framework/apache-harmony-jdwp-tests-hostdex.jar
+test_jar=${OUT_DIR-out}/host/linux-x86/framework/apache-harmony-jdwp-tests-hostdex.jar
 
 if [ ! -f $test_jar ]; then
   echo "Before running, you must build jdwp tests and vogar:" \
@@ -48,8 +48,8 @@
   if [[ "$1" == "--mode=host" ]]; then
     # Specify bash explicitly since the art script cannot, since it has to run on the device
     # with mksh.
-    art="bash out/host/linux-x86/bin/art"
-    art_debugee="bash out/host/linux-x86/bin/art"
+    art="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
+    art_debugee="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
     # We force generation of a new image to avoid build-time and run-time classpath differences.
     image="-Ximage:/system/non/existent"
     # We do not need a device directory on host.
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index a84365a..26d9ad7 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -20,10 +20,10 @@
 fi
 
 # Jar containing jsr166 tests.
-jsr166_test_jar=out/target/common/obj/JAVA_LIBRARIES/jsr166-tests_intermediates/javalib.jar
+jsr166_test_jar=${OUT_DIR-out}/target/common/obj/JAVA_LIBRARIES/jsr166-tests_intermediates/javalib.jar
 
 # Jar containing all the other tests.
-test_jar=out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
+test_jar=${OUT_DIR-out}/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar
 
 
 if [ ! -f $test_jar ]; then