/* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include "smart_parser.h" #include "tbox.h" #include "log_util.h" using namespace testing::ext; using namespace OHOS::HiviewDFX; namespace OHOS { namespace HiviewDFX { /** * @tc.name: SmartParserCppCrashTest001 * @tc.desc: Smart paerser cpp crash log. * @tc.type: FUNC */ HWTEST(SmartParserCppCrashTest, SmartParserCppCrashTest001, testing::ext::TestSize.Level0) { /** * @tc.steps: step1. parser log */ const std::string logPath = std::string{LogUtil::SMART_PARSER_TEST_DIR} + "/SmartParserCppCrashTest001/cppcrash-com.ohos.launcher-20010025-19700324235211000.log"; const std::string eventType = "CPP_CRASH"; auto eventInfos = SmartParser::Analysis(logPath, SMART_PARSER_PATH, eventType); /** * @tc.steps: step2. check result */ std::string endStack = "#00 pc 00000000000bb328 /system/lib64/libc.so(__epoll_pwait+8)\n"; endStack += "#01 pc 000000000000d370 /system/lib64/libeventhandler.z.so"; endStack += "(OHOS::AppExecFwk::EpollIoWaiter::WaitFor(std::__1::unique_lock&, long)+192)\n"; endStack += "#02 pc 0000000000011db4 /system/lib64/libeventhandler.z.so"; endStack += "(OHOS::AppExecFwk::EventQueue::WaitUntilLocked(std::__1::chrono::time_point<"; endStack += "std::__1::chrono::steady_clock, std::__1::chrono::duration