hush: add function tests
[oweals/busybox.git] / shell / hush_test / hush-z_slow / leak_var.tests
index d3ca259088a83d62516c289fbe3c0f2c2d32a827..41c09e478c60484ec1da3e336b9fba643c2255d7 100755 (executable)
@@ -1,27 +1,4 @@
-pid=$$
-
-# Warm up
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-i=1
-if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi
-beg=`ps -o pid,vsz | grep "^ *$pid "`
-
 echo "Measuring memory leak..."
-beg=`ps -o pid,vsz | grep "^ *$pid "`
 i=1
 while test $i != X; do
     unset t
@@ -59,11 +36,12 @@ while test $i != X; do
     if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi
     if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
     if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
+    memleak
 done
-end=`ps -o pid,vsz | grep "^ *$pid "`
-
-if test "$beg" != "$end"; then
-    echo "vsz grows: $beg -> $end"
+memleak
+kb=$?
+if test $kb -le 4; then
+    echo Ok
 else
-    echo "vsz does not grow"
+    echo "Bad: $kb kb (or more) leaked"
 fi