Merge "Revert "Track strerror(3) change.""
diff --git a/Android.bp b/Android.bp
index 0d32885..5648d06 100644
--- a/Android.bp
+++ b/Android.bp
@@ -147,9 +147,7 @@
         "libbase_headers",
     ],
     export_header_lib_headers: ["libbase_headers"],
-    static_libs: ["fmtlib"],
     whole_static_libs: ["fmtlib"],
-    export_static_lib_headers: ["fmtlib"],
     apex_available: [
         "//apex_available:anyapex",
         "//apex_available:platform",
@@ -162,9 +160,7 @@
     sdk_version: "current",
     stl: "c++_static",
     export_include_dirs: ["include"],
-    static_libs: ["fmtlib_ndk"],
     whole_static_libs: ["fmtlib_ndk"],
-    export_static_lib_headers: ["fmtlib_ndk"],
 }
 
 // Tests
diff --git a/include/android-base/test_utils.h b/include/android-base/test_utils.h
index f3d7cb0..4086b83 100644
--- a/include/android-base/test_utils.h
+++ b/include/android-base/test_utils.h
@@ -18,6 +18,7 @@
 
 #include <regex>
 #include <string>
+#include <type_traits>
 
 #include <android-base/file.h>
 #include <android-base/macros.h>
@@ -53,34 +54,37 @@
   CapturedStdout() : CapturedStdFd(STDOUT_FILENO) {}
 };
 
-#define ASSERT_MATCH(str, pattern)                                           \
-  do {                                                                       \
-    auto __s = (str);                                                        \
-    if (!std::regex_search(__s, std::regex((pattern)))) {                    \
-      FAIL() << "regex mismatch: expected " << (pattern) << " in:\n" << __s; \
-    }                                                                        \
+#define __LIBBASE_GENERIC_REGEX_SEARCH(__s, __pattern) \
+  (std::regex_search(__s, std::basic_regex<std::decay<decltype(__s[0])>::type>((__pattern))))
+
+#define ASSERT_MATCH(__string, __pattern)                                      \
+  do {                                                                         \
+    auto __s = (__string);                                                     \
+    if (!__LIBBASE_GENERIC_REGEX_SEARCH(__s, (__pattern))) {                   \
+      FAIL() << "regex mismatch: expected " << (__pattern) << " in:\n" << __s; \
+    }                                                                          \
   } while (0)
 
-#define ASSERT_NOT_MATCH(str, pattern)                                                   \
-  do {                                                                                   \
-    auto __s = (str);                                                                    \
-    if (std::regex_search(__s, std::regex((pattern)))) {                                 \
-      FAIL() << "regex mismatch: expected to not find " << (pattern) << " in:\n" << __s; \
-    }                                                                                    \
+#define ASSERT_NOT_MATCH(__string, __pattern)                                              \
+  do {                                                                                     \
+    auto __s = (__string);                                                                 \
+    if (__LIBBASE_GENERIC_REGEX_SEARCH(__s, (__pattern))) {                                \
+      FAIL() << "regex mismatch: expected to not find " << (__pattern) << " in:\n" << __s; \
+    }                                                                                      \
   } while (0)
 
-#define EXPECT_MATCH(str, pattern)                                                  \
-  do {                                                                              \
-    auto __s = (str);                                                               \
-    if (!std::regex_search(__s, std::regex((pattern)))) {                           \
-      ADD_FAILURE() << "regex mismatch: expected " << (pattern) << " in:\n" << __s; \
-    }                                                                               \
+#define EXPECT_MATCH(__string, __pattern)                                             \
+  do {                                                                                \
+    auto __s = (__string);                                                            \
+    if (!__LIBBASE_GENERIC_REGEX_SEARCH(__s, (__pattern))) {                          \
+      ADD_FAILURE() << "regex mismatch: expected " << (__pattern) << " in:\n" << __s; \
+    }                                                                                 \
   } while (0)
 
-#define EXPECT_NOT_MATCH(str, pattern)                                                          \
-  do {                                                                                          \
-    auto __s = (str);                                                                           \
-    if (std::regex_search(__s, std::regex((pattern)))) {                                        \
-      ADD_FAILURE() << "regex mismatch: expected to not find " << (pattern) << " in:\n" << __s; \
-    }                                                                                           \
+#define EXPECT_NOT_MATCH(__string, __pattern)                                                     \
+  do {                                                                                            \
+    auto __s = (__string);                                                                        \
+    if (__LIBBASE_GENERIC_REGEX_SEARCH(__s, (__pattern))) {                                       \
+      ADD_FAILURE() << "regex mismatch: expected to not find " << (__pattern) << " in:\n" << __s; \
+    }                                                                                             \
   } while (0)
diff --git a/test_utils_test.cpp b/test_utils_test.cpp
index d08d5d6..10e8a2a 100644
--- a/test_utils_test.cpp
+++ b/test_utils_test.cpp
@@ -27,21 +27,33 @@
 TEST(TestUtilsTest, AssertMatch) {
   ASSERT_MATCH("foobar", R"(fo+baz?r)");
   EXPECT_FATAL_FAILURE(ASSERT_MATCH("foobar", R"(foobaz)"), "regex mismatch");
+
+  ASSERT_MATCH(L"foobar", LR"(fo+baz?r)");
+  EXPECT_FATAL_FAILURE(ASSERT_MATCH(L"foobar", LR"(foobaz)"), "regex mismatch");
 }
 
 TEST(TestUtilsTest, AssertNotMatch) {
   ASSERT_NOT_MATCH("foobar", R"(foobaz)");
   EXPECT_FATAL_FAILURE(ASSERT_NOT_MATCH("foobar", R"(foobar)"), "regex mismatch");
+
+  ASSERT_NOT_MATCH(L"foobar", LR"(foobaz)");
+  EXPECT_FATAL_FAILURE(ASSERT_NOT_MATCH(L"foobar", LR"(foobar)"), "regex mismatch");
 }
 
 TEST(TestUtilsTest, ExpectMatch) {
   EXPECT_MATCH("foobar", R"(fo+baz?r)");
   EXPECT_NONFATAL_FAILURE(EXPECT_MATCH("foobar", R"(foobaz)"), "regex mismatch");
+
+  EXPECT_MATCH(L"foobar", LR"(fo+baz?r)");
+  EXPECT_NONFATAL_FAILURE(EXPECT_MATCH(L"foobar", LR"(foobaz)"), "regex mismatch");
 }
 
 TEST(TestUtilsTest, ExpectNotMatch) {
   EXPECT_NOT_MATCH("foobar", R"(foobaz)");
   EXPECT_NONFATAL_FAILURE(EXPECT_NOT_MATCH("foobar", R"(foobar)"), "regex mismatch");
+
+  EXPECT_NOT_MATCH(L"foobar", LR"(foobaz)");
+  EXPECT_NONFATAL_FAILURE(EXPECT_NOT_MATCH(L"foobar", LR"(foobar)"), "regex mismatch");
 }
 
 TEST(TestUtilsTest, CaptureStdout_smoke) {