Merge changes Ifc661bd2,Iba4ed7be

* changes:
  Run device tests as the shell user.
  Remove dead code.
diff --git a/Android.bp b/Android.bp
index cb7b697..951e3fc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,10 +14,47 @@
 // limitations under the License.
 //
 
+cc_defaults {
+    name: "libc++ defaults",
+    host_supported: true,
+    local_include_dirs: ["include"],
+    export_include_dirs: ["include"],
+    cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
+    cppflags: [
+        "-std=c++14",
+        "-nostdinc++",
+        "-fexceptions",
+        "-DLIBCXX_BUILDING_LIBCXXABI",
+        "-D_LIBCPP_BUILDING_LIBRARY",
+    ],
+    rtti: true,
+    stl: "none",
+    target: {
+        linux_bionic: {
+            enabled: true,
+        },
+        windows: {
+            enabled: true,
+            cflags: [
+                "-D_LIBCPP_HAS_THREAD_API_WIN32",
+                "-D_LIBCXXABI_BUILDING_LIBRARY",
+                "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+                "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+                "-UWIN32_LEAN_AND_MEAN",
+            ],
+        },
+        windows_x86: {
+            cflags: [
+                "-fsjlj-exceptions",
+            ],
+        },
+    },
+}
+
 // host + device static lib
 cc_library_static {
     name: "libc++_static",
-    host_supported: true,
+    defaults: ["libc++ defaults"],
     vendor_available: true,
     recovery_available: true,
     srcs: [
@@ -52,43 +89,15 @@
         "src/variant.cpp",
         "src/vector.cpp",
     ],
-    local_include_dirs: ["include"],
-    export_include_dirs: ["include"],
-    cflags: ["-Wall", "-Werror", "-Wno-unused-parameter"],
-    cppflags: [
-        "-std=c++14",
-        "-nostdinc++",
-        "-fexceptions",
-        "-DLIBCXX_BUILDING_LIBCXXABI",
-        "-D_LIBCPP_BUILDING_LIBRARY",
-    ],
-    rtti: true,
     whole_static_libs: [
         "libc++abi",
     ],
-    stl: "none",
     target: {
-        linux_bionic: {
-            enabled: true,
-        },
         windows: {
-            enabled: true,
-            cflags: [
-                "-D_LIBCPP_HAS_THREAD_API_WIN32",
-                "-D_LIBCXXABI_BUILDING_LIBRARY",
-                "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-                "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-                "-UWIN32_LEAN_AND_MEAN",
-            ],
             srcs: [
                 "src/support/win32/*.cpp",
             ]
         },
-        windows_x86: {
-            cflags: [
-                "-fsjlj-exceptions",
-            ],
-        },
     },
 }
 
@@ -129,6 +138,14 @@
     },
 }
 
+cc_library_static {
+    name: "libc++experimental",
+    defaults: ["libc++ defaults"],
+    srcs: [
+        "src/experimental/memory_resource.cpp",
+    ],
+}
+
 // This target is used to extract the build commands for a test executable.
 // See run_tests.py.
 cc_binary {
@@ -151,6 +168,9 @@
         // http://llvm.org/bugs/show_bug.cgi?id=21421
         "-O0",
     ],
+    static_libs: [
+        "libc++experimental",
+    ],
     rtti: true,
     local_include_dirs: [
         "test/support",
diff --git a/utils/libcxx/android/test/config.py b/utils/libcxx/android/test/config.py
index 1356f05..612aa36 100644
--- a/utils/libcxx/android/test/config.py
+++ b/utils/libcxx/android/test/config.py
@@ -51,6 +51,7 @@
 
     def configure_features(self):
         self.config.available_features.add('long_tests')
+        self.config.available_features.add('c++experimental')
         std_pattern = re.compile(r'-std=(c\+\+\d[0-9x-z])')
         match = std_pattern.search(self.cxx.cxx_template)
         if match: