(command.CommandList children: [ (command.Simple blame_tok: <Id.Lit_Colon ':'> more_env: [] words: [ {<Id.Lit_Colon ':'>} { (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name TEST_SH> var_name: TEST_SH suffix_op: (suffix_op.Unary op:<Id.VTest_ColonEquals _> arg_word:{(DQ <'/bin/sh'>)}) right: <Id.Right_DollarBrace '}'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<basic_wait>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <basic_wait_head> name: basic_wait_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [{<atf_set>} {(DQ <descr>)} {(DQ <'Tests simple uses of wait'>)}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <basic_wait_body> name: basic_wait_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_require_prog> more_env: [] words: [{<atf_require_prog>} {<sleep>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<empty>} {<-e>} {<empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(SQ <'(echo nothing >/dev/null) & wait'>)} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<empty>} {<-e>} {<empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} { (SQ <'(exit 3) & wait $!; S=$?; test $S -eq 3 || {\n'> <'\t\t\techo "status: $S"; exit 1; }'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<empty>} {<-e>} {<empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(SQ <'sleep 3 & sleep 2 & sleep 1 & wait'>)} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<empty>} {<-e>} {<empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(SQ <'sleep 3 & (exit 2) & sleep 1 & wait'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<individual>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <individual_head> name: individual_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [ {<atf_set>} {(DQ <descr>)} {(DQ <'Tests that waiting for individual processes works'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <individual_body> name: individual_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_require_prog> more_env: [] words: [{<atf_require_prog>} {<sleep>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>}] redirects: [ (Redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<individualhelper.sh>} ) (Redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_tok: <Id.Undefined_Tok ''> stdin_parts: [ <'sleep 3 & P1=$!\n'> <'sleep 1 & P2=$!\n'> <'\n'> <'wait ${P1}\n'> <'S=$?\n'> <'if [ $S -ne 0 ]; then\n'> <' echo "Waiting for first process failed: $S"\n'> <' exit 1\n'> <'fi\n'> <'\n'> <'wait ${P2}\n'> <'S=$?\n'> <'if [ $? -ne 0 ]; then\n'> <' echo "Waiting for second process failed"\n'> <' exit 1\n'> <'fi\n'> <'\n'> <'exit 0\n'> ] ) ) ] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'output='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'output='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'output='> name:output) op: assign_op.Equal rhs: { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.Left_DollarBrace '${'> more_env: [] words: [{(${ Id.VSub_Name TEST_SH)} {<individualhelper.sh>}] redirects: [ (Redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] redirects: [] ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '?')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_fail> more_env: [] words: [{<atf_fail>} {(DQ (${ Id.VSub_Name output))}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DPipe _>] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<jobs>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <jobs_head> name: jobs_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [{<atf_set>} {(DQ <descr>)} {(DQ <'Tests that waiting for individual jobs works'>)}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <jobs_body> name: jobs_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Pipeline negated: <Id.KW_Bang '!'> children: [ (command.Simple blame_tok: <Id.Left_DollarBrace '${'> more_env: [] words: [{(${ Id.VSub_Name TEST_SH)} {<-c>} {(SQ <'sleep 1 & wait %1'>)}] redirects: [ (Redir op: <Id.Redir_Great '2>'> loc: (redir_loc.Fd fd:2) arg: {<'/dev/null'>} ) ] do_fork: T ) ] ops: [] ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Simple blame_tok: <atf_skip> more_env: [] words: [{<atf_skip>} {(DQ <'No job control support in this shell'>)}] redirects: [] do_fork: T ) ] spids: [390 408] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>}] redirects: [ (Redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<individualhelper.sh>} ) (Redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_tok: <Id.Undefined_Tok ''> stdin_parts: [ <'sleep 3 &\n'> <'sleep 1 &\n'> <'\n'> <'wait %1\n'> <'if [ $? -ne 0 ]; then\n'> <' echo "Waiting for first job failed"\n'> <' exit 1\n'> <'fi\n'> <'\n'> <'wait %2\n'> <'if [ $? -ne 0 ]; then\n'> <' echo "Waiting for second job failed"\n'> <' exit 1\n'> <'fi\n'> <'\n'> <'exit 0\n'> ] ) ) ] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'output='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'output='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'output='> name:output) op: assign_op.Equal rhs: { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.Left_DollarBrace '${'> more_env: [] words: [{(${ Id.VSub_Name TEST_SH)} {<individualhelper.sh>}] redirects: [ (Redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] redirects: [] ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '?')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_fail> more_env: [] words: [{<atf_fail>} {(DQ (${ Id.VSub_Name output))}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DPipe _>] ) (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>}] redirects: [ (Redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<individualhelper.sh>} ) (Redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_tok: <Id.Undefined_Tok ''> stdin_parts: [ <'{ sleep 3; exit 3; } &\n'> <'{ sleep 1; exit 7; } &\n'> <'\n'> <'wait %1\n'> <'S=$?\n'> <'if [ $S -ne 3 ]; then\n'> <' echo "Waiting for first job failed - status: $S != 3 (expected)"\n'> <' exit 1\n'> <'fi\n'> <'\n'> <'wait %2\n'> <'S=$?\n'> <'if [ $S -ne 7 ]; then\n'> <' echo "Waiting for second job failed - status: $S != 7 (expected)"\n'> <' exit 1\n'> <'fi\n'> <'\n'> <'exit 0\n'> ] ) ) ] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'output='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'output='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'output='> name:output) op: assign_op.Equal rhs: { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <Id.Left_DollarBrace '${'> more_env: [] words: [{(${ Id.VSub_Name TEST_SH)} {<individualhelper.sh>}] redirects: [ (Redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] redirects: [] ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '?')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_fail> more_env: [] words: [{<atf_fail>} {(DQ (${ Id.VSub_Name output))}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DPipe _>] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<kill>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <kill_head> name: kill_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [ {<atf_set>} {(DQ <descr>)} {(DQ <'Tests that killing the shell while in wait calls trap'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <kill_body> name: kill_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_require_prog> more_env: [] words: [{<atf_require_prog>} {<sleep>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_require_prog> more_env: [] words: [{<atf_require_prog>} {<kill>}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 's='> pairs: [ (AssignPair left: <Id.Lit_VarLike 's='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 's='> name:s) op: assign_op.Equal rhs: {<killhelper.sh>} ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'z='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'z='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'z='> name:z) op: assign_op.Equal rhs: {<killhelper.> ($ Id.VSub_Dollar '$')} ) ] redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'pid='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'pid='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'pid='> name:pid) op: assign_op.Equal rhs: (rhs_word__Empty) ) ] redirects: [] ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <127>} {<-o>} {<empty>} {<-e>} {<ignore>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(SQ <'wait 1'>)} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>}] redirects: [ (Redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ (${ Id.VSub_Name s))} ) (Redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(SQ <EOF>)} here_end_tok: <Id.Undefined_Tok ''> stdin_parts: [ <'\n'> <'trap "echo SIGHUP" 1\n'> <'(sleep 5; exit 3) &\n'> <'sl=$!\n'> <'wait\n'> <'S=$?\n'> <'echo $S\n'> <'LS=9999\n'> <'while [ $S -ne 0 ] && [ $S != 127 ]; do\n'> <'\twait $sl; S=$?; echo $S\n'> <'\ttest $S = $LS && { echo "wait repeats..."; exit 2; }\n'> <'\tLS=$S\n'> <'\tdone\n'> ] ) ) ] do_fork: T ) (command.Sentence child: (command.Simple blame_tok: <Id.Left_DollarBrace '${'> more_env: [] words: [{(${ Id.VSub_Name TEST_SH)} {($ Id.VSub_DollarName s)}] redirects: [ (Redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName z)} ) ] do_fork: T ) terminator: <Id.Op_Amp _> ) (command.ShAssignment left: <Id.Lit_VarLike 'pid='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'pid='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'pid='> name:pid) op: assign_op.Equal rhs: {($ Id.VSub_Bang '!')} ) ] redirects: [] ) (command.Simple blame_tok: <sleep> more_env: [] words: [{<sleep>} {<1>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <kill> more_env: [] words: [{<kill>} {<-HUP>} {(DQ (${ Id.VSub_Name pid))}] redirects: [] do_fork: T ) (command.Simple blame_tok: <wait> more_env: [] words: [{<wait>}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'output='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'output='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'output='> name:output) op: assign_op.Equal rhs: { (DQ (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>} {($ Id.VSub_DollarName z)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <tr> more_env: [] words: [{<tr>} {(SQ <'\\n'>)} {(SQ <' '>)}] redirects: [] do_fork: T ) ] ops: [<Id.Op_Pipe _>] ) right: <Id.Eof_RParen _> ) ) } ) ] redirects: [] ) (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName output))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <'SIGHUP 129 3 127 '>)} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.Simple blame_tok: <atf_fail> more_env: [] words: [{<atf_fail>} {(DQ (${ Id.VSub_Name output) <' != \'SIGHUP 129 3 127 \''>)}] redirects: [] do_fork: T ) ] spids: [742 760] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <atf_init_test_cases> name: atf_init_test_cases body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<basic_wait>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<individual>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<jobs>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<kill>}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) ] )