1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "utility_common_utils_test.h"
17
18 #include <unistd.h>
19
20 #include "calc_fingerprint.h"
21 #include "file_util.h"
22 #include "log_parse.h"
23 #include "tbox.h"
24
25 using namespace std;
26
27 namespace OHOS {
28 namespace HiviewDFX {
29 namespace {
30 const char LOG_FILE_PATH[] = "/data/test/hiview_utility_test/";
31 constexpr int SUFFIX_0 = 0;
32
GetLogDir(std::string & testCaseName)33 std::string GetLogDir(std::string& testCaseName)
34 {
35 std::string workPath = std::string(LOG_FILE_PATH);
36 if (workPath.back() != '/') {
37 workPath = workPath + "/";
38 }
39 workPath.append(testCaseName);
40 workPath.append("/");
41 std::string logDestDir = workPath;
42 if (!FileUtil::FileExists(logDestDir)) {
43 FileUtil::ForceCreateDirectory(logDestDir, FileUtil::FILE_PERM_770);
44 }
45 return logDestDir;
46 }
47
GenerateLogFileName(std::string & testCaseName,int index)48 std::string GenerateLogFileName(std::string& testCaseName, int index)
49 {
50 return GetLogDir(testCaseName) + "testFile" + std::to_string(index);
51 }
52 }
53
SetUpTestCase()54 void UtilityCommonUtilsTest::SetUpTestCase() {}
55
TearDownTestCase()56 void UtilityCommonUtilsTest::TearDownTestCase() {}
57
SetUp()58 void UtilityCommonUtilsTest::SetUp() {}
59
TearDown()60 void UtilityCommonUtilsTest::TearDown()
61 {
62 (void)FileUtil::ForceRemoveDirectory(LOG_FILE_PATH);
63 }
64
65 /**
66 * @tc.name: CalcFingerprintTest001
67 * @tc.desc: Test CalcFileSha interface method of class CalcFingerprint
68 * @tc.type: FUNC
69 * @tc.require: issueI65DUW
70 */
71 HWTEST_F(UtilityCommonUtilsTest, CalcFingerprintTest001, testing::ext::TestSize.Level3)
72 {
73 (void)FileUtil::ForceRemoveDirectory(LOG_FILE_PATH);
74 std::string caseName = "CalcFingerprintTest001";
75 CalcFingerprint calcFingerprint;
76 char hash[SHA256_DIGEST_LENGTH] = {0};
77 auto ret = calcFingerprint.CalcFileSha("", hash, SHA256_DIGEST_LENGTH);
78 ASSERT_EQ(EINVAL, ret);
79 ret = calcFingerprint.CalcFileSha(GenerateLogFileName(caseName, SUFFIX_0), hash, SHA256_DIGEST_LENGTH);
80 ASSERT_EQ(ENOENT, ret);
81 ret = calcFingerprint.CalcFileSha("//....../asdsa", hash, SHA256_DIGEST_LENGTH);
82 ASSERT_EQ(EINVAL, ret);
83 FileUtil::SaveStringToFile(GenerateLogFileName(caseName, SUFFIX_0), "test");
84 ret = calcFingerprint.CalcFileSha(GenerateLogFileName(caseName, SUFFIX_0), nullptr, SHA256_DIGEST_LENGTH);
85 ASSERT_EQ(EINVAL, ret);
86 int invalidLen = 2;
87 ret = calcFingerprint.CalcFileSha(GenerateLogFileName(caseName, SUFFIX_0), hash, invalidLen);
88 ASSERT_EQ(ENOMEM, ret);
89 }
90
91 /**
92 * @tc.name: CalcFingerprintTest002
93 * @tc.desc: Test CalcBufferSha interface method of class CalcFingerprint
94 * @tc.type: FUNC
95 * @tc.require: issueI65DUW
96 */
97 HWTEST_F(UtilityCommonUtilsTest, CalcFingerprintTest002, testing::ext::TestSize.Level3)
98 {
99 (void)FileUtil::ForceRemoveDirectory(LOG_FILE_PATH);
100 CalcFingerprint calcFingerprint;
101 char hash[SHA256_DIGEST_LENGTH] = {0};
102 std::string buffer1 = "";
103 auto ret = calcFingerprint.CalcBufferSha(buffer1, buffer1.size(), hash, SHA256_DIGEST_LENGTH);
104 ASSERT_EQ(EINVAL, ret);
105 std::string buffer2 = "123";
106 ret = calcFingerprint.CalcBufferSha(buffer2, buffer2.size(), nullptr, SHA256_DIGEST_LENGTH);
107 ASSERT_EQ(EINVAL, ret);
108 }
109
110 /* @tc.name: LogParseTest001
111 * @tc.desc: Test IsIgnoreLibrary interface method of class LogParse
112 * @tc.type: FUNC
113 * @tc.require: issueI65DUW
114 */
115 HWTEST_F(UtilityCommonUtilsTest, LogParseTest001, testing::ext::TestSize.Level3)
116 {
117 LogParse logParse;
118 auto ret = logParse.IsIgnoreLibrary("watchdog");
119 ASSERT_TRUE(ret);
120 ret = logParse.IsIgnoreLibrary("ohos");
121 ASSERT_TRUE(!ret);
122 }
123
124 /* @tc.name: LogParseTest002
125 * @tc.desc: Test GetValidBlock multiPart size is 0
126 * @tc.type: FUNC
127 */
128 HWTEST_F(UtilityCommonUtilsTest, LogParseTest002, testing::ext::TestSize.Level3)
129 {
130 LogParse logParse;
131 std::stack<std::string> inStack;
132 std::vector<std::string> lastPart;
133 auto ret = logParse.GetValidBlock(inStack, lastPart);
134 ASSERT_TRUE(ret.empty());
135 }
136
137 /* @tc.name: TboxTest001
138 * @tc.desc: Test interfaces method of class Tbox
139 * @tc.type: FUNC
140 * @tc.require: issueI65DUW
141 */
142 HWTEST_F(UtilityCommonUtilsTest, TboxTest001, testing::ext::TestSize.Level3)
143 {
144 auto tboxSp = make_shared<Tbox>(); // trigger con/destrcutor
145 std::string val = "123";
146 size_t mask = 1;
147 int mode1 = FP_FILE;
148 auto ret = Tbox::CalcFingerPrint(val, mask, mode1);
149 ASSERT_TRUE(!ret.empty());
150 int mode2 = FP_BUFFER;
151 ret = Tbox::CalcFingerPrint(val, mask, mode2);
152 ASSERT_TRUE(!ret.empty());
153 int invalidMode = -1;
154 ret = Tbox::CalcFingerPrint(val, mask, invalidMode);
155 ASSERT_TRUE(ret == "0");
156 std::string stackName = "-_";
157 auto ret2 = Tbox::IsCallStack(stackName);
158 ASSERT_TRUE(ret2);
159 std::string stackName2 = "123";
160 auto ret3 = Tbox::IsCallStack(stackName2);
161 ASSERT_TRUE(ret3);
162 }
163
164 /* @tc.name: TboxTest002
165 * @tc.desc: Test GetStackName method of class Tbox
166 * @tc.type: FUNC
167 * @tc.require: issueI65DUW
168 */
169 HWTEST_F(UtilityCommonUtilsTest, TboxTest002, testing::ext::TestSize.Level3)
170 {
171 auto ret = Tbox::GetStackName(" at DES)");
172 ASSERT_EQ("DES", ret);
173 ret = Tbox::GetStackName(" - DES(");
174 ASSERT_EQ("unknown", ret);
175 ret = Tbox::GetStackName(" - DE+S(");
176 ASSERT_EQ("DE)", ret);
177 }
178
179 /* @tc.name: TboxTest003
180 * @tc.desc: Test WaitForDoneFile method of class Tbox
181 * @tc.type: FUNC
182 * @tc.require: issueI65DUW
183 */
184 HWTEST_F(UtilityCommonUtilsTest, TboxTest003, testing::ext::TestSize.Level3)
185 {
186 (void)FileUtil::ForceRemoveDirectory(LOG_FILE_PATH);
187 std::string caseName = "TboxTest003";
188 auto ret = Tbox::WaitForDoneFile(GenerateLogFileName(caseName, SUFFIX_0), 1);
189 ASSERT_TRUE(!ret);
190 FileUtil::SaveStringToFile(GenerateLogFileName(caseName, SUFFIX_0), "test");
191 ret = Tbox::WaitForDoneFile(GenerateLogFileName(caseName, SUFFIX_0), 1);
192 ASSERT_TRUE(ret);
193 }
194
195 /* @tc.name: TboxTest004
196 * @tc.desc: Test FilterTrace method of class Tbox
197 * @tc.type: FUNC
198 * @tc.require: DTS2023061410216
199 */
200 HWTEST_F(UtilityCommonUtilsTest, TboxTest004, testing::ext::TestSize.Level3)
201 {
202 std::string stack = R"("#00 pc 00000000000cfaac /system/lib/ld-musl-aarch64.so.1
203 #01 pc 00000000000cfc60 /system/lib/ld-musl-aarch64.so.1(raise+76)
204 #02 pc 0000000000094c98 /system/lib/ld-musl-aarch64.so.1(abort+20)
205 #03 pc 00000000000af8d8 /system/lib64/libc++.so(c790e35ba2b0181d76f8e722e0f6670ff6aaf23c)
206 #04 pc 0000000000098004 /system/lib64/libc++.so(c790e35ba2b0181d76f8e722e0f6670ff6aaf23c)
207 #05 pc 00000000000aea80 /system/lib64/libc++.so(c790e35ba2b0181d76f8e722e0f6670ff6aaf23c)
208 #06 pc 00000000000b1d6c /system/lib64/libc++.so(__cxa_rethrow+216)(c790e35ba2b0181d76f8e722e0f6670ff6aaf23c)
209 #07 pc 000000000010020c /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
210 #08 pc 0000000000105e58 /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
211 #09 pc 00000000001d478c /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
212 #10 pc 00000000000d6ea8 /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
213 #11 pc 00000000000d869c /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
214 #12 pc 00000000000d614c /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
215 #13 pc 00000000000d5454 /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
216 #14 pc 0000000000130928 /system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)
217 #15 pc 0000000000091c3c /system/lib64/libappexecfwk_core.z.so(OHOS::AppExecFwk::BundleMgrHost
218 #16 pc 00000000000a27b0 /system/lib64/libappexecfwk_corOHOS::MessageOption&)+1004)
219 #17 pc 0000000000034efc /system/lib64/platformsdk/libipc_core.z.so(OHOS::BinderInvoker::OnTransaction
220 #18 pc 0000000000035554 /system/lib64/platformsdk/libipc_core.z.so(OHOS::BinderInvoker::HandleCommandsInner
221 #19 pc 00000000000348b4 /system/lib64/platformsdk/libipc_core.z.so(OHOS::BinderInvoker::HandleCommands
222 #20 pc 0000000000034820 /system/lib64/platformsdk/libipc_core.z.so(OHOS::BinderInvoker::StartWorkLoop()
223 #21 pc 00000000000355f4 /system/lib64/platformsdk/libipc_core.z.so(OHOS::BinderInvoker::JoinThread(bool)
224 #22 pc 000000000002ff24 /system/lib64/platformsdk/libipc_core.z.so(OHOS::IPCWorkThread::ThreadHandler)
225 #23 pc 00000000000e4934 /system/lib/ld-musl-aarch64.so.1
226 #24 pc 00000000000876b4 /system/lib/ld-musl-aarch64.so.1")";
227
228 std::map<std::string, std::string> eventInfos;
229 eventInfos.insert(std::pair("END_STACK", stack));
230 eventInfos.insert(std::pair("PNAME", "foundation"));
231 Tbox::FilterTrace(eventInfos);
232
233 EXPECT_STREQ(eventInfos["FIRST_FRAME"].c_str(), "/system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)");
234 EXPECT_STREQ(eventInfos["SECOND_FRAME"].c_str(), "/system/lib64/libbms.z.so(3256be1e0b8fdc2b4e25a28f1c2086eb)");
235 EXPECT_STREQ(eventInfos["LAST_FRAME"].c_str(),
236 "/system/lib64/platformsdk/libipc_core.z.so(OHOS::IPCWorkThread::ThreadHandler)");
237 }
238
239 /* @tc.name: TboxTest005
240 * @tc.desc: Test FilterTrace method of class Tbox
241 * @tc.type: FUNC
242 * @tc.require: DTS2023061410216
243 */
244 HWTEST_F(UtilityCommonUtilsTest, TboxTest005, testing::ext::TestSize.Level3)
245 {
246 std::string stack = R"("#00 pc 000000000006ca40 /system/lib64/libc.so(syscall+32)
247 #01 pc 0000000000070cc4 /system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144)
248 #02 pc 00000000000cf2cc /system/lib64/libc.so(pthread_cond_timedwait+124)
249 #03 pc 0000000000071714 /system/lib64/libc++.so(std::__1::condition_variable)
250 #04 pc 000000000001a33c /system/lib64/libeventhandler.z.so(OHOS::AppExecFwk::NoneIoWaiter)
251 #05 pc 0000000000011db4 /system/lib64/libeventhandler.z.so(OHOS::AppExecFwk::EventQueue::WaitUntilLocked)
252 #06 pc 0000000000011cf8 /system/lib64/libeventhandler.z.so(OHOS::AppExecFwk::EventQueue::GetEvent()+112)
253 #07 pc 0000000000017728 /system/lib64/libeventhandler.z.so
254 #08 pc 000000000001608c /system/lib64/libeventhandler.z.so(OHOS::AppExecFwk::EventRunner::Run()+96)
255 #09 pc 000000000009380c /system/lib64/libappkit_native.z.so(OHOS::AppExecFwk::MainThread::Start()+372)
256 #10 pc 00000000000144b8 /system/bin/appspawn
257 #11 pc 00000000000139ec /system/bin/appspawn
258 #12 pc 000000000001fd90 /system/lib64/libbegetutil.z.so
259 #13 pc 000000000001f980 /system/lib64/libbegetutil.z.so
260 #14 pc 000000000001ccd0 /system/lib64/libbegetutil.z.so(ProcessEvent+108)
261 #15 pc 000000000001c6cc /system/lib64/libbegetutil.z.so
262 #16 pc 00000000000128b4 /system/bin/appspawn
263 #17 pc 000000000001053c /system/bin/appspawn
264 #18 pc 000000000006afa4 /system/lib64/libc.so(__libc_init+112")";
265
266 std::map<std::string, std::string> eventInfos;
267 eventInfos.insert(std::pair("END_STACK", stack));
268 eventInfos.insert(std::pair("PNAME", "foundation"));
269 Tbox::FilterTrace(eventInfos);
270
271 EXPECT_STREQ(eventInfos["FIRST_FRAME"].c_str(),
272 "/system/lib64/libeventhandler.z.so(OHOS::AppExecFwk::NoneIoWaiter)");
273 EXPECT_STREQ(eventInfos["SECOND_FRAME"].c_str(),
274 "/system/lib64/libeventhandler.z.so(OHOS::AppExecFwk::EventQueue::WaitUntilLocked)");
275 EXPECT_STREQ(eventInfos["LAST_FRAME"].c_str(), "/system/bin/appspawn");
276 }
277
278 /* @tc.name: TboxTest006
279 * @tc.desc: Test WaitForDoneFile method of class Tbox
280 * @tc.type: FUNC
281 * @tc.require: issueI8Z9FF
282 */
283 HWTEST_F(UtilityCommonUtilsTest, TboxTest006, testing::ext::TestSize.Level3)
284 {
285 std::string timeStr = "197001060319";
286
287 auto happenTime = Tbox::GetHappenTime(timeStr, "(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})");
288
289 ASSERT_TRUE(!happenTime);
290 }
291
292 /* @tc.name: TboxTest007
293 * @tc.desc: Test WaitForDoneFile method of class Tbox
294 * @tc.type: FUNC
295 * @tc.require: issueI8Z9FF
296 */
297 HWTEST_F(UtilityCommonUtilsTest, TboxTest007, testing::ext::TestSize.Level3)
298 {
299 std::string timeStr = "19700106031950";
300
301 auto happenTime = Tbox::GetHappenTime(timeStr, "(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})");
302
303 ASSERT_EQ(happenTime, 415190);
304 }
305
306 /* @tc.name: TboxTest008
307 * @tc.desc: Test WaitForDoneFile method of class Tbox
308 * @tc.type: FUNC
309 * @tc.require: issueI8Z9FF
310 */
311 HWTEST_F(UtilityCommonUtilsTest, TboxTest008, testing::ext::TestSize.Level3)
312 {
313 std::string timeStr = "20240217034255";
314 int64_t timeStrtoTm = 1708112575;
315 int64_t offset = 28800;
316 auto happenTime = Tbox::GetHappenTime(timeStr, "(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})");
317
318 if (happenTime - timeStrtoTm > offset) {
319 ASSERT_EQ(happenTime - timeStrtoTm, offset);
320 } else {
321 ASSERT_TRUE(happenTime);
322 }
323 }
324
325 /* @tc.name: TboxTest009
326 * @tc.desc: Test FilterTrace, all stacks are basic libraries that need to be ignored
327 * @tc.type: FUNC
328 */
329 HWTEST_F(UtilityCommonUtilsTest, TboxTest009, testing::ext::TestSize.Level3)
330 {
331 std::string stack = R"(#00 pc 000000000006ca40 /system/lib64/libc.so(syscall+32)
332 #01 pc 00000000000bb328 /system/lib/libart.so (__epoll_pwait+8)
333 #02 pc 0000000000070cc4 /system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144)
334 #03 pc 00000000000cf2cc /system/lib64/libc.so(pthread_cond_timedwait+124)
335 #04 pc 0000000000071714 /system/lib64/libc++.so(std::__1::condition_variable)
336 #05 pc 000000000006afa4 /system/lib64/libc.so(__libc_init+112)";
337
338 std::map<std::string, std::string> eventInfos;
339 eventInfos.insert(std::pair("END_STACK", stack));
340 eventInfos.insert(std::pair("PNAME", "foundation"));
341 Tbox::FilterTrace(eventInfos);
342
343 EXPECT_EQ(eventInfos["FIRST_FRAME"], "/system/lib/libart.so (__epoll_pwait+8");
344 EXPECT_EQ(eventInfos["SECOND_FRAME"],
345 "/system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144");
346 EXPECT_EQ(eventInfos["LAST_FRAME"], "/system/lib64/libc.so(__libc_init+112");
347 }
348
349 /* @tc.name: TboxTest010
350 * @tc.desc: Test FilterTrace, all stacks are basic libraries that need to be ignored,
351 * and the total number is less than 3
352 * @tc.type: FUNC
353 */
354 HWTEST_F(UtilityCommonUtilsTest, TboxTest010, testing::ext::TestSize.Level3)
355 {
356 std::string stack = R"(#00 pc 000000000006ca40 /system/lib64/libc.so(syscall+32)
357 #01 pc 0000000000070cc4 /system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144))";
358
359 std::map<std::string, std::string> eventInfos;
360 eventInfos.insert(std::pair("END_STACK", stack));
361 eventInfos.insert(std::pair("PNAME", "foundation"));
362 Tbox::FilterTrace(eventInfos);
363
364 EXPECT_EQ(eventInfos["FIRST_FRAME"], "/system/lib64/libc.so(syscall+32");
365 EXPECT_EQ(eventInfos["SECOND_FRAME"],
366 "/system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144");
367 }
368
369 /* @tc.name: TboxTest011
370 * @tc.desc: Test FilterTrace, event is JS_ERROR
371 * @tc.type: FUNC
372 */
373 HWTEST_F(UtilityCommonUtilsTest, TboxTest011, testing::ext::TestSize.Level3)
374 {
375 std::string stack = R"(#00 pc 00000000000bb328 /system/lib64/libc.so(__epoll_pwait+8)
376 #01 pc 000000000051b55c /system/lib64/libGLES_mali.so
377 #02 pc 000000000001b674 /system/lib64/libace_napi.z.so(NativeEngineInterface::UVThreadRunner(void*)+148))";
378 stack += "\n";
379 stack += "#03 pc 000000000000d370 /system/lib64/libeventhandler.z.so" \
380 "(OHOS::AppExecFwk::EpollIoWaiter::WaitFor(std::__1::unique_lock<std::__1::mutex>&, long)+192)\n";
381 stack += "#04 pc 0000000000011db4 /system/lib64/libeventhandler.z.so" \
382 "(OHOS::AppExecFwk::EventQueue::WaitUntilLocked(std::__1::chrono::time_point<std::__1::chrono::steady_clock," \
383 " std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&, " \
384 "std::__1::unique_lock<std::__1::mutex>&)+96)\n";
385 stack += "#05 pc 0000000000011cf8 /system/lib64/libeventhandler.z.so" \
386 "(OHOS::AppExecFwk::EventQueue::GetEvent()+112)\n";
387 stack += R"(#06 pc 0000000000017728 /system/lib64/libeventhandler.z.so
388 #07 pc 0000000000015c30 /system/lib64/libeventhandler.z.so
389 #08 pc 0000000000018aa4 /system/lib64/libeventhandler.z.so)";
390
391 std::map<std::string, std::string> eventInfos;
392 eventInfos.insert(std::pair("END_STACK", stack));
393 eventInfos.insert(std::pair("PNAME", "foundation"));
394 Tbox::FilterTrace(eventInfos, "JS_ERROR");
395
396 EXPECT_EQ(eventInfos["FIRST_FRAME"], "(NativeEngineInterface::UVThreadRunner(void*)+148)");
397 std::string secondFrame = "/system/lib64/libeventhandler.z.so" \
398 "(OHOS::AppExecFwk::EpollIoWaiter::WaitFor(std::__1::unique_lock<std::__1::mutex>&, long)+192";
399 EXPECT_EQ(eventInfos["SECOND_FRAME"], secondFrame);
400 EXPECT_EQ(eventInfos["LAST_FRAME"], "/system/lib64/libeventhandler.z.so");
401 }
402
403 /* @tc.name: TboxTest012
404 * @tc.desc: Test FilterTrace, all stacks are basic libraries that need to be ignored
405 * @tc.type: FUNC
406 */
407 HWTEST_F(UtilityCommonUtilsTest, TboxTest012, testing::ext::TestSize.Level3)
408 {
409 std::string stack = R"(#00 pc 000000000006ca40 /system/lib64/libc.so(syscall+32)
410 #01 pc 0000000000070cc4 /system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144)
411 #02 pc 00000000000cf2cc /system/lib64/libc.so(pthread_cond_timedwait+124)
412 #03 pc 0000000000071714 /system/lib64/libc++.so(std::__1::condition_variable)
413 #04 pc 000000000006afa4 /system/lib64/libc.so(__libc_init+112)";
414
415 std::map<std::string, std::string> eventInfos;
416 eventInfos.insert(std::pair("END_STACK", stack));
417 eventInfos.insert(std::pair("PNAME", "foundation"));
418 Tbox::FilterTrace(eventInfos);
419
420 EXPECT_EQ(eventInfos["FIRST_FRAME"], "/system/lib64/libc.so(syscall+32");
421 EXPECT_EQ(eventInfos["SECOND_FRAME"],
422 "/system/lib64/libc.so(__futex_wait_ex(void volatile*, bool, timespec const*)+144");
423 EXPECT_EQ(eventInfos["LAST_FRAME"], "/system/lib64/libc.so(__libc_init+112");
424 }
425 }
426 }
427