summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2017-12-19 21:24:39 -0600
committerGerrit Code Review2017-12-19 21:24:39 -0600
commitdf9fbc7d75ba4148c4849924bf945fd44f01abb3 (patch)
tree9efcad025385b4e067769e50ed456643256eb4d7 /debuggerd
parente6b83cfe5a6c4015993676774869ac63d38dc5e9 (diff)
parent30171a8b475df2989276f65dcc80fbaa786e1fba (diff)
downloadplatform-system-core-df9fbc7d75ba4148c4849924bf945fd44f01abb3.tar.gz
platform-system-core-df9fbc7d75ba4148c4849924bf945fd44f01abb3.tar.xz
platform-system-core-df9fbc7d75ba4148c4849924bf945fd44f01abb3.zip
Merge "base: extract {ASSERT,EXPECT}_MATCH helpers from debuggerd_test."
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/debuggerd_test.cpp17
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 @@
36#include <android-base/parseint.h> 36#include <android-base/parseint.h>
37#include <android-base/properties.h> 37#include <android-base/properties.h>
38#include <android-base/strings.h> 38#include <android-base/strings.h>
39#include <android-base/test_utils.h>
39#include <android-base/unique_fd.h> 40#include <android-base/unique_fd.h>
40#include <cutils/sockets.h> 41#include <cutils/sockets.h>
41#include <gtest/gtest.h> 42#include <gtest/gtest.h>
@@ -75,22 +76,6 @@ constexpr char kWaitForGdbKey[] = "debug.debuggerd.wait_for_gdb";
75 return value; \ 76 return value; \
76 }() 77 }()
77 78
78#define ASSERT_MATCH(str, pattern) \
79 do { \
80 std::regex r((pattern)); \
81 if (!std::regex_search((str), r)) { \
82 FAIL() << "regex mismatch: expected " << (pattern) << " in: \n" << (str); \
83 } \
84 } while (0)
85
86#define ASSERT_NOT_MATCH(str, pattern) \
87 do { \
88 std::regex r((pattern)); \
89 if (std::regex_search((str), r)) { \
90 FAIL() << "regex mismatch: expected to not find " << (pattern) << " in: \n" << (str); \
91 } \
92 } while (0)
93
94#define ASSERT_BACKTRACE_FRAME(result, frame_name) \ 79#define ASSERT_BACKTRACE_FRAME(result, frame_name) \
95 ASSERT_MATCH(result, R"(#\d\d pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX \ 80 ASSERT_MATCH(result, R"(#\d\d pc [0-9a-f]+\s+ /system/lib)" ARCH_SUFFIX \
96 R"(/libc.so \()" frame_name R"(\+)") 81 R"(/libc.so \()" frame_name R"(\+)")