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