diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-12 14:21:30 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-12 14:21:30 +0200 |
commit | 09516066d4fb12d1be1c895c072bf481da97520a (patch) | |
tree | 52add03e5f16cc7a6b4f0d5d4ce4bb2e0ae97ecb | |
parent | 79b021d738186ad0c581714626c7d2eea1bb6445 (diff) | |
download | busybox-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.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-leak/leak_argv1.tests | 59 | ||||
-rw-r--r-- | shell/hush_test/hush-parsing/negate.right | 1 | ||||
-rwxr-xr-x | shell/hush_test/hush-parsing/negate.tests | 5 |
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 @@ | |||
1 | Measuring memory leak... | 1 | Measuring memory leak... |
2 | vsz does not grow | 2 | Ok |
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 @@ | |||
1 | pid=$$ | ||
2 | |||
3 | # Warm up | 1 | # Warm up |
4 | beg=`ps -o pid,vsz | grep "^ *$pid "` | ||
5 | i=1 | 2 | i=1 |
6 | while test $i != X; do | 3 | while 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 |
35 | done | 32 | done |
36 | end=`ps -o pid,vsz | grep "^ *$pid "` | ||
37 | 33 | ||
38 | # Warm up again (I do need it on my machine) | 34 | unset i |
39 | beg=`ps -o pid,vsz | grep "^ *$pid "` | 35 | set -- |
40 | i=1 | 36 | memleak |
41 | while 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 | ||
70 | done | ||
71 | end=`ps -o pid,vsz | grep "^ *$pid "` | ||
72 | if test "$beg" != "$end"; then | ||
73 | true echo "vsz grows: $beg -> $end" | ||
74 | else | ||
75 | true echo "vsz does not grow" | ||
76 | fi | ||
77 | 37 | ||
78 | echo "Measuring memory leak..." | 38 | echo "Measuring memory leak..." |
79 | beg=`ps -o pid,vsz | grep "^ *$pid "` | ||
80 | i=1 | 39 | i=1 |
81 | while test $i != X; do | 40 | while 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 |
110 | done | 69 | done |
111 | end=`ps -o pid,vsz | grep "^ *$pid "` | ||
112 | 70 | ||
113 | if test "$beg" != "$end"; then | 71 | unset i |
114 | echo "vsz grows: $beg -> $end" | 72 | set -- |
73 | memleak | ||
74 | |||
75 | kb=$? | ||
76 | if test $kb -le 4; then | ||
77 | echo Ok #$kb | ||
115 | else | 78 | else |
116 | echo "vsz does not grow" | 79 | echo "Bad: $kb kb leaked" |
117 | fi | 80 | fi |
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 | |||
33 | 1 | 33 | 1 |
34 | 1 | 34 | 1 |
35 | 1 | 35 | 1 |
36 | Done | ||
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 | |||
7 | echo $? | 7 | echo $? |
8 | if ! false; then ! false; echo $?; fi | 8 | if ! false; then ! false; echo $?; fi |
9 | echo $? | 9 | echo $? |
10 | PRINTF=`which printf` | ||
10 | for a in ! a b c; do echo $a; done | 11 | for a in ! a b c; do echo $a; done |
11 | for a in ! a b c; do ! printf "$a "; echo $?; done | 12 | for a in ! a b c; do ! printf "$a "; echo $?; done |
12 | for a in ! a b c; do ! /usr/bin/printf "$a "; echo $?; done | 13 | test x"$PRINTF" = x"" && exit 1 |
14 | for a in ! a b c; do ! "$PRINTF" "$a "; echo $?; done | ||
13 | for a in ! a b c; do ! printf "$a " | false; echo $?; done | 15 | for a in ! a b c; do ! printf "$a " | false; echo $?; done |
14 | for a in ! a b c; do ! printf "$a " | true; echo $?; done | 16 | for a in ! a b c; do ! printf "$a " | true; echo $?; done |
15 | for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done | 17 | for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done |
16 | for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done | 18 | for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done |
19 | echo Done | ||