File: test.ia_ssh

package info (click to toggle)
shellia 5.7.6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 728 kB
  • sloc: sh: 7,087; makefile: 34
file content (56 lines) | stat: -rwxr-xr-x 1,376 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# vim: set filetype=sh :
#        file: test.ia_ssh
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2022)
#     license: GNU General Public License, version 3
# description: test using higlevel command ia_ssh
#    see also: example.ia_ssh

# The following tests are included:
# (1) Run with -i
# (2) check logfile

. ./tstlib

shell=""
while [ $# -ne 0 ]; do
  if [ "$1" = "-s" ]; then
    shell="$2"
    shift 2
  else
    /bin/echo "ERROR $0: unknown option <$1>" >&2
    exit 1
  fi
done
[ "$shell" ] && set -- "$@" -s "$shell"
[ "$shell" = "bash" ] && set -- "$@" -u "$UNIFY_bash"

cmd=$(dirname $0)/example.ia_ssh
ia_logfile="$(mktemp)"
export ia_logfile

rm -f $ia_logfile
check "(1) Run with -i" --sshd2222-opts -i "/bin/echo \"c
\"" "$@" "$cmd -a -i" \
"=== example.ia_ssh ===
1 ia_ssh $<sshopts> localhost \"cd /tmp; pwd\"
2 ia_ssh $<sshopts> localhost cd /tmp\\; pwd
3 ia_ssh $<sshopts> localhost \"exit 7\"
d ... change dbg: 0
c continue without questions
q quit
? [1] 
/tmp
/tmp
Command exited with non-zero status 7"

check "(2) check logfile" --sshd2222 "$@" "cat $ia_logfile" \
"|=== example.ia_ssh ===
|1 ia_ssh $<sshopts> localhost \"cd /tmp; pwd\"
|2 ia_ssh $<sshopts> localhost cd /tmp\\; pwd
|3 ia_ssh $<sshopts> localhost \"exit 7\"
|d ... change dbg: 0
|c continue without questions
|q quit
|? [1] c<RETURN>"
rm -f $ia_logfile