diff options
author | Josh Gao <jmgao@google.com> | 2017-04-27 19:48:44 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2017-12-19 17:16:12 -0800 |
commit | 30171a8b475df2989276f65dcc80fbaa786e1fba (patch) | |
tree | ce803dcca3337951975fa15c1d5759a313849f57 /debuggerd/debuggerd_test.cpp | |
parent | 51c2088f3be507f83c7580dd06c5e3c271116285 (diff) |
base: extract {ASSERT,EXPECT}_MATCH helpers from debuggerd_test.
Add some helper macros that perform regex string matching to
<android-base/test_utils.h>.
Test: libbase_test32/64 on host
Change-Id: I1b0f03dc73f8b4fdfb8ac6c75d59ef421e0e9640
Diffstat (limited to 'debuggerd/debuggerd_test.cpp')
-rw-r--r-- | debuggerd/debuggerd_test.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp index 0d17a3b5c..939f4d257 100644 --- a/debuggerd/debuggerd_test.cpp +++ b/debuggerd/debuggerd_test.cpp @@ -36,6 +36,7 @@ #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/strings.h> +#include <android-base/test_utils.h> #include <android-base/unique_fd.h> #include <cutils/sockets.h> #include <gtest/gtest.h> @@ -75,22 +76,6 @@ constexpr char kWaitForGdbKey[] = "debug.debuggerd.wait_for_gdb"; return value; \ }() -#define ASSERT_MATCH(str, pattern) \ - do { \ - std::regex r((pattern)); \ - if (!std::regex_search((str), r)) { \ - FAIL() << "regex mismatch: expected " << (pattern) << " in: \n" << (str); \ - } \ - } while (0) - -#define ASSERT_NOT_MATCH(str, pattern) \ - do { \ - std::regex r((pattern)); \ - if (std::regex_search((str), r)) { \ - FAIL() << "regex mismatch: expected to not find " << (pattern) << " in: \n" << (str); \ - } \ - } while (0) - #define ASSERT_BACKTRACE_FRAME(result, frame_name) \ ASSERT_MATCH(result, R"(#\d\d pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX \ R"(/libc.so \()" frame_name R"(\+)") |