Revert "Revert "test: Add desugar support to run-test""

This reverts commit 75e7c9cc3db9547127dbc706f9a4fade54a41600.

Change-Id: I7932e27b5307bbe7b60184dd5faf24bd336aa63a
diff --git a/test/run-test b/test/run-test
index 41a0dc2..ba1f992 100755
--- a/test/run-test
+++ b/test/run-test
@@ -46,6 +46,7 @@
 export DEX_LOCATION=/data/run-test/${test_dir}
 export NEED_DEX="true"
 export USE_JACK="true"
+export USE_DESUGAR="true"
 export SMALI_ARGS=""
 
 # If dx was not set by the environment variable, assume it is in the path.
@@ -771,6 +772,16 @@
   err_echo "ulimit file size setting failed"
 fi
 
+if [[ "$target_mode" == "yes" ]]; then
+  build_args="$build_args --target"
+else
+  build_args="$build_args --host"
+fi
+
+if [[ "$dev_mode" == "yes" ]]; then
+  build_args="$build_args --dev"
+fi
+
 good="no"
 good_build="yes"
 good_run="yes"