1 /*
2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3 *
4 * HDF is dual licensed: you can use it either under the terms of
5 * the GPL, or the BSD license, at your option.
6 * See the LICENSE file in the root of this repository for complete details.
7 */
8
9 #include <cstdint>
10 #include <cstdio>
11 #include <cstdlib>
12 #include <fcntl.h>
13 #include <string>
14 #include <unistd.h>
15 #include <gtest/gtest.h>
16 #include "hdf_uhdf_test.h"
17 #include "hdf_io_service_if.h"
18 #include "watchdog_test.h"
19
20 using namespace testing::ext;
21
22 class HdfLiteWatchdogTest : public testing::Test {
23 public:
24 static void SetUpTestCase();
25 static void TearDownTestCase();
26 void SetUp();
27 void TearDown();
28 };
29
SetUpTestCase()30 void HdfLiteWatchdogTest::SetUpTestCase()
31 {
32 HdfTestOpenService();
33 }
34
TearDownTestCase()35 void HdfLiteWatchdogTest::TearDownTestCase()
36 {
37 HdfTestCloseService();
38 }
39
SetUp()40 void HdfLiteWatchdogTest::SetUp()
41 {
42 }
43
TearDown()44 void HdfLiteWatchdogTest::TearDown()
45 {
46 }
47
48 /**
49 * @tc.name: HdfLiteWatchdogTestSetGetTimeout001
50 * @tc.desc: watchdog function test
51 * @tc.type: FUNC
52 * @tc.require: AR000F868G
53 */
54 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestSetGetTimeout001, TestSize.Level1)
55 {
56 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_SET_GET_TIMEOUT, -1};
57 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
58 EXPECT_EQ(0, WatchdogTestExecute(WATCHDOG_TEST_SET_GET_TIMEOUT));
59 }
60
61 /**
62 * @tc.name: HdfLiteWatchdogTestStartStop001
63 * @tc.desc: watchdog function test
64 * @tc.type: FUNC
65 * @tc.require: AR000F868G
66 */
67 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestStartStop001, TestSize.Level1)
68 {
69 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_START_STOP, -1};
70 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
71 EXPECT_EQ(0, WatchdogTestExecute(WATCHDOG_TEST_START_STOP));
72 }
73
74 /**
75 * @tc.name: HdfLiteWatchdogTestFeed001
76 * @tc.desc: watchdog function test
77 * @tc.type: FUNC
78 * @tc.require: AR000F868G
79 */
80 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestFeed001, TestSize.Level1)
81 {
82 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_FEED, -1};
83 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
84 EXPECT_EQ(0, WatchdogTestExecute(WATCHDOG_TEST_FEED));
85 }
86
87 /**
88 * @tc.name: HdfLiteWatchdogTestReliability001
89 * @tc.desc: watchdog function test
90 * @tc.type: FUNC
91 * @tc.require: AR000F868G
92 */
93 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestReliability001, TestSize.Level1)
94 {
95 struct HdfTestMsg msg = {TEST_PAL_WDT_TYPE, WATCHDOG_TEST_RELIABILITY, -1};
96 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
97 EXPECT_EQ(0, WatchdogTestExecute(WATCHDOG_TEST_RELIABILITY));
98 }
99
100 /**
101 * @tc.name: HdfLiteWatchdogTestIfPerformance001
102 * @tc.desc: watchdog user if performance test
103 * @tc.type: FUNC
104 * @tc.require:
105 */
106 HWTEST_F(HdfLiteWatchdogTest, HdfLiteWatchdogTestIfPerformance001, TestSize.Level1)
107 {
108 EXPECT_EQ(0, WatchdogTestExecute(WATCHDOG_IF_PERFORMANCE_TEST));
109 }
110