diff options
author | Tim Rice <tim@multitalents.net> | 2014-01-28 10:26:25 -0800 |
---|---|---|
committer | Tim Rice <tim@multitalents.net> | 2014-01-28 10:26:25 -0800 |
commit | 6f917ad376481995ab7d29fb53b08ec8d507eb9e (patch) | |
tree | 28b8e366f294cb729598cdb826f626682be73a9b /regress | |
parent | ab16ef4152914d44ce6f76e48167d26d22f66a06 (diff) |
- (tim) [regress/agent.sh regress/agent-ptrace.sh] Assign $? to a variable
when used as an error message inside an if statement so we display the
correct into. agent.sh patch from Petr Lautrbach.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/agent-ptrace.sh | 5 | ||||
-rw-r--r-- | regress/agent.sh | 30 |
2 files changed, 21 insertions, 14 deletions
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh index 6824b8141..ae150641f 100644 --- a/regress/agent-ptrace.sh +++ b/regress/agent-ptrace.sh | |||
@@ -45,8 +45,9 @@ else | |||
45 | gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF | 45 | gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF |
46 | quit | 46 | quit |
47 | EOF | 47 | EOF |
48 | if [ $? -ne 0 ]; then | 48 | r=$? |
49 | fail "gdb failed: exit code $?" | 49 | if [ $r -ne 0 ]; then |
50 | fail "gdb failed: exit code $r" | ||
50 | fi | 51 | fi |
51 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out | 52 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out |
52 | r=$? | 53 | r=$? |
diff --git a/regress/agent.sh b/regress/agent.sh index 90bad15d4..cf1a45fe0 100644 --- a/regress/agent.sh +++ b/regress/agent.sh | |||
@@ -34,40 +34,46 @@ else | |||
34 | fi | 34 | fi |
35 | done | 35 | done |
36 | ${SSHADD} -l > /dev/null 2>&1 | 36 | ${SSHADD} -l > /dev/null 2>&1 |
37 | if [ $? -ne 0 ]; then | 37 | r=$? |
38 | fail "ssh-add -l failed: exit code $?" | 38 | if [ $r -ne 0 ]; then |
39 | fail "ssh-add -l failed: exit code $r" | ||
39 | fi | 40 | fi |
40 | # the same for full pubkey output | 41 | # the same for full pubkey output |
41 | ${SSHADD} -L > /dev/null 2>&1 | 42 | ${SSHADD} -L > /dev/null 2>&1 |
42 | if [ $? -ne 0 ]; then | 43 | r=$? |
43 | fail "ssh-add -L failed: exit code $?" | 44 | if [ $r -ne 0 ]; then |
45 | fail "ssh-add -L failed: exit code $r" | ||
44 | fi | 46 | fi |
45 | 47 | ||
46 | trace "simple connect via agent" | 48 | trace "simple connect via agent" |
47 | for p in 1 2; do | 49 | for p in 1 2; do |
48 | ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p | 50 | ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p |
49 | if [ $? -ne 5$p ]; then | 51 | r=$? |
50 | fail "ssh connect with protocol $p failed (exit code $?)" | 52 | if [ $r -ne 5$p ]; then |
53 | fail "ssh connect with protocol $p failed (exit code $r)" | ||
51 | fi | 54 | fi |
52 | done | 55 | done |
53 | 56 | ||
54 | trace "agent forwarding" | 57 | trace "agent forwarding" |
55 | for p in 1 2; do | 58 | for p in 1 2; do |
56 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 | 59 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 |
57 | if [ $? -ne 0 ]; then | 60 | r=$? |
58 | fail "ssh-add -l via agent fwd proto $p failed (exit code $?)" | 61 | if [ $r -ne 0 ]; then |
62 | fail "ssh-add -l via agent fwd proto $p failed (exit code $r)" | ||
59 | fi | 63 | fi |
60 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ | 64 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ |
61 | "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" | 65 | "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" |
62 | if [ $? -ne 5$p ]; then | 66 | r=$? |
63 | fail "agent fwd proto $p failed (exit code $?)" | 67 | if [ $r -ne 5$p ]; then |
68 | fail "agent fwd proto $p failed (exit code $r)" | ||
64 | fi | 69 | fi |
65 | done | 70 | done |
66 | 71 | ||
67 | trace "delete all agent keys" | 72 | trace "delete all agent keys" |
68 | ${SSHADD} -D > /dev/null 2>&1 | 73 | ${SSHADD} -D > /dev/null 2>&1 |
69 | if [ $? -ne 0 ]; then | 74 | r=$? |
70 | fail "ssh-add -D failed: exit code $?" | 75 | if [ $r -ne 0 ]; then |
76 | fail "ssh-add -D failed: exit code $r" | ||
71 | fi | 77 | fi |
72 | 78 | ||
73 | trace "kill agent" | 79 | trace "kill agent" |