xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/mknod/mknod06.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker /*
2*49cdfc7eSAndroid Build Coastguard Worker  *
3*49cdfc7eSAndroid Build Coastguard Worker  *   Copyright (c) International Business Machines  Corp., 2001
4*49cdfc7eSAndroid Build Coastguard Worker  *
5*49cdfc7eSAndroid Build Coastguard Worker  *   This program is free software;  you can redistribute it and/or modify
6*49cdfc7eSAndroid Build Coastguard Worker  *   it under the terms of the GNU General Public License as published by
7*49cdfc7eSAndroid Build Coastguard Worker  *   the Free Software Foundation; either version 2 of the License, or
8*49cdfc7eSAndroid Build Coastguard Worker  *   (at your option) any later version.
9*49cdfc7eSAndroid Build Coastguard Worker  *
10*49cdfc7eSAndroid Build Coastguard Worker  *   This program is distributed in the hope that it will be useful,
11*49cdfc7eSAndroid Build Coastguard Worker  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12*49cdfc7eSAndroid Build Coastguard Worker  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13*49cdfc7eSAndroid Build Coastguard Worker  *   the GNU General Public License for more details.
14*49cdfc7eSAndroid Build Coastguard Worker  *
15*49cdfc7eSAndroid Build Coastguard Worker  *   You should have received a copy of the GNU General Public License
16*49cdfc7eSAndroid Build Coastguard Worker  *   along with this program;  if not, write to the Free Software
17*49cdfc7eSAndroid Build Coastguard Worker  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*49cdfc7eSAndroid Build Coastguard Worker  */
19*49cdfc7eSAndroid Build Coastguard Worker 
20*49cdfc7eSAndroid Build Coastguard Worker /*
21*49cdfc7eSAndroid Build Coastguard Worker  * Test Name: mknod06
22*49cdfc7eSAndroid Build Coastguard Worker  *
23*49cdfc7eSAndroid Build Coastguard Worker  * Test Description:
24*49cdfc7eSAndroid Build Coastguard Worker  * Verify that,
25*49cdfc7eSAndroid Build Coastguard Worker  *   1) mknod(2) returns -1 and sets errno to EEXIST if specified path
26*49cdfc7eSAndroid Build Coastguard Worker  *	already exists.
27*49cdfc7eSAndroid Build Coastguard Worker  *   2) mknod(2) returns -1 and sets errno to EFAULT if pathname points
28*49cdfc7eSAndroid Build Coastguard Worker  *	outside user's accessible address space.
29*49cdfc7eSAndroid Build Coastguard Worker  *   3) mknod(2) returns -1 and sets errno to ENOENT if the directory
30*49cdfc7eSAndroid Build Coastguard Worker  *	component in pathname does not exist.
31*49cdfc7eSAndroid Build Coastguard Worker  *   4) mknod(2) returns -1 and sets errno to ENAMETOOLONG if the pathname
32*49cdfc7eSAndroid Build Coastguard Worker  *	component was too long.
33*49cdfc7eSAndroid Build Coastguard Worker  *   5) mknod(2) returns -1 and sets errno to ENOTDIR if the directory
34*49cdfc7eSAndroid Build Coastguard Worker  *	component in pathname is not a directory.
35*49cdfc7eSAndroid Build Coastguard Worker  *
36*49cdfc7eSAndroid Build Coastguard Worker  * Expected Result:
37*49cdfc7eSAndroid Build Coastguard Worker  *  mknod() should fail with return value -1 and set expected errno.
38*49cdfc7eSAndroid Build Coastguard Worker  *
39*49cdfc7eSAndroid Build Coastguard Worker  * Algorithm:
40*49cdfc7eSAndroid Build Coastguard Worker  *  Setup:
41*49cdfc7eSAndroid Build Coastguard Worker  *   Setup signal handling.
42*49cdfc7eSAndroid Build Coastguard Worker  *   Create temporary directory.
43*49cdfc7eSAndroid Build Coastguard Worker  *   Pause for SIGUSR1 if option specified.
44*49cdfc7eSAndroid Build Coastguard Worker  *
45*49cdfc7eSAndroid Build Coastguard Worker  *  Test:
46*49cdfc7eSAndroid Build Coastguard Worker  *   Loop if the proper options are given.
47*49cdfc7eSAndroid Build Coastguard Worker  *   Execute system call
48*49cdfc7eSAndroid Build Coastguard Worker  *   Check return code, if system call failed (return=-1)
49*49cdfc7eSAndroid Build Coastguard Worker  *   	if errno set == expected errno
50*49cdfc7eSAndroid Build Coastguard Worker  *   		Issue sys call fails with expected return value and errno.
51*49cdfc7eSAndroid Build Coastguard Worker  *   	Otherwise,
52*49cdfc7eSAndroid Build Coastguard Worker  *		Issue sys call fails with unexpected errno.
53*49cdfc7eSAndroid Build Coastguard Worker  *   Otherwise,
54*49cdfc7eSAndroid Build Coastguard Worker  *	Issue sys call returns unexpected value.
55*49cdfc7eSAndroid Build Coastguard Worker  *
56*49cdfc7eSAndroid Build Coastguard Worker  *  Cleanup:
57*49cdfc7eSAndroid Build Coastguard Worker  *   Print errno log and/or timing stats if options given
58*49cdfc7eSAndroid Build Coastguard Worker  *   Delete the temporary directory(s)/file(s) created.
59*49cdfc7eSAndroid Build Coastguard Worker  *
60*49cdfc7eSAndroid Build Coastguard Worker  * Usage:  <for command-line>
61*49cdfc7eSAndroid Build Coastguard Worker  *  mknod06 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
62*49cdfc7eSAndroid Build Coastguard Worker  *     where,  -c n : Run n copies concurrently.
63*49cdfc7eSAndroid Build Coastguard Worker  *             -e   : Turn on errno logging.
64*49cdfc7eSAndroid Build Coastguard Worker  *	       -i n : Execute test n times.
65*49cdfc7eSAndroid Build Coastguard Worker  *	       -I x : Execute test for x seconds.
66*49cdfc7eSAndroid Build Coastguard Worker  *	       -P x : Pause for x seconds between iterations.
67*49cdfc7eSAndroid Build Coastguard Worker  *	       -t   : Turn on syscall timing.
68*49cdfc7eSAndroid Build Coastguard Worker  *
69*49cdfc7eSAndroid Build Coastguard Worker  * HISTORY
70*49cdfc7eSAndroid Build Coastguard Worker  *	07/2001 Ported by Wayne Boyer
71*49cdfc7eSAndroid Build Coastguard Worker  *
72*49cdfc7eSAndroid Build Coastguard Worker  * RESTRICTIONS:
73*49cdfc7eSAndroid Build Coastguard Worker  *  This test should be executed by super-user (root) only.
74*49cdfc7eSAndroid Build Coastguard Worker  */
75*49cdfc7eSAndroid Build Coastguard Worker 
76*49cdfc7eSAndroid Build Coastguard Worker #include <stdio.h>
77*49cdfc7eSAndroid Build Coastguard Worker #include <stdlib.h>
78*49cdfc7eSAndroid Build Coastguard Worker #include <unistd.h>
79*49cdfc7eSAndroid Build Coastguard Worker #include <errno.h>
80*49cdfc7eSAndroid Build Coastguard Worker #include <string.h>
81*49cdfc7eSAndroid Build Coastguard Worker #include <signal.h>
82*49cdfc7eSAndroid Build Coastguard Worker #include <sys/types.h>
83*49cdfc7eSAndroid Build Coastguard Worker #include <sys/stat.h>
84*49cdfc7eSAndroid Build Coastguard Worker #include <sys/param.h>
85*49cdfc7eSAndroid Build Coastguard Worker #include <sys/mman.h>
86*49cdfc7eSAndroid Build Coastguard Worker 
87*49cdfc7eSAndroid Build Coastguard Worker #include "test.h"
88*49cdfc7eSAndroid Build Coastguard Worker 
89*49cdfc7eSAndroid Build Coastguard Worker #define MODE_RWX		S_IFIFO | S_IRWXU | S_IRWXG | S_IRWXO
90*49cdfc7eSAndroid Build Coastguard Worker 
91*49cdfc7eSAndroid Build Coastguard Worker int setup1();			/* setup function to test mknod for EEXIST */
92*49cdfc7eSAndroid Build Coastguard Worker int setup3();			/* setup function to test mknod for ENOTDIR */
93*49cdfc7eSAndroid Build Coastguard Worker int longpath_setup();		/* setup function to test mknod for ENAMETOOLONG */
94*49cdfc7eSAndroid Build Coastguard Worker int no_setup();			/* simply returns 0 to the caller */
95*49cdfc7eSAndroid Build Coastguard Worker char Longpathname[PATH_MAX + 2];
96*49cdfc7eSAndroid Build Coastguard Worker 
97*49cdfc7eSAndroid Build Coastguard Worker struct test_case_t {		/* test case struct. to hold ref. test cond's */
98*49cdfc7eSAndroid Build Coastguard Worker 	char *pathname;
99*49cdfc7eSAndroid Build Coastguard Worker 	char *desc;
100*49cdfc7eSAndroid Build Coastguard Worker 	int exp_errno;
101*49cdfc7eSAndroid Build Coastguard Worker 	int (*setupfunc) ();
102*49cdfc7eSAndroid Build Coastguard Worker } Test_cases[] = {
103*49cdfc7eSAndroid Build Coastguard Worker 	{"tnode_1", "Specified node already exists", EEXIST, setup1}, {
104*49cdfc7eSAndroid Build Coastguard Worker 	NULL, "Invalid address", EFAULT, no_setup}, {
105*49cdfc7eSAndroid Build Coastguard Worker 	"testdir_2/tnode_2", "Non-existent file", ENOENT, no_setup}, {
106*49cdfc7eSAndroid Build Coastguard Worker 	"", "Pathname is empty", ENOENT, no_setup}, {
107*49cdfc7eSAndroid Build Coastguard Worker 	Longpathname, "Pathname too long", ENAMETOOLONG, longpath_setup}, {
108*49cdfc7eSAndroid Build Coastguard Worker 	"tnode/tnode_3", "Path contains regular file", ENOTDIR, setup3}, {
109*49cdfc7eSAndroid Build Coastguard Worker 	NULL, NULL, 0, no_setup}
110*49cdfc7eSAndroid Build Coastguard Worker };
111*49cdfc7eSAndroid Build Coastguard Worker 
112*49cdfc7eSAndroid Build Coastguard Worker char *TCID = "mknod06";
113*49cdfc7eSAndroid Build Coastguard Worker int TST_TOTAL = ARRAY_SIZE(Test_cases);
114*49cdfc7eSAndroid Build Coastguard Worker 
115*49cdfc7eSAndroid Build Coastguard Worker void setup();			/* setup function for the tests */
116*49cdfc7eSAndroid Build Coastguard Worker void cleanup();			/* cleanup function for the tests */
117*49cdfc7eSAndroid Build Coastguard Worker 
main(int ac,char ** av)118*49cdfc7eSAndroid Build Coastguard Worker int main(int ac, char **av)
119*49cdfc7eSAndroid Build Coastguard Worker {
120*49cdfc7eSAndroid Build Coastguard Worker 	int lc;
121*49cdfc7eSAndroid Build Coastguard Worker 	char *node_name;	/* ptr. for node name created */
122*49cdfc7eSAndroid Build Coastguard Worker 	char *test_desc;	/* test specific error message */
123*49cdfc7eSAndroid Build Coastguard Worker 	int ind;		/* counter to test different test conditions */
124*49cdfc7eSAndroid Build Coastguard Worker 
125*49cdfc7eSAndroid Build Coastguard Worker 	tst_parse_opts(ac, av, NULL, NULL);
126*49cdfc7eSAndroid Build Coastguard Worker 
127*49cdfc7eSAndroid Build Coastguard Worker 	/*
128*49cdfc7eSAndroid Build Coastguard Worker 	 * Invoke setup function to call individual test setup functions
129*49cdfc7eSAndroid Build Coastguard Worker 	 * for the test which run as root/super-user.
130*49cdfc7eSAndroid Build Coastguard Worker 	 */
131*49cdfc7eSAndroid Build Coastguard Worker 	setup();
132*49cdfc7eSAndroid Build Coastguard Worker 
133*49cdfc7eSAndroid Build Coastguard Worker 	for (lc = 0; TEST_LOOPING(lc); lc++) {
134*49cdfc7eSAndroid Build Coastguard Worker 
135*49cdfc7eSAndroid Build Coastguard Worker 		tst_count = 0;
136*49cdfc7eSAndroid Build Coastguard Worker 
137*49cdfc7eSAndroid Build Coastguard Worker 		for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
138*49cdfc7eSAndroid Build Coastguard Worker 			node_name = Test_cases[ind].pathname;
139*49cdfc7eSAndroid Build Coastguard Worker 			test_desc = Test_cases[ind].desc;
140*49cdfc7eSAndroid Build Coastguard Worker 
141*49cdfc7eSAndroid Build Coastguard Worker 			/*
142*49cdfc7eSAndroid Build Coastguard Worker 			 * Call mknod(2) to test different test conditions.
143*49cdfc7eSAndroid Build Coastguard Worker 			 * verify that it fails with -1 return value and
144*49cdfc7eSAndroid Build Coastguard Worker 			 * sets appropriate errno.
145*49cdfc7eSAndroid Build Coastguard Worker 			 */
146*49cdfc7eSAndroid Build Coastguard Worker 			TEST(mknod(node_name, MODE_RWX, 0));
147*49cdfc7eSAndroid Build Coastguard Worker 
148*49cdfc7eSAndroid Build Coastguard Worker 			/* Check return code from mknod(2) */
149*49cdfc7eSAndroid Build Coastguard Worker 			if (TEST_RETURN != -1) {
150*49cdfc7eSAndroid Build Coastguard Worker 				tst_resm(TFAIL,
151*49cdfc7eSAndroid Build Coastguard Worker 					 "mknod() returned %ld, expected "
152*49cdfc7eSAndroid Build Coastguard Worker 					 "-1, errno:%d", TEST_RETURN,
153*49cdfc7eSAndroid Build Coastguard Worker 					 Test_cases[ind].exp_errno);
154*49cdfc7eSAndroid Build Coastguard Worker 				continue;
155*49cdfc7eSAndroid Build Coastguard Worker 			}
156*49cdfc7eSAndroid Build Coastguard Worker 
157*49cdfc7eSAndroid Build Coastguard Worker 			if (TEST_ERRNO == Test_cases[ind].exp_errno) {
158*49cdfc7eSAndroid Build Coastguard Worker 				tst_resm(TPASS, "mknod() fails, %s, errno:%d",
159*49cdfc7eSAndroid Build Coastguard Worker 					 test_desc, TEST_ERRNO);
160*49cdfc7eSAndroid Build Coastguard Worker 			} else {
161*49cdfc7eSAndroid Build Coastguard Worker 				tst_resm(TFAIL, "mknod() fails, %s, errno:%d, "
162*49cdfc7eSAndroid Build Coastguard Worker 					 "expected errno:%d", test_desc,
163*49cdfc7eSAndroid Build Coastguard Worker 					 TEST_ERRNO, Test_cases[ind].exp_errno);
164*49cdfc7eSAndroid Build Coastguard Worker 			}
165*49cdfc7eSAndroid Build Coastguard Worker 		}
166*49cdfc7eSAndroid Build Coastguard Worker 
167*49cdfc7eSAndroid Build Coastguard Worker 	}
168*49cdfc7eSAndroid Build Coastguard Worker 
169*49cdfc7eSAndroid Build Coastguard Worker 	/*
170*49cdfc7eSAndroid Build Coastguard Worker 	 * Invoke cleanup() to delete the test directories created
171*49cdfc7eSAndroid Build Coastguard Worker 	 * in the setup().
172*49cdfc7eSAndroid Build Coastguard Worker 	 */
173*49cdfc7eSAndroid Build Coastguard Worker 	cleanup();
174*49cdfc7eSAndroid Build Coastguard Worker 
175*49cdfc7eSAndroid Build Coastguard Worker 	tst_exit();
176*49cdfc7eSAndroid Build Coastguard Worker }
177*49cdfc7eSAndroid Build Coastguard Worker 
178*49cdfc7eSAndroid Build Coastguard Worker /*
179*49cdfc7eSAndroid Build Coastguard Worker  * setup(void) - performs all ONE TIME setup for this test.
180*49cdfc7eSAndroid Build Coastguard Worker  * 	Exit the test program on receipt of unexpected signals.
181*49cdfc7eSAndroid Build Coastguard Worker  *	Create a temporary directory used to hold test directories and nodes
182*49cdfc7eSAndroid Build Coastguard Worker  *	created and change the directory to it.
183*49cdfc7eSAndroid Build Coastguard Worker  *	Invoke individual test setup functions according to the order
184*49cdfc7eSAndroid Build Coastguard Worker  *	set in struct. definition.
185*49cdfc7eSAndroid Build Coastguard Worker  */
setup(void)186*49cdfc7eSAndroid Build Coastguard Worker void setup(void)
187*49cdfc7eSAndroid Build Coastguard Worker {
188*49cdfc7eSAndroid Build Coastguard Worker 	int ind;
189*49cdfc7eSAndroid Build Coastguard Worker 
190*49cdfc7eSAndroid Build Coastguard Worker 	tst_require_root();
191*49cdfc7eSAndroid Build Coastguard Worker 
192*49cdfc7eSAndroid Build Coastguard Worker 	/* Capture unexpected signals */
193*49cdfc7eSAndroid Build Coastguard Worker 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
194*49cdfc7eSAndroid Build Coastguard Worker 
195*49cdfc7eSAndroid Build Coastguard Worker 	TEST_PAUSE;
196*49cdfc7eSAndroid Build Coastguard Worker 
197*49cdfc7eSAndroid Build Coastguard Worker 	/* Make a temp dir and cd to it */
198*49cdfc7eSAndroid Build Coastguard Worker 	tst_tmpdir();
199*49cdfc7eSAndroid Build Coastguard Worker 
200*49cdfc7eSAndroid Build Coastguard Worker 	/* call individual setup functions */
201*49cdfc7eSAndroid Build Coastguard Worker 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
202*49cdfc7eSAndroid Build Coastguard Worker 		if (!Test_cases[ind].pathname)
203*49cdfc7eSAndroid Build Coastguard Worker 			Test_cases[ind].pathname = tst_get_bad_addr(cleanup);
204*49cdfc7eSAndroid Build Coastguard Worker 		Test_cases[ind].setupfunc();
205*49cdfc7eSAndroid Build Coastguard Worker 	}
206*49cdfc7eSAndroid Build Coastguard Worker }
207*49cdfc7eSAndroid Build Coastguard Worker 
208*49cdfc7eSAndroid Build Coastguard Worker /*
209*49cdfc7eSAndroid Build Coastguard Worker  * no_setup() - Some test conditions for mknod(2) do not any setup.
210*49cdfc7eSAndroid Build Coastguard Worker  *		Hence, this function just returns 0.
211*49cdfc7eSAndroid Build Coastguard Worker  */
no_setup(void)212*49cdfc7eSAndroid Build Coastguard Worker int no_setup(void)
213*49cdfc7eSAndroid Build Coastguard Worker {
214*49cdfc7eSAndroid Build Coastguard Worker 	return 0;
215*49cdfc7eSAndroid Build Coastguard Worker }
216*49cdfc7eSAndroid Build Coastguard Worker 
217*49cdfc7eSAndroid Build Coastguard Worker /*
218*49cdfc7eSAndroid Build Coastguard Worker  * longpath_setup() - setup to create a node with a name length exceeding
219*49cdfc7eSAndroid Build Coastguard Worker  *		      the MAX. length of PATH_MAX.
220*49cdfc7eSAndroid Build Coastguard Worker  *   This function retruns 0.
221*49cdfc7eSAndroid Build Coastguard Worker  */
longpath_setup(void)222*49cdfc7eSAndroid Build Coastguard Worker int longpath_setup(void)
223*49cdfc7eSAndroid Build Coastguard Worker {
224*49cdfc7eSAndroid Build Coastguard Worker 	int ind;		/* counter variable */
225*49cdfc7eSAndroid Build Coastguard Worker 
226*49cdfc7eSAndroid Build Coastguard Worker 	for (ind = 0; ind <= (PATH_MAX + 1); ind++) {
227*49cdfc7eSAndroid Build Coastguard Worker 		Longpathname[ind] = 'a';
228*49cdfc7eSAndroid Build Coastguard Worker 	}
229*49cdfc7eSAndroid Build Coastguard Worker 	return 0;
230*49cdfc7eSAndroid Build Coastguard Worker }
231*49cdfc7eSAndroid Build Coastguard Worker 
232*49cdfc7eSAndroid Build Coastguard Worker /*
233*49cdfc7eSAndroid Build Coastguard Worker  * setup1() - setup function for a test condition for which mknod(2)
234*49cdfc7eSAndroid Build Coastguard Worker  *	      returns -1 and sets errno to EEXIST.
235*49cdfc7eSAndroid Build Coastguard Worker  *  This function creates a node using mknod(2) and tries to create
236*49cdfc7eSAndroid Build Coastguard Worker  *  same node in the test and fails with above errno.
237*49cdfc7eSAndroid Build Coastguard Worker  *  This function returns 0.
238*49cdfc7eSAndroid Build Coastguard Worker  */
setup1(void)239*49cdfc7eSAndroid Build Coastguard Worker int setup1(void)
240*49cdfc7eSAndroid Build Coastguard Worker {
241*49cdfc7eSAndroid Build Coastguard Worker 	/* Create a node using mknod */
242*49cdfc7eSAndroid Build Coastguard Worker 	if (mknod("tnode_1", MODE_RWX, 0) < 0) {
243*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup, "Fails to create node in setup1()");
244*49cdfc7eSAndroid Build Coastguard Worker 	}
245*49cdfc7eSAndroid Build Coastguard Worker 
246*49cdfc7eSAndroid Build Coastguard Worker 	return 0;
247*49cdfc7eSAndroid Build Coastguard Worker }
248*49cdfc7eSAndroid Build Coastguard Worker 
249*49cdfc7eSAndroid Build Coastguard Worker /*
250*49cdfc7eSAndroid Build Coastguard Worker  * setup3() - setup function for a test condition for which mknod(2)
251*49cdfc7eSAndroid Build Coastguard Worker  *	      returns -1 and sets errno to ENOTDIR.
252*49cdfc7eSAndroid Build Coastguard Worker  *  This function creates a node under temporary directory and the
253*49cdfc7eSAndroid Build Coastguard Worker  *  test attempts to create another node under under this node and fails
254*49cdfc7eSAndroid Build Coastguard Worker  *  with ENOTDIR as the node created here is a regular file.
255*49cdfc7eSAndroid Build Coastguard Worker  *  This function returns 0.
256*49cdfc7eSAndroid Build Coastguard Worker  */
setup3(void)257*49cdfc7eSAndroid Build Coastguard Worker int setup3(void)
258*49cdfc7eSAndroid Build Coastguard Worker {
259*49cdfc7eSAndroid Build Coastguard Worker 	/* Create a node using mknod */
260*49cdfc7eSAndroid Build Coastguard Worker 	if (mknod("tnode", MODE_RWX, 0) < 0) {
261*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup, "Fails to create node in setup3()");
262*49cdfc7eSAndroid Build Coastguard Worker 	}
263*49cdfc7eSAndroid Build Coastguard Worker 
264*49cdfc7eSAndroid Build Coastguard Worker 	return 0;
265*49cdfc7eSAndroid Build Coastguard Worker }
266*49cdfc7eSAndroid Build Coastguard Worker 
267*49cdfc7eSAndroid Build Coastguard Worker /*
268*49cdfc7eSAndroid Build Coastguard Worker  * cleanup() - Performs all ONE TIME cleanup for this test at
269*49cdfc7eSAndroid Build Coastguard Worker  *             completion or premature exit.
270*49cdfc7eSAndroid Build Coastguard Worker  *	Print test timing stats and errno log if test executed with options.
271*49cdfc7eSAndroid Build Coastguard Worker  *	Remove temporary directory and sub-directories/files under it
272*49cdfc7eSAndroid Build Coastguard Worker  *	created during setup().
273*49cdfc7eSAndroid Build Coastguard Worker  *	Exit the test program with normal exit code.
274*49cdfc7eSAndroid Build Coastguard Worker  */
cleanup(void)275*49cdfc7eSAndroid Build Coastguard Worker void cleanup(void)
276*49cdfc7eSAndroid Build Coastguard Worker {
277*49cdfc7eSAndroid Build Coastguard Worker 
278*49cdfc7eSAndroid Build Coastguard Worker 	tst_rmdir();
279*49cdfc7eSAndroid Build Coastguard Worker 
280*49cdfc7eSAndroid Build Coastguard Worker }
281