Revert "Fix wait test with no process expansion"

This reverts commit b38ac1e35d as wait now
supports process expansion (via the wait wrapper).
This commit is contained in:
Mahmoud Al-Qudsi 2018-04-14 21:42:57 -05:00
parent 9a9238a253
commit 7ec761fc75

View file

@ -25,14 +25,14 @@ send_line "jobs"
expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg }
# one job id specified # 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 expect_prompt
send_line "wait \$pid3" send_line "wait %3"
expect "Job 3, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } expect "Job 2, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg }
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 \$pid1" send_line "wait %1"
expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg } expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg }
send_line "jobs" send_line "jobs"
expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } 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 # three job ids specified
set error_msg "three job ids specified: Fail" 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 expect_prompt
send_line "wait \$pid1 \$pid3 \$pid4" send_line "wait %1 %3 %4"
expect "Job 3, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } expect "Job 2, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg }
expect "Job 4, 'sleep 2 &' 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 "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" send_line "jobs"
expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg }
# wait with -n option # wait with -n option
set error_msg "wait with -n option: Fail" 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 expect_prompt
send_line "wait -n" 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" 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" send_line "wait -n"
expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg } expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg }
send_line "jobs" 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 # specify job ids with -n option
set error_msg "specify job ids with -n option: Fail" 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 expect_prompt
send_line "wait -n \$pid1 \$pid3" send_line "wait -n %1 %3"
expect "Job 3, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg } expect "Job 2, 'sleep 1 &' has ended" {} timeout { puts stderr $error_msg }
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 \$pid1" send_line "wait -n %1"
expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg } expect_prompt "Job 1, 'sleep 3 &' has ended" {} unmatched { puts stderr $error_msg }
send_line "jobs" send_line "jobs"
expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg } 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 &" send_line "sleep 3 &"
expect_prompt expect_prompt
send_line "kill -STOP \$last_pid" send_line "kill -STOP %1"
expect_prompt expect_prompt
send_line "wait" send_line "wait"
expect_prompt expect_prompt
send_line "wait \$last_pid" send_line "wait %1"
expect_prompt expect_prompt
send_line "wait -n" send_line "wait -n"
expect_prompt expect_prompt
send_line "bg \$last_pid" send_line "bg %1"
expect_prompt expect_prompt
send_line "wait" send_line "wait"
expect_prompt expect_prompt