• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 <sys/statvfs.h>
17 #include "init_cmds.h"
18 #include "init_reboot.h"
19 #include "init_param.h"
20 #include "init_unittest.h"
21 #include "init_utils.h"
22 #include "trigger_manager.h"
23 
24 using namespace testing::ext;
25 using namespace std;
26 
27 namespace init_ut {
28 class InitRebootUnitTest : public testing::Test {
29 public:
SetUpTestCase(void)30     static void SetUpTestCase(void) {};
TearDownTestCase(void)31     static void TearDownTestCase(void) {};
SetUp()32     void SetUp() {};
TearDown()33     void TearDown() {};
34 };
35 
36 HWTEST_F(InitRebootUnitTest, TestInitReboot, TestSize.Level1)
37 {
38     ExecReboot("reboot");
39     ExecReboot("reboot,shutdown");
40     ExecReboot("reboot,bootloader");
41     ExecReboot("reboot,updater:123");
42     ExecReboot("reboot,flash:123");
43     const char *option = nullptr;
44     int ret = DoReboot(option);
45     EXPECT_EQ(ret, 0);
46     option = "updater";
47     ret = DoReboot(option);
48     EXPECT_EQ(ret, 0);
49 }
50 } // namespace init_ut
51