xref: /aosp_15_r20/external/ltp/lib/newlib_tests/test19.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 2018, Linux Test Project
4*49cdfc7eSAndroid Build Coastguard Worker  */
5*49cdfc7eSAndroid Build Coastguard Worker 
6*49cdfc7eSAndroid Build Coastguard Worker #include <stdlib.h>
7*49cdfc7eSAndroid Build Coastguard Worker #include <unistd.h>
8*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
9*49cdfc7eSAndroid Build Coastguard Worker #include "tst_sys_conf.h"
10*49cdfc7eSAndroid Build Coastguard Worker 
setup(void)11*49cdfc7eSAndroid Build Coastguard Worker static void setup(void)
12*49cdfc7eSAndroid Build Coastguard Worker {
13*49cdfc7eSAndroid Build Coastguard Worker 	SAFE_FILE_PRINTF("/proc/sys/kernel/core_pattern", "changed");
14*49cdfc7eSAndroid Build Coastguard Worker 	tst_sys_conf_dump();
15*49cdfc7eSAndroid Build Coastguard Worker }
16*49cdfc7eSAndroid Build Coastguard Worker 
run(void)17*49cdfc7eSAndroid Build Coastguard Worker static void run(void)
18*49cdfc7eSAndroid Build Coastguard Worker {
19*49cdfc7eSAndroid Build Coastguard Worker 	tst_res(TPASS, "OK");
20*49cdfc7eSAndroid Build Coastguard Worker }
21*49cdfc7eSAndroid Build Coastguard Worker 
22*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
23*49cdfc7eSAndroid Build Coastguard Worker 	.needs_root = 1,
24*49cdfc7eSAndroid Build Coastguard Worker 	.test_all = run,
25*49cdfc7eSAndroid Build Coastguard Worker 	.setup = setup,
26*49cdfc7eSAndroid Build Coastguard Worker 	.save_restore = (const struct tst_path_val[]) {
27*49cdfc7eSAndroid Build Coastguard Worker 		{"/proc/nonexistent", NULL, TST_SR_SKIP},
28*49cdfc7eSAndroid Build Coastguard Worker 		{"/proc/sys/kernel/numa_balancing", NULL, TST_SR_TBROK},
29*49cdfc7eSAndroid Build Coastguard Worker 		{"/proc/sys/kernel/core_pattern", NULL, TST_SR_TCONF},
30*49cdfc7eSAndroid Build Coastguard Worker 		{}
31*49cdfc7eSAndroid Build Coastguard Worker 	},
32*49cdfc7eSAndroid Build Coastguard Worker };
33