aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-09 14:15:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-09 14:15:57 +0000
commit1943aec2ec390d9fda159aa0412362780ec83f09 (patch)
treeec9ddd365d2232d9fb621b79000cbf20f1410cda /shell/hush_test
parentefea9d2819165b414b81a47c8227ae007bd5382a (diff)
downloadbusybox-1943aec2ec390d9fda159aa0412362780ec83f09.tar.gz
hush: plug the leak of expanded heredoc
Diffstat (limited to 'shell/hush_test')
-rw-r--r--shell/hush_test/hush-z_slow/leak_heredoc1.right3
-rwxr-xr-xshell/hush_test/hush-z_slow/leak_heredoc1.tests34
2 files changed, 37 insertions, 0 deletions
diff --git a/shell/hush_test/hush-z_slow/leak_heredoc1.right b/shell/hush_test/hush-z_slow/leak_heredoc1.right
new file mode 100644
index 000000000..c6f0334f3
--- /dev/null
+++ b/shell/hush_test/hush-z_slow/leak_heredoc1.right
@@ -0,0 +1,3 @@
+Warm up
+Measuring memory leak...
+Ok
diff --git a/shell/hush_test/hush-z_slow/leak_heredoc1.tests b/shell/hush_test/hush-z_slow/leak_heredoc1.tests
new file mode 100755
index 000000000..26cbb28a4
--- /dev/null
+++ b/shell/hush_test/hush-z_slow/leak_heredoc1.tests
@@ -0,0 +1,34 @@
+echo "Warm up"
+i=1
+while test $i != 99; do
+ : <<HERE
+Hello $i `echo builtin_$i`
+HERE
+ : $((i++))
+done
+
+memleak
+
+echo "Measuring memory leak..."
+i=1
+while test $i != 99; do
+ : <<HERE
+Hello $i `echo builtin_$i`
+HERE
+ : $((i++))
+done
+i=1
+while test $i != 99; do
+ : <<HERE
+Hello $i `echo builtin_$i`
+HERE
+ : $((i++))
+done
+
+memleak
+kb=$?
+if test $kb -le 4; then
+ echo Ok #$kb
+else
+ echo "Bad: $kb kb (or more) leaked"
+fi