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) 2020 Cyril Hrubis <[email protected]> 4*49cdfc7eSAndroid Build Coastguard Worker */ 5*49cdfc7eSAndroid Build Coastguard Worker 6*49cdfc7eSAndroid Build Coastguard Worker /* 7*49cdfc7eSAndroid Build Coastguard Worker * Test that TBROK is propagated correctly to the results even if we wait on 8*49cdfc7eSAndroid Build Coastguard Worker * child and throw away the status. 9*49cdfc7eSAndroid Build Coastguard Worker */ 10*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h" 11*49cdfc7eSAndroid Build Coastguard Worker do_test(void)12*49cdfc7eSAndroid Build Coastguard Workerstatic void do_test(void) 13*49cdfc7eSAndroid Build Coastguard Worker { 14*49cdfc7eSAndroid Build Coastguard Worker int pid = SAFE_FORK(); 15*49cdfc7eSAndroid Build Coastguard Worker 16*49cdfc7eSAndroid Build Coastguard Worker if (pid) { 17*49cdfc7eSAndroid Build Coastguard Worker tst_res(TPASS, "Test main pid"); 18*49cdfc7eSAndroid Build Coastguard Worker SAFE_WAITPID(pid, NULL, 0); 19*49cdfc7eSAndroid Build Coastguard Worker return; 20*49cdfc7eSAndroid Build Coastguard Worker } 21*49cdfc7eSAndroid Build Coastguard Worker 22*49cdfc7eSAndroid Build Coastguard Worker if (tst_variant == 1) 23*49cdfc7eSAndroid Build Coastguard Worker tst_brk(TBROK, "Test child!"); 24*49cdfc7eSAndroid Build Coastguard Worker else 25*49cdfc7eSAndroid Build Coastguard Worker tst_brk(TCONF, "Test child!"); 26*49cdfc7eSAndroid Build Coastguard Worker 27*49cdfc7eSAndroid Build Coastguard Worker tst_res(TPASS, "Test child"); 28*49cdfc7eSAndroid Build Coastguard Worker } 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = { 31*49cdfc7eSAndroid Build Coastguard Worker .test_all = do_test, 32*49cdfc7eSAndroid Build Coastguard Worker .test_variants = 2, 33*49cdfc7eSAndroid Build Coastguard Worker .forks_child = 1, 34*49cdfc7eSAndroid Build Coastguard Worker }; 35