blob: f8207cf04a4840501393b4d1f5615331255b602c (
plain)
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
|
# "Check many leaks" test #1
# Cramming all kinds of weird commands in here.
# As you find leaks, please create separate, small test
# for each leak.
# Narrowing down the leak using this large test may be difficult.
# It is intended to be a blanket "is everything ok?" test
echo "Warm up"
i=1
l=1
t=1
export t
while test $i != 99; do
t=value1_$i; t=value2_$i true; t=value3_$i /bin/true; t=value4_$i exec 1>&1
{ t=value3_$i /bin/true; } </dev/null
if true; t=valueA_$i false >>/dev/null; true; then
: << HERE >/dev/null; true <<HERE
Hello builtin :
HERE
Hello $i true
HERE
elif false; then
true; echo Doesnt run
else
{ true; }; echo Doesnt run too >>/foo/bar
fi
{ : /bin/*; }
unset var
echo >/dev/null ${var#}
echo >/dev/null ${var##}
echo >/dev/null ${var#*}
echo >/dev/null ${var##*}
echo >/dev/null ${var%}
echo >/dev/null ${var%%}
echo >/dev/null ${var%*}
echo >/dev/null ${var%%*}
var=
echo >/dev/null ${var#}
echo >/dev/null ${var##}
echo >/dev/null ${var#*}
echo >/dev/null ${var##*}
echo >/dev/null ${var%}
echo >/dev/null ${var%%}
echo >/dev/null ${var%*}
echo >/dev/null ${var%%*}
var=ababcdcd
echo >/dev/null ${var#ab}
echo >/dev/null ${var##ab}
echo >/dev/null ${var#a*b}
echo >/dev/null ${var##a*b}
echo >/dev/null ${var#?}
echo >/dev/null ${var##?}
echo >/dev/null ${var#*}
echo >/dev/null ${var##*}
echo >/dev/null ${var%cd}
echo >/dev/null ${var%%cd}
echo >/dev/null ${var%c*d}
echo >/dev/null ${var%%c*d}
echo >/dev/null ${var%?}
echo >/dev/null ${var%%?}
echo >/dev/null ${var%*}
echo >/dev/null ${var%%*}
set -- par1_$i par2_$i par3_$i par4_$i
trap "echo trap$i" WINCH
f() { true; true; true; true; true; true; true; true; }
f() { true; true; true; true; true; true; true; true; echo $1; }
i=iii$i t=ttt$i z=zzz$i f >/dev/null
: $((i++))
done
unset i l t
unset -f f
memleak
echo "Measuring memory leak..."
# Please copy the entire block from above verbatim
i=1
l=1
t=1
export t
while test $i != 99; do
t=value1_$i; t=value2_$i true; t=value3_$i /bin/true; t=value4_$i exec 1>&1
{ t=value3_$i /bin/true; } </dev/null
if true; t=valueA_$i false >>/dev/null; true; then
: << HERE >/dev/null; true <<HERE
Hello builtin :
HERE
Hello $i true
HERE
elif false; then
true; echo Doesnt run
else
{ true; }; echo Doesnt run too >>/foo/bar
fi
{ : /bin/*; }
unset var
echo >/dev/null ${var#}
echo >/dev/null ${var##}
echo >/dev/null ${var#*}
echo >/dev/null ${var##*}
echo >/dev/null ${var%}
echo >/dev/null ${var%%}
echo >/dev/null ${var%*}
echo >/dev/null ${var%%*}
var=
echo >/dev/null ${var#}
echo >/dev/null ${var##}
echo >/dev/null ${var#*}
echo >/dev/null ${var##*}
echo >/dev/null ${var%}
echo >/dev/null ${var%%}
echo >/dev/null ${var%*}
echo >/dev/null ${var%%*}
var=ababcdcd
echo >/dev/null ${var#ab}
echo >/dev/null ${var##ab}
echo >/dev/null ${var#a*b}
echo >/dev/null ${var##a*b}
echo >/dev/null ${var#?}
echo >/dev/null ${var##?}
echo >/dev/null ${var#*}
echo >/dev/null ${var##*}
echo >/dev/null ${var%cd}
echo >/dev/null ${var%%cd}
echo >/dev/null ${var%c*d}
echo >/dev/null ${var%%c*d}
echo >/dev/null ${var%?}
echo >/dev/null ${var%%?}
echo >/dev/null ${var%*}
echo >/dev/null ${var%%*}
set -- par1_$i par2_$i par3_$i par4_$i
trap "echo trap$i" WINCH
f() { true; true; true; true; true; true; true; true; }
f() { true; true; true; true; true; true; true; true; echo $1; }
i=iii$i t=ttt$i z=zzz$i f >/dev/null
: $((i++))
done
unset i l t
unset -f f
memleak
kb=$?
if test $kb -le 4; then
echo Ok #$kb
else
echo "Bad: $kb kb leaked"
fi
|