Move isolated test runner out of bionic.

Use a global gtest isolation runner rather than the custom one in
bionic.

Test: Ran all unit tests and verified same behavior before and after.

Change-Id: I24a7cf17cf8e018d0f51969c64b53ce9059cc779
diff --git a/tests/Android.bp b/tests/Android.bp
index d403492..5ba6b3d 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -309,33 +309,6 @@
     },
 }
 
-// -----------------------------------------------------------------------------
-// Library of bionic customized gtest main function, with simplified output format.
-// -----------------------------------------------------------------------------
-cc_test_library {
-    name: "libBionicGtestMain",
-    defaults: ["bionic_tests_defaults"],
-    srcs: [
-        "gtest_main.cpp",
-        "gtest_globals.cpp",
-    ],
-    whole_static_libs: [
-        "libbase",
-        "liblog",
-    ],
-    include_dirs: [
-        "bionic/libc",
-    ],
-    target: {
-        darwin: {
-            enabled: true,
-        },
-    },
-    shared: {
-        enabled: false,
-    },
-}
-
 cc_test_library {
     name: "libBionicLoaderTests",
     defaults: [
@@ -388,16 +361,15 @@
     name: "libBionicCtsGtestMain",
     defaults: ["bionic_tests_defaults"],
     srcs: [
-        "gtest_main.cpp",
         "gtest_globals_cts.cpp",
+        "gtest_main.cpp",
     ],
-    static_libs: [
-        "libbase",
-    ],
-    cppflags: ["-DUSING_GTEST_OUTPUT_FORMAT"],
     shared: {
         enabled: false,
     },
+    whole_static_libs: [
+        "libgtest_isolated",
+    ],
 }
 
 // -----------------------------------------------------------------------------
@@ -412,7 +384,6 @@
     whole_static_libs: [
         "libBionicTests",
         "libBionicLoaderTests",
-        "libBionicGtestMain",
     ],
 
     static_libs: [
@@ -424,6 +395,7 @@
     srcs: [
         // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
         "__cxa_thread_atexit_test.cpp",
+        "gtest_globals.cpp",
         "thread_local_test.cpp",
     ],
 
@@ -471,11 +443,20 @@
 
 cc_test {
     name: "bionic-unit-tests",
+    gtest: false,
     defaults: [
         "bionic_unit_tests_defaults",
         "bionic_tests_defaults",
     ],
 
+    srcs: [
+        "gtest_main.cpp",
+    ],
+
+    static_libs: [
+        "libgtest_isolated",
+    ],
+
     target: {
         android: {
             shared_libs: ["libicuuc"],
@@ -619,15 +600,17 @@
 // -----------------------------------------------------------------------------
 cc_test {
     name: "bionic-unit-tests-static",
+    gtest: false,
     defaults: ["bionic_tests_defaults"],
     host_supported: false,
 
     srcs: [
         "gtest_preinit_debuggerd.cpp",
+        "gtest_globals.cpp",
+        "gtest_main.cpp",
     ],
     whole_static_libs: [
         "libBionicTests",
-        "libBionicGtestMain",
     ],
 
     static_libs: [
@@ -638,6 +621,7 @@
         "liblog",
         "libbase",
         "libdebuggerd_handler",
+        "libgtest_isolated",
     ],
 
     static_executable: true,
@@ -651,6 +635,7 @@
 
 cc_test_host {
     name: "bionic-unit-tests-glibc",
+    gtest: false,
     defaults: ["bionic_tests_defaults"],
 
     srcs: [
@@ -658,6 +643,8 @@
         "dlfcn_symlink_support.cpp",
         "dlfcn_test.cpp",
         "dl_test.cpp",
+        "gtest_globals.cpp",
+        "gtest_main.cpp",
         "pthread_dlfcn_test.cpp",
     ],
 
@@ -670,7 +657,6 @@
 
     whole_static_libs: [
         "libBionicStandardTests",
-        "libBionicGtestMain",
         "libfortify1-tests-clang",
         "libfortify2-tests-clang",
     ],
@@ -679,6 +665,7 @@
         "libbase",
         "liblog",
         "libcutils",
+        "libgtest_isolated",
     ],
 
     host_ldlibs: [
@@ -686,7 +673,9 @@
         "-lutil",
     ],
 
-    include_dirs: ["bionic/libc"],
+    include_dirs: [
+        "bionic/libc",
+    ],
 
     ldflags: [
         "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",