aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-12 14:21:30 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-12 14:21:30 +0200
commit09516066d4fb12d1be1c895c072bf481da97520a (patch)
tree52add03e5f16cc7a6b4f0d5d4ce4bb2e0ae97ecb
parent79b021d738186ad0c581714626c7d2eea1bb6445 (diff)
downloadbusybox-w32-09516066d4fb12d1be1c895c072bf481da97520a.tar.gz
busybox-w32-09516066d4fb12d1be1c895c072bf481da97520a.tar.bz2
busybox-w32-09516066d4fb12d1be1c895c072bf481da97520a.zip
hush: do not use ps -o in leak_argv1; do not hardcode path in negate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush_test/hush-leak/leak_argv1.right2
-rwxr-xr-xshell/hush_test/hush-leak/leak_argv1.tests59
-rw-r--r--shell/hush_test/hush-parsing/negate.right1
-rwxr-xr-xshell/hush_test/hush-parsing/negate.tests5
4 files changed, 17 insertions, 50 deletions
diff --git a/shell/hush_test/hush-leak/leak_argv1.right b/shell/hush_test/hush-leak/leak_argv1.right
index 7bccc1eef..1d4d6ff57 100644
--- a/shell/hush_test/hush-leak/leak_argv1.right
+++ b/shell/hush_test/hush-leak/leak_argv1.right
@@ -1,2 +1,2 @@
1Measuring memory leak... 1Measuring memory leak...
2vsz does not grow 2Ok
diff --git a/shell/hush_test/hush-leak/leak_argv1.tests b/shell/hush_test/hush-leak/leak_argv1.tests
index 34991ce28..bb371bcb2 100755
--- a/shell/hush_test/hush-leak/leak_argv1.tests
+++ b/shell/hush_test/hush-leak/leak_argv1.tests
@@ -1,7 +1,4 @@
1pid=$$
2
3# Warm up 1# Warm up
4beg=`ps -o pid,vsz | grep "^ *$pid "`
5i=1 2i=1
6while test $i != X; do 3while test $i != X; do
7 set -- a b c d e f g h i j k l m n o p q r s t u v w x y z 4 set -- a b c d e f g h i j k l m n o p q r s t u v w x y z
@@ -33,50 +30,12 @@ while test $i != X; do
33 if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi 30 if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
34 if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi 31 if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
35done 32done
36end=`ps -o pid,vsz | grep "^ *$pid "`
37 33
38# Warm up again (I do need it on my machine) 34unset i
39beg=`ps -o pid,vsz | grep "^ *$pid "` 35set --
40i=1 36memleak
41while test $i != X; do
42 set -- a b c d e f g h i j k l m n o p q r s t u v w x y z
43 shift
44 shift 2
45 shift 5
46 shift 11
47 set -- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
48 shift 3
49 shift 7
50 i=1$i
51 if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi
52 if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi
53 if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi
54 if test $i = 1111111111111111111111111111111111111111111114; then i=5; fi
55 if test $i = 1111111111111111111111111111111111111111111115; then i=6; fi
56 if test $i = 1111111111111111111111111111111111111111111116; then i=7; fi
57 if test $i = 1111111111111111111111111111111111111111111117; then i=8; fi
58 if test $i = 1111111111111111111111111111111111111111111118; then i=9; fi
59 if test $i = 1111111111111111111111111111111111111111111119; then i=a; fi
60 if test $i = 111111111111111111111111111111111111111111111a; then i=b; fi
61 if test $i = 111111111111111111111111111111111111111111111b; then i=c; fi
62 if test $i = 111111111111111111111111111111111111111111111c; then i=d; fi
63 if test $i = 111111111111111111111111111111111111111111111d; then i=e; fi
64 if test $i = 111111111111111111111111111111111111111111111e; then i=f; fi
65 if test $i = 111111111111111111111111111111111111111111111f; then i=g; fi
66 if test $i = 111111111111111111111111111111111111111111111g; then i=h; fi
67 if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi
68 if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
69 if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
70done
71end=`ps -o pid,vsz | grep "^ *$pid "`
72if test "$beg" != "$end"; then
73 true echo "vsz grows: $beg -> $end"
74else
75 true echo "vsz does not grow"
76fi
77 37
78echo "Measuring memory leak..." 38echo "Measuring memory leak..."
79beg=`ps -o pid,vsz | grep "^ *$pid "`
80i=1 39i=1
81while test $i != X; do 40while test $i != X; do
82 set -- a b c d e f g h i j k l m n o p q r s t u v w x y z 41 set -- a b c d e f g h i j k l m n o p q r s t u v w x y z
@@ -108,10 +67,14 @@ while test $i != X; do
108 if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi 67 if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
109 if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi 68 if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
110done 69done
111end=`ps -o pid,vsz | grep "^ *$pid "`
112 70
113if test "$beg" != "$end"; then 71unset i
114 echo "vsz grows: $beg -> $end" 72set --
73memleak
74
75kb=$?
76if test $kb -le 4; then
77 echo Ok #$kb
115else 78else
116 echo "vsz does not grow" 79 echo "Bad: $kb kb leaked"
117fi 80fi
diff --git a/shell/hush_test/hush-parsing/negate.right b/shell/hush_test/hush-parsing/negate.right
index 01166012e..61d2ecd3a 100644
--- a/shell/hush_test/hush-parsing/negate.right
+++ b/shell/hush_test/hush-parsing/negate.right
@@ -33,3 +33,4 @@ c 1
331 331
341 341
351 351
36Done
diff --git a/shell/hush_test/hush-parsing/negate.tests b/shell/hush_test/hush-parsing/negate.tests
index c25127d7f..51151cbd4 100755
--- a/shell/hush_test/hush-parsing/negate.tests
+++ b/shell/hush_test/hush-parsing/negate.tests
@@ -7,10 +7,13 @@ if ! false; then false; echo $?; fi
7echo $? 7echo $?
8if ! false; then ! false; echo $?; fi 8if ! false; then ! false; echo $?; fi
9echo $? 9echo $?
10PRINTF=`which printf`
10for a in ! a b c; do echo $a; done 11for a in ! a b c; do echo $a; done
11for a in ! a b c; do ! printf "$a "; echo $?; done 12for a in ! a b c; do ! printf "$a "; echo $?; done
12for a in ! a b c; do ! /usr/bin/printf "$a "; echo $?; done 13test x"$PRINTF" = x"" && exit 1
14for a in ! a b c; do ! "$PRINTF" "$a "; echo $?; done
13for a in ! a b c; do ! printf "$a " | false; echo $?; done 15for a in ! a b c; do ! printf "$a " | false; echo $?; done
14for a in ! a b c; do ! printf "$a " | true; echo $?; done 16for a in ! a b c; do ! printf "$a " | true; echo $?; done
15for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done 17for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done
16for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done 18for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done
19echo Done