xref: /aosp_15_r20/external/ltp/lib/newlib_tests/test02.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 /*
7*49cdfc7eSAndroid Build Coastguard Worker  * The tst_resm() and tst_brkm() should be rerouted to the new lib.
8*49cdfc7eSAndroid Build Coastguard Worker  */
9*49cdfc7eSAndroid Build Coastguard Worker 
10*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
11*49cdfc7eSAndroid Build Coastguard Worker 
12*49cdfc7eSAndroid Build Coastguard Worker void tst_resm_(char *, int, int, char *);
13*49cdfc7eSAndroid Build Coastguard Worker void tst_brkm__(char *, int, int, void (*)(void), char *);
14*49cdfc7eSAndroid Build Coastguard Worker 
cleanup(void)15*49cdfc7eSAndroid Build Coastguard Worker static void cleanup(void)
16*49cdfc7eSAndroid Build Coastguard Worker {
17*49cdfc7eSAndroid Build Coastguard Worker }
18*49cdfc7eSAndroid Build Coastguard Worker 
do_test(unsigned int i)19*49cdfc7eSAndroid Build Coastguard Worker static void do_test(unsigned int i)
20*49cdfc7eSAndroid Build Coastguard Worker {
21*49cdfc7eSAndroid Build Coastguard Worker 	switch (i) {
22*49cdfc7eSAndroid Build Coastguard Worker 	case 0:
23*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm_(__FILE__, __LINE__, TINFO, "info message");
24*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm_(__FILE__, __LINE__, TPASS, "passed message");
25*49cdfc7eSAndroid Build Coastguard Worker 	break;
26*49cdfc7eSAndroid Build Coastguard Worker 	case 1:
27*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm__(__FILE__, __LINE__, TCONF, cleanup, "Non-NULL cleanup");
28*49cdfc7eSAndroid Build Coastguard Worker 	break;
29*49cdfc7eSAndroid Build Coastguard Worker 	}
30*49cdfc7eSAndroid Build Coastguard Worker }
31*49cdfc7eSAndroid Build Coastguard Worker 
32*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
33*49cdfc7eSAndroid Build Coastguard Worker 	.tcnt = 2,
34*49cdfc7eSAndroid Build Coastguard Worker 	.test = do_test,
35*49cdfc7eSAndroid Build Coastguard Worker };
36