File: test.only_interactive

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 (190 lines) | stat: -rwxr-xr-x 3,306 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/sh
# vim: set filetype=sh :
#        file: test.only_interactive
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2021)
#     license: GNU General Public License, version 3
# description: test using interactive without log, debug and check features.
#    see also: example.only_interactive

# The following tests are included:
# (1) Run script with mixed options

. ./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" = "posh" ] && set -- "$@" -u "$(bug913718_unify)"
[ "$shell" = "bash" ] && set -- "$@" -u "$UNIFY_bash"

cmd=$(dirname $0)/example.only_interactive
bug913718_cmd

res1=\
"=== example.only_interactive ===
1 echo 1
2 echo 2
3 sub -i
4 echo 3
5 echo 4
i toggle -i flag
c continue without questions
q quit
? [1] 
1
=== example.only_interactive ===
1 echo 1
2 echo 2
3 sub -i
4 echo 3
5 echo 4
i toggle -i flag
c continue without questions
q quit
? [2] 
2
=== example.only_interactive ===
1 echo 1
2 echo 2
3 sub -i
4 echo 3
5 echo 4
i toggle -i flag
c continue without questions
q quit
? [3] 
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [1] 
2.1
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [2] 
2.2
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [3] 
2.3
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [4] 
=== example.only_interactive/sub/sub_sub ===
1 echo 2.3.1
2 echo 2.3.2
c continue without questions
q quit
? [1] 
2.3.1
=== example.only_interactive/sub/sub_sub ===
1 echo 2.3.1
2 echo 2.3.2
q quit
? [2] 
2.3.2
=== example.only_interactive/sub/sub_sub ===
1 echo 2.3.1
2 echo 2.3.2
q quit
? [q] 
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [5] 
2.4
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [6] 
2.5"

if [ "$shell" = "posh" ]; then
  res="$res1
=== example.only_interactive/sub ===
1 echo 2.1
2 echo 2.2 >&2
3 echo 2.3
4 sub_sub -i
5 echo 2.4
6 sh -c \"echo 2.5; exit 25\"
7 echo 2.6; exit 26
8 echo 2.7
i toggle -i flag
c continue without questions
q quit
? [7] 
2.6
Command exited with non-zero status 26"
else
  res="$res1
Command exited with non-zero status 25"
fi

check "(1) Run script with mixed options" -i  "seq 25 | sed \"s/.*//\"" "$@" \
  "$cmd -a -i" "$res"