Fix DX Tests Compilation Script

Bug 3323353

Don't rely on environment variables like ANDROID_BUILD_TOP in the
script. Instead pass in the out directory via the Makefile.

Change-Id: I2b4533750137fe13c265da6d0f8752696352f403
diff --git a/tools/dx-tests/Android.mk b/tools/dx-tests/Android.mk
index 9dee47d..9bdef58 100644
--- a/tools/dx-tests/Android.mk
+++ b/tools/dx-tests/Android.mk
@@ -38,7 +38,7 @@
 	@echo "Copy: $(PRIVATE_MODULE) ($@)"
 	$(copy-file-to-new-target)
 	$(hide) chmod 755 $@
-	@$(PRIVATE_CURRENT_MODULE_SCRIPT) "$(PRIVATE_BASE)" "$(HOST_JAVAC)" "$(PRIVATE_INTERMEDIATES)" "$(HOST_OUT_JAVA_LIBRARIES)/dx.jar:$(HOST_OUT_JAVA_LIBRARIES)/cfassembler.jar"
+	@$(PRIVATE_CURRENT_MODULE_SCRIPT) "$(PRIVATE_BASE)" "$(HOST_JAVAC)" "$(PRIVATE_INTERMEDIATES)" "$(HOST_OUT_JAVA_LIBRARIES)/dx.jar:$(HOST_OUT_JAVA_LIBRARIES)/cfassembler.jar" "$(HOST_OUT)"
 
 # cfassembler host module
 #============================================================
diff --git a/tools/dx-tests/etc/compileall b/tools/dx-tests/etc/compileall
index 42b198e..cb95b4e 100755
--- a/tools/dx-tests/etc/compileall
+++ b/tools/dx-tests/etc/compileall
@@ -54,6 +54,7 @@
 javac=$2
 tmpdir=$3 # ANDROID_BUILD_TOP/$3
 dxjarpath=$4
+outdir=$5
 project_src=$project_home/src
 project_lib=$project_home/lib
 project_data=$project_home/data
@@ -103,7 +104,7 @@
 javac -d $javac_out -classpath $project_lib/junit.jar:$javac_out -sourcepath $mainfilesdir \@$mainfileslist
 
 # now copy relevant data from intermediates dir to its final destination
-fdest=$ANDROID_BUILD_TOP/out/target/common/cts/dxconverter
+fdest=$outdir/cts/dxconverter
 mkdir -p $fdest/data
 acp -r $javac_out $fdest/
 acp $mainfilesdir/data/scriptdata $fdest/data/scriptdata
diff --git a/tools/dx-tests/etc/starttests b/tools/dx-tests/etc/starttests
index e43a00a..afa55a8 100755
--- a/tools/dx-tests/etc/starttests
+++ b/tools/dx-tests/etc/starttests
@@ -74,7 +74,7 @@
 debug_opts="-Xcheck:jni"
 exe=$base/system/bin/dalvikvm
 bpath=$framework/core.jar
-BASEDIR=$ANDROID_BUILD_TOP/out/target/common/cts/dxconverter
+BASEDIR=$progdir/../cts/dxconverter
 
 echo "--------------------------------------------------"
 echo "DX Converter Test Suite"