Add --dry-run flag to run-libcore-tests.sh

Flag prints vogar command that would be invoked otherwise.

Test: art/tools/run-libcore-tests.sh --host --dry-run
Test: art/tools/run-libcore-tests.sh --host
Change-Id: Ie6dba8e8e12c0d3668ac430115c83373f7464720
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 5bc208e..64c01e7 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -130,6 +130,7 @@
 vogar_args=$@
 gcstress=false
 debug=false
+dry_run=false
 
 # Run tests that use the getrandom() syscall? (Requires Linux 3.17+).
 getrandom=true
@@ -172,6 +173,11 @@
     vogar_args=${vogar_args/$1}
     getrandom=false
     shift
+  elif [[ "$1" == "--dry-run" ]]; then
+    # Remove the option from Vogar arguments.
+    vogar_args=${vogar_args/$1}
+    dry_run=true
+    shift
   elif [[ "$1" == "" ]]; then
     break
   else
@@ -241,4 +247,4 @@
 
 cmd="vogar $vogar_args $expectations $(cparg $DEPS) ${working_packages[@]}"
 echo "Running $cmd"
-eval $cmd
+$dry_run || eval $cmd