• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
18 #include "smart_parser.h"
19 #include "tbox.h"
20 #include "log_util.h"
21 
22 using namespace testing::ext;
23 using namespace OHOS::HiviewDFX;
24 namespace OHOS {
25 namespace HiviewDFX {
26 
27 /**
28  * @tc.name: SmartParserIOM3ExceptionTest001
29  * @tc.desc: Smart paerser SENSORHUBCRASH log.
30  * @tc.type: FUNC
31  */
32 HWTEST(SmartParserIOM3ExceptionTest, SmartParserIOM3ExceptionTest001, testing::ext::TestSize.Level3)
33 {
34     /**
35      * @tc.steps: step1. parser log
36      */
37     const std::string logPath = std::string{LogUtil::SMART_PARSER_TEST_DIR} +
38         "/SmartParserIOM3ExceptionTest001/history.log";
39     const std::string eventType = "SENSORHUBCRASH";
40     auto eventInfos = SmartParser::Analysis(logPath, SMART_PARSER_PATH, eventType);
41 
42     /**
43      * @tc.steps: step2. check result
44      */
45     ASSERT_EQ(eventInfos["LAST_FRAME"], "46a64, 46a60");
46 }
47 } // namespace HiviewDFX
48 } // namespace OHOS
49