1 /* 2 * Copyright (c) 2022 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/reboot.h> 17 #include "test.h" 18 19 #define TEST(c, ...) ((c) || (t_error(#c " failed: " __VA_ARGS__),0)) 20 21 #define LINUX_REBOOT_CMD_RESTART 0x01234567 22 #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF 23 #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 24 25 /** 26 * @tc.name : reboot_0010 27 * @tc.desc : test reboot with flag LINUX_REBOOT_CMD_CAD_ON 28 * @tc.level : Level 0 29 */ reboot_0010(void)30static void reboot_0010(void) 31 { 32 TEST(reboot(LINUX_REBOOT_CMD_CAD_ON) == 0); 33 } 34 35 /** 36 * @tc.name : reboot_0020 37 * @tc.desc : test reboot with flag LINUX_REBOOT_CMD_CAD_OFF 38 * @tc.level : Level 0 39 */ reboot_0020(void)40static void reboot_0020(void) 41 { 42 TEST(reboot(LINUX_REBOOT_CMD_CAD_OFF) == 0); 43 } 44 main(void)45int main(void) 46 { 47 geteuid(); 48 49 reboot_0010(); 50 reboot_0020(); 51 52 return t_status; 53 } 54