Make test work when running ndebug.

Change-Id: Iea58ccef51fddaeae4b1fb7084a7956400a81dfe
Test: ART_TEST_RUN_TEST_NDEBUG=true mma -j40 test-art-host-run-test-900-hello-plugin
diff --git a/test/900-hello-plugin/run b/test/900-hello-plugin/run
index bb9b415..35b0871 100755
--- a/test/900-hello-plugin/run
+++ b/test/900-hello-plugin/run
@@ -14,7 +14,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+plugin=libartagentd.so
+if  [[ "$@" == *"-O"* ]]; then
+  plugin=libartagent.so
+fi
 ./default-run "$@" --experimental agents \
                    --experimental runtime-plugins \
-                   --runtime-option -agentpath:libartagentd.so=test_900 \
-                   --android-runtime-option -Xplugin:libartagentd.so
+                   --runtime-option -agentpath:${plugin}=test_900 \
+                   --android-runtime-option -Xplugin:${plugin}
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 0ea5d52..d12bd79 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -60,6 +60,9 @@
     if [ "x$1" = "x--quiet" ]; then
         QUIET="y"
         shift
+    elif [ "x$1" = "x-O" ]; then
+        # Ignore this option.
+        shift
     elif [ "x$1" = "x--lib" ]; then
         shift
         if [ "x$1" = "x" ]; then
diff --git a/test/run-test b/test/run-test
index edee4ae..621fc24 100755
--- a/test/run-test
+++ b/test/run-test
@@ -165,6 +165,7 @@
     elif [ "x$1" = "x-O" ]; then
         lib="libart.so"
         testlib="arttest"
+        run_args="${run_args} -O"
         shift
     elif [ "x$1" = "x--dalvik" ]; then
         lib="libdvm.so"