Initial public busybox upstream commit
[busybox4maemo] / shell / hush_test / hush-z_slow / leak_var.tests
1 pid=$$
2
3 # Warm up
4 beg=`ps -o pid,vsz | grep "^ *$pid "`
5 i=1
6 while test $i != X; do
7     unset t
8     t=111111111111111111111111111111111111111111111111111111111111111111111111
9     export t
10     unset t
11     t=111111111111111111111111111111111111111111111111111111111111111111111111
12     export t
13     unset t
14     t=111111111111111111111111111111111111111111111111111111111111111111111111
15     export t
16     unset t
17     t=111111111111111111111111111111111111111111111111111111111111111111111111
18     export t
19     unset t
20     t=111111111111111111111111111111111111111111111111111111111111111111111111
21     export t
22     i=1$i
23     if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi
24     if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi
25     if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi
26     if test $i = 1111111111111111111111111111111111111111111114; then i=5; fi
27     if test $i = 1111111111111111111111111111111111111111111115; then i=6; fi
28     if test $i = 1111111111111111111111111111111111111111111116; then i=7; fi
29     if test $i = 1111111111111111111111111111111111111111111117; then i=8; fi
30     if test $i = 1111111111111111111111111111111111111111111118; then i=9; fi
31     if test $i = 1111111111111111111111111111111111111111111119; then i=a; fi
32     if test $i = 111111111111111111111111111111111111111111111a; then i=b; fi
33     if test $i = 111111111111111111111111111111111111111111111b; then i=c; fi
34     if test $i = 111111111111111111111111111111111111111111111c; then i=d; fi
35     if test $i = 111111111111111111111111111111111111111111111d; then i=e; fi
36     if test $i = 111111111111111111111111111111111111111111111e; then i=f; fi
37     if test $i = 111111111111111111111111111111111111111111111f; then i=g; fi
38     if test $i = 111111111111111111111111111111111111111111111g; then i=h; fi
39     if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi
40     if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
41     if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
42 done
43 end=`ps -o pid,vsz | grep "^ *$pid "`
44
45 echo "Measuring memory leak..."
46 beg=`ps -o pid,vsz | grep "^ *$pid "`
47 i=1
48 while test $i != X; do
49     unset t
50     t=111111111111111111111111111111111111111111111111111111111111111111111111
51     export t
52     unset t
53     t=111111111111111111111111111111111111111111111111111111111111111111111111
54     export t
55     unset t
56     t=111111111111111111111111111111111111111111111111111111111111111111111111
57     export t
58     unset t
59     t=111111111111111111111111111111111111111111111111111111111111111111111111
60     export t
61     unset t
62     t=111111111111111111111111111111111111111111111111111111111111111111111111
63     export t
64     i=1$i
65     if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi
66     if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi
67     if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi
68     if test $i = 1111111111111111111111111111111111111111111114; then i=5; fi
69     if test $i = 1111111111111111111111111111111111111111111115; then i=6; fi
70     if test $i = 1111111111111111111111111111111111111111111116; then i=7; fi
71     if test $i = 1111111111111111111111111111111111111111111117; then i=8; fi
72     if test $i = 1111111111111111111111111111111111111111111118; then i=9; fi
73     if test $i = 1111111111111111111111111111111111111111111119; then i=a; fi
74     if test $i = 111111111111111111111111111111111111111111111a; then i=b; fi
75     if test $i = 111111111111111111111111111111111111111111111b; then i=c; fi
76     if test $i = 111111111111111111111111111111111111111111111c; then i=d; fi
77     if test $i = 111111111111111111111111111111111111111111111d; then i=e; fi
78     if test $i = 111111111111111111111111111111111111111111111e; then i=f; fi
79     if test $i = 111111111111111111111111111111111111111111111f; then i=g; fi
80     if test $i = 111111111111111111111111111111111111111111111g; then i=h; fi
81     if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi
82     if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
83     if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
84 done
85 end=`ps -o pid,vsz | grep "^ *$pid "`
86
87 if test "$beg" != "$end"; then
88     echo "vsz grows: $beg -> $end"
89 else
90     echo "vsz does not grow"
91 fi