• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
4  */
5 
6 /*
7  * Test for result propagation.
8  */
9 
10 #include "tst_test.h"
11 
setup(void)12 static void setup(void)
13 {
14 	tst_res(TINFO, "setup() executed by pid %i", getpid());
15 }
16 
cleanup(void)17 static void cleanup(void)
18 {
19 	tst_res(TINFO, "cleanup() executed by pid %i", getpid());
20 }
21 
do_test(void)22 static void do_test(void)
23 {
24 	unsigned int i;
25 
26 	for (i = 0; i < 100; i++) {
27 		if (SAFE_FORK() == 0) {
28 			tst_res(TPASS, "Child (%i)", getpid());
29 			return;
30 		}
31 	}
32 }
33 
34 static struct tst_test test = {
35 	.test_all = do_test,
36 	.setup = setup,
37 	.cleanup = cleanup,
38 	.forks_child = 1,
39 };
40