Fix gtest_filter of bionic gtest runner.

Bug: http://b/29514723
Test: run bionic-unit-tests --gtest-filter='*grp*'
Change-Id: I45ed561702bd601bae84c8d77824aa5769dbfa9c
diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp
index 6018ef5..f0dac7c 100644
--- a/tests/gtest_main.cpp
+++ b/tests/gtest_main.cpp
@@ -1020,16 +1020,16 @@
   std::string gtest_filter_str;
   for (size_t i = args.size() - 1; i >= 1; --i) {
     if (strncmp(args[i], "--gtest_filter=", strlen("--gtest_filter=")) == 0) {
-      gtest_filter_str = std::string(args[i]);
+      gtest_filter_str = args[i] + strlen("--gtest_filter=");
       args.erase(args.begin() + i);
       break;
     }
   }
   if (enable_selftest == true) {
-    args.push_back(strdup("--gtest_filter=bionic_selftest*"));
+    gtest_filter_str = "bionic_selftest*";
   } else {
-    if (gtest_filter_str == "") {
-      gtest_filter_str = "--gtest_filter=-bionic_selftest*";
+    if (gtest_filter_str.empty()) {
+      gtest_filter_str = "-bionic_selftest*";
     } else {
       // Find if '-' for NEGATIVE_PATTERNS exists.
       if (gtest_filter_str.find("-") != std::string::npos) {
@@ -1038,8 +1038,9 @@
         gtest_filter_str += ":-bionic_selftest*";
       }
     }
-    args.push_back(strdup(gtest_filter_str.c_str()));
   }
+  gtest_filter_str = "--gtest_filter=" + gtest_filter_str;
+  args.push_back(strdup(gtest_filter_str.c_str()));
 
   options.isolate = true;
   // Parse arguments that make us can't run in isolation mode.