diff --git a/tests/wait.expect b/tests/wait.expect index 4eb6ec74b..94870f517 100644 --- a/tests/wait.expect +++ b/tests/wait.expect @@ -25,14 +25,14 @@ send_line "jobs" expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } # one job id specified -set error_msg "one job id specified: Fail" +set error_msg "one job id specified" -send_line "sleep 3 &; set pid1 \$last_pid; sleep 1 &; set pid2 \$last_pid; sleep 2 &; set pid3 \$last_pid;" +send_line "sleep 3 &; sleep 1 &; sleep 2 &" expect_prompt -send_line "wait \$pid3" -expect "Job 3, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } -expect_prompt "Job 4, 'sleep 2 &' has ended" {} unmatched { puts stderr $error_msg } -send_line "wait \$pid1" +send_line "wait %3" +expect "Job 2, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } +expect_prompt "Job 3, 'sleep 2 &' has ended" {} unmatched { puts stderr $error_msg } +send_line "wait %1" expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg } send_line "jobs" expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } @@ -40,25 +40,25 @@ expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } # three job ids specified set error_msg "three job ids specified: Fail" -send_line "sleep 3 &; set pid1 \$last_pid; sleep 1 &; set pid2 \$last_pid; sleep 2 &; set pid3 \$last_pid; sleep 4 &; set pid4 \$last_pid;" +send_line "sleep 3 &; sleep 1 &; sleep 2 &; sleep 4 &;" expect_prompt -send_line "wait \$pid1 \$pid3 \$pid4" -expect "Job 3, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } -expect "Job 4, 'sleep 2 &' has ended" {} timeout { puts stderr $error_msg } +send_line "wait %1 %3 %4" +expect "Job 2, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } +expect "Job 3, 'sleep 2 &' has ended" {} timeout { puts stderr $error_msg } expect "Job 1, 'sleep 3 &' has ended" {} timeout { puts stderr $error_msg } -expect_prompt "Job 5, 'sleep 4 &' has ended" {} unmatched { puts stderr $error_msg } +expect_prompt "Job 4, 'sleep 4 &' has ended" {} unmatched { puts stderr $error_msg } send_line "jobs" expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } # wait with -n option set error_msg "wait with -n option: Fail" -send_line "sleep 3 &; set pid1 \$last_pid; sleep 1 &; set pid2 \$last_pid; sleep 2 &; set pid3 \$last_pid;" +send_line "sleep 3 &; sleep 1 &; sleep 2 &" expect_prompt send_line "wait -n" -expect_prompt "Job 3, 'sleep 1 &' has ended" {} unmatched { puts stderr $error_msg } +expect_prompt "Job 2, 'sleep 1 &' has ended" {} unmatched { puts stderr $error_msg } send_line "wait -n" -expect_prompt "Job 4, 'sleep 2 &' has ended" {} unmatched { puts stderr $error_msg } +expect_prompt "Job 3, 'sleep 2 &' has ended" {} unmatched { puts stderr $error_msg } send_line "wait -n" expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg } send_line "jobs" @@ -67,12 +67,12 @@ expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } # specify job ids with -n option set error_msg "specify job ids with -n option: Fail" -send_line "sleep 3 &; set pid1 \$last_pid; sleep 1 &; set pid2 \$last_pid; sleep 2 &; set pid3 \$last_pid;" +send_line "sleep 3 &; sleep 1 &; sleep 2 &" expect_prompt -send_line "wait -n \$pid1 \$pid3" -expect "Job 3, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } -expect_prompt "Job 4, 'sleep 2 &' has ended" {} unmatched { puts stderr $error_msg } -send_line "wait -n \$pid1" +send_line "wait -n %1 %3" +expect "Job 2, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } +expect_prompt "Job 3, 'sleep 2 &' has ended" {} unmatched { puts stderr $error_msg } +send_line "wait -n %1" expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg } send_line "jobs" expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } @@ -82,15 +82,15 @@ set error_msg "don't wait stopped jobs: Fail" send_line "sleep 3 &" expect_prompt -send_line "kill -STOP \$last_pid" +send_line "kill -STOP %1" expect_prompt send_line "wait" expect_prompt -send_line "wait \$last_pid" +send_line "wait %1" expect_prompt send_line "wait -n" expect_prompt -send_line "bg \$last_pid" +send_line "bg %1" expect_prompt send_line "wait" expect_prompt