1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) Linux Test Project, 2006-2021
4 * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
5 * Author: Aniruddha Marathe <aniruddha.marathe@wipro.com>
6 */
7
8 /*\
9 * [Description]
10 *
11 * Basic test of libc wrapper of reboot(2) system call.
12 *
13 * Test LINUX_REBOOT_CMD_CAD_ON, LINUX_REBOOT_CMD_CAD_OFF commands,
14 * which do not perform reboot.
15 */
16
17 #include <unistd.h>
18 #include <sys/reboot.h>
19 #include <linux/reboot.h>
20 #include "tst_test.h"
21
22 #define CMD_DESC(x) .cmd = x, .desc = #x
23
24 static struct tcase {
25 const char *desc;
26 int cmd;
27 } tcases[] = {
28 {CMD_DESC(LINUX_REBOOT_CMD_CAD_ON)},
29 {CMD_DESC(LINUX_REBOOT_CMD_CAD_OFF)},
30 };
31
run(unsigned int n)32 static void run(unsigned int n)
33 {
34 TST_EXP_PASS(reboot(tcases[n].cmd), "reboot(%s)", tcases[n].desc);
35 }
36
37 static struct tst_test test = {
38 .needs_root = 1,
39 .test = run,
40 .tcnt = ARRAY_SIZE(tcases),
41 };
42