xref: /aosp_15_r20/external/ltp/lib/newlib_tests/test14.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) 2016 Cyril Hrubis <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Worker  */
5*49cdfc7eSAndroid Build Coastguard Worker 
6*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
7*49cdfc7eSAndroid Build Coastguard Worker #include "tst_safe_stdio.h"
8*49cdfc7eSAndroid Build Coastguard Worker #include "tst_safe_net.h"
9*49cdfc7eSAndroid Build Coastguard Worker 
cleanup(void)10*49cdfc7eSAndroid Build Coastguard Worker static void cleanup(void)
11*49cdfc7eSAndroid Build Coastguard Worker {
12*49cdfc7eSAndroid Build Coastguard Worker 	int i;
13*49cdfc7eSAndroid Build Coastguard Worker 
14*49cdfc7eSAndroid Build Coastguard Worker 	tst_brk(TBROK, "TBROK in cleanup");
15*49cdfc7eSAndroid Build Coastguard Worker 	SAFE_OPEN("foo", O_RDWR);
16*49cdfc7eSAndroid Build Coastguard Worker 	SAFE_FILE_SCANF("foo", "%i", &i);
17*49cdfc7eSAndroid Build Coastguard Worker 	SAFE_TOUCH("doo/foo", 0777, NULL);
18*49cdfc7eSAndroid Build Coastguard Worker 	SAFE_FOPEN("foo", "r");
19*49cdfc7eSAndroid Build Coastguard Worker 	SAFE_SOCKET(AF_UNIX, SOCK_STREAM, -1);
20*49cdfc7eSAndroid Build Coastguard Worker 	tst_res(TINFO, "Test still here");
21*49cdfc7eSAndroid Build Coastguard Worker }
22*49cdfc7eSAndroid Build Coastguard Worker 
do_test(void)23*49cdfc7eSAndroid Build Coastguard Worker static void do_test(void)
24*49cdfc7eSAndroid Build Coastguard Worker {
25*49cdfc7eSAndroid Build Coastguard Worker 	tst_res(TPASS, "Passed");
26*49cdfc7eSAndroid Build Coastguard Worker }
27*49cdfc7eSAndroid Build Coastguard Worker 
28*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
29*49cdfc7eSAndroid Build Coastguard Worker 	.test_all = do_test,
30*49cdfc7eSAndroid Build Coastguard Worker 	.cleanup = cleanup,
31*49cdfc7eSAndroid Build Coastguard Worker };
32