diff options
author | Darren Tucker <dtucker@zip.com.au> | 2012-10-05 12:04:10 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2012-10-05 12:04:10 +1000 |
commit | ee4ad778d778c8a19c763738a0851afb9c6ccf16 (patch) | |
tree | e735869ca9f893b8679877604ecf2620dbadd9ec /regress | |
parent | 9b2c0360cf7de7b460f1740b4eb247c27da4630f (diff) |
- dtucker@cvs.openbsd.org 2012/09/10 01:51:19
[regress/multiplex.sh]
use -Ocheck and waiting for completions by PID to make multiplexing test
less racy and (hopefully) more reliable on slow hardware.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/multiplex.sh | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh index 9169656dd..f93ac9a41 100644 --- a/regress/multiplex.sh +++ b/regress/multiplex.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: multiplex.sh,v 1.15 2012/09/10 00:49:21 dtucker Exp $ | 1 | # $OpenBSD: multiplex.sh,v 1.16 2012/09/10 01:51:19 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | CTL=/tmp/openssh.regress.ctl-sock.$$ | 4 | CTL=/tmp/openssh.regress.ctl-sock.$$ |
@@ -13,14 +13,22 @@ fi | |||
13 | DATA=/bin/ls${EXEEXT} | 13 | DATA=/bin/ls${EXEEXT} |
14 | COPY=$OBJ/ls.copy | 14 | COPY=$OBJ/ls.copy |
15 | 15 | ||
16 | wait_for_mux_master_ready() | ||
17 | { | ||
18 | for i in 1 2 3 4 5; do | ||
19 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost \ | ||
20 | >/dev/null 2>&1 && return 0 | ||
21 | sleep $i | ||
22 | done | ||
23 | fatal "mux master never becomes ready" | ||
24 | } | ||
25 | |||
16 | start_sshd | 26 | start_sshd |
17 | 27 | ||
18 | trace "start master, fork to background" | 28 | trace "start master, fork to background" |
19 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & | 29 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & |
20 | MASTER_PID=$! | 30 | MASTER_PID=$! |
21 | 31 | wait_for_mux_master_ready | |
22 | # Wait for master to start and authenticate | ||
23 | sleep 5 | ||
24 | 32 | ||
25 | verbose "test $tid: envpass" | 33 | verbose "test $tid: envpass" |
26 | trace "env passing over multiplexed connection" | 34 | trace "env passing over multiplexed connection" |
@@ -87,21 +95,26 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_SSH_LOGFILE 2>&1 \ | |||
87 | || fail "send exit command failed" | 95 | || fail "send exit command failed" |
88 | 96 | ||
89 | # Wait for master to exit | 97 | # Wait for master to exit |
90 | sleep 2 | 98 | wait $MASTER_PID |
91 | 99 | kill -0 $MASTER_PID >/dev/null && fail "exit command failed" | |
92 | kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed" | ||
93 | 100 | ||
94 | # Restart master and test -O stop command with master using -N | 101 | # Restart master and test -O stop command with master using -N |
95 | trace "start master, fork to background" | 102 | verbose "test $tid: cmd stop" |
103 | trace "restart master, fork to background" | ||
96 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & | 104 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & |
97 | MASTER_PID=$! | 105 | MASTER_PID=$! |
98 | sleep 5 # Wait for master to start and authenticate | 106 | wait_for_mux_master_ready |
99 | verbose "test $tid: cmd stop" | 107 | |
100 | ${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" & | 108 | # start a long-running command then immediately request a stop |
109 | ${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \ | ||
110 | >>$TEST_SSH_LOGFILE 2>&1 & | ||
101 | SLEEP_PID=$! | 111 | SLEEP_PID=$! |
102 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \ | 112 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \ |
103 | || fail "send stop command failed" | 113 | || fail "send stop command failed" |
104 | sleep 12 # Wait for master to exit | 114 | |
115 | # wait until both long-running command and master have exited. | ||
105 | wait $SLEEP_PID | 116 | wait $SLEEP_PID |
106 | [ $! != 0 ] || fail "stop with concurrent command" | 117 | [ $! != 0 ] || fail "waiting for concurrent command" |
107 | ps -p $MASTER_PID >/dev/null && fail "stop command failed" | 118 | wait $MASTER_PID |
119 | [ $! != 0 ] || fail "waiting for master stop" | ||
120 | kill -0 $MASTER_PID >/dev/null && fail "stop command failed" | ||