File: test.return2

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 (185 lines) | stat: -rwxr-xr-x 3,395 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
# vim: set filetype=sh :
#        file: test.return
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
#     license: GNU General Public License, version 3
# description: test handling of error output
#    see also: example.return

# The following tests are included:
# (1) Run this script without options
# (2) check logfile

. ./tstlib

quote="'"
shell=""
while [ $# -ne 0 ]; do
  if [ "$1" = "-s" ]; then
    shell="$2"
    shift 2
  else
    echo "ERROR $0: unknown option <$1>" >&2
    exit 1
  fi
done

[ "$shell" = "bash" ] && set -- "$@" -u "$UNIFY_bash"
bug913718_unify UNIFY_posh
[ "$shell" = "posh" ] && set -- "$@" -u "$UNIFY_posh"
[ "$shell" = "mksh" ] && set -- "$@" -u "$UNIFY_mksh"
[ "$shell" = "busybox sh" ] && set -- "$@" -u "$UNIFY_busybox"

[ "$shell" ] && set -- "$@" -s "$shell"
cmd=$(dirname $0)/example.return2
bug913718_cmd

ia_logfile="$(mktemp)"
export ia_logfile

rm -f $ia_logfile
check "(1) Run this script without options" "$@" "$cmd" \
"=== no_ia ===
msg1 on stdout
msg2 on stderr
?=42
msg1 on stdout
msg2 on stderr
exit=43
?=43
msg1 on stdout
msg2 on stderr
?=44
=== ia_stdout ia -c ===
msg1 on stdout
msg2 on stderr
exit=42
msg1 on stdout
msg2 on stderr
exit=43
exit=43
msg1 on stdout
msg2 on stderr
exit=44
msg1 on stdout
exit=45
msg1 on stdout
msg2 on stderr
exit=46
?=46
=== ia_nocheck ia -c ===
msg1 on stdout
msg2 on stderr
msg1 on stdout
msg2 on stderr
exit=43
msg1 on stdout
msg2 on stderr
msg1 on stdout
msg1 on stdout
msg2 on stderr
?=46
=== ia_ignore ia -C ===
msg1 on stdout
msg1 on stdout
msg2 on stderr
exit=43
msg1 on stdout
msg1 on stdout
msg1 on stdout
?=46
=== ia_nocheck ia -C ===
msg1 on stdout
msg2 on stderr
msg1 on stdout
msg2 on stderr
exit=43
msg1 on stdout
msg2 on stderr
msg1 on stdout
msg1 on stdout
msg2 on stderr
?=46"

check "(2) check logfile" "$@" "cat $ia_logfile" \
"|example.return2
|s:msg1 on stdout
|s:msg2 on stderr
|s:exit=43
||example.return2/return
|example.return2
|s:msg1 on stdout
|s:msg2 on stderr
|s:exit=42
||example.return2/fun_ia_c
||s:msg1 on stdout
||s:msg2 on stderr
||s:exit=43
|s:msg1 on stdout
|s:msg2 on stderr
|s:exit=43
|s:exit=43
||example.return2/fun_ia_c_nocheck
|s:msg1 on stdout
|s:msg2 on stderr
|s:exit=44
||example.return2/fun_ia_C
||s:msg1 on stdout
||i:msg2 on stderr
||i:exit=45
|s:msg1 on stdout
|s:exit=45
||example.return2/fun_ia_C_nocheck
|s:msg1 on stdout
|s:msg2 on stderr
|s:exit=46
|example.return2
||example.return2/fun_ia_c
||s:msg1 on stdout
||s:msg2 on stderr
||s:exit=43
||example.return2/fun_ia_c_nocheck
||example.return2/fun_ia_C
||s:msg1 on stdout
||i:msg2 on stderr
||i:exit=45
||example.return2/fun_ia_C_nocheck
|example.return2
|i:msg2 on stderr
|i:exit=42
|s:msg1 on stdout
||example.return2/fun_ia_c
||s:msg1 on stdout
||s:msg2 on stderr
||s:exit=43
|i:exit=43
|s:msg1 on stdout
|s:msg2 on stderr
|s:exit=43
||example.return2/fun_ia_c_nocheck
|i:msg2 on stderr
|i:exit=44
|s:msg1 on stdout
||example.return2/fun_ia_C
||s:msg1 on stdout
||i:msg2 on stderr
||i:exit=45
|i:exit=45
|s:msg1 on stdout
||example.return2/fun_ia_C_nocheck
|i:msg2 on stderr
|i:exit=46
|s:msg1 on stdout
|example.return2
||example.return2/fun_ia_c
||s:msg1 on stdout
||s:msg2 on stderr
||s:exit=43
||example.return2/fun_ia_c_nocheck
||example.return2/fun_ia_C
||s:msg1 on stdout
||i:msg2 on stderr
||i:exit=45
||example.return2/fun_ia_C_nocheck"

rm -f $ia_logfile