1 /* 2 * Copyright (c) 2025 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 #include <gtest/gtest.h> 16 #include <string> 17 #include <vector> 18 19 #include "smart_parser.h" 20 #include "tbox.h" 21 #include "log_util.h" 22 23 using namespace testing::ext; 24 using namespace OHOS::HiviewDFX; 25 namespace OHOS { 26 namespace HiviewDFX { 27 28 /** 29 * @tc.name: SmartParserLpm3ExceptionTest001 30 * @tc.desc: Smart parser lpm3 exception log. 31 * @tc.type: FUNC 32 */ 33 HWTEST(SmartParserLpm3ExceptionTest, SmartParserLpm3ExceptionTest001, testing::ext::TestSize.Level3) 34 { 35 /** 36 * @tc.steps: step1. parser log 37 */ 38 const std::string logPath = std::string{LogUtil::SMART_PARSER_TEST_DIR} + 39 "/SmartParserLpm3ExceptionTest001/19700101000000-00000007/ap_log/fastboot_log"; 40 const std::string eventType = "LPM3EXCEPTION"; 41 auto eventInfos = SmartParser::Analysis(logPath, SMART_PARSER_PATH, eventType); 42 43 /** 44 * @tc.steps: step2. check result 45 */ 46 ASSERT_EQ(eventInfos["FIRST_FRAME"], "0xFF"); 47 ASSERT_EQ(eventInfos["SECOND_FRAME"], "0x0"); 48 ASSERT_EQ(eventInfos["LAST_FRAME"], "sr position:[17]lpmcu sys resume io"); 49 } 50 51 /** 52 * @tc.name: SmartParserLpm3ExceptionTest002 53 * @tc.desc: Smart parser BBK lpm3 exception log. 54 * @tc.type: FUNC 55 */ 56 HWTEST(SmartParserLpm3ExceptionTest, SmartParserLpm3ExceptionTest002, testing::ext::TestSize.Level3) 57 { 58 /** 59 * @tc.steps: step1. parser log 60 */ 61 const std::string logPath = std::string{LogUtil::SMART_PARSER_TEST_DIR} + 62 "/SmartParserLpm3ExceptionTest002/19700101000000-00000007/ap_log/fastboot_log"; 63 const std::string eventType = "LPM3EXCEPTION"; 64 auto eventInfos = SmartParser::Analysis(logPath, SMART_PARSER_PATH, eventType); 65 66 /** 67 * @tc.steps: step2. check result 68 */ 69 ASSERT_EQ(eventInfos["FIRST_FRAME"], "00000043"); 70 ASSERT_EQ(eventInfos["SECOND_FRAME"], "00000003"); 71 ASSERT_EQ(eventInfos["LAST_FRAME"], "sr position:[27]kernel resume out"); 72 } 73 } // namespace HiviewDFX 74 } // namespace OHOS 75