aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-10-03 00:06:55 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-10-03 00:06:55 +0200
commita62bc80571eae6d286aed9a92d47dc42318a8146 (patch)
tree45ce124c7a8426ebf95c07a34c3c521595e400de
parentce332a23a3ff45a5aeb3e737da15b469badd5d12 (diff)
downloadbusybox-w32-a62bc80571eae6d286aed9a92d47dc42318a8146.tar.gz
busybox-w32-a62bc80571eae6d286aed9a92d47dc42318a8146.tar.bz2
busybox-w32-a62bc80571eae6d286aed9a92d47dc42318a8146.zip
ash testsuite: add most of hust tests which pass for ash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash_test/ash-heredoc/heredoc_huge.right3
-rwxr-xr-xshell/ash_test/ash-heredoc/heredoc_huge.tests9
-rw-r--r--shell/ash_test/ash-misc/and-or.right18
-rwxr-xr-xshell/ash_test/ash-misc/and-or.tests34
-rw-r--r--shell/ash_test/ash-misc/assignment1.right9
-rwxr-xr-xshell/ash_test/ash-misc/assignment1.tests42
-rw-r--r--shell/ash_test/ash-misc/assignment3.right2
-rwxr-xr-xshell/ash_test/ash-misc/assignment3.tests5
-rw-r--r--shell/ash_test/ash-misc/assignment4.right1
-rwxr-xr-xshell/ash_test/ash-misc/assignment4.tests3
-rw-r--r--shell/ash_test/ash-misc/break1.right2
-rwxr-xr-xshell/ash_test/ash-misc/break1.tests2
-rw-r--r--shell/ash_test/ash-misc/break2.right3
-rwxr-xr-xshell/ash_test/ash-misc/break2.tests6
-rw-r--r--shell/ash_test/ash-misc/break3.right2
-rwxr-xr-xshell/ash_test/ash-misc/break3.tests2
-rw-r--r--shell/ash_test/ash-misc/break4.right6
-rwxr-xr-xshell/ash_test/ash-misc/break4.tests12
-rw-r--r--shell/ash_test/ash-misc/break5.right13
-rwxr-xr-xshell/ash_test/ash-misc/break5.tests4
-rw-r--r--shell/ash_test/ash-misc/builtin1.right2
-rwxr-xr-xshell/ash_test/ash-misc/builtin1.tests6
-rw-r--r--shell/ash_test/ash-misc/case1.right22
-rwxr-xr-xshell/ash_test/ash-misc/case1.tests40
-rw-r--r--shell/ash_test/ash-misc/colon.right2
-rwxr-xr-xshell/ash_test/ash-misc/colon.tests5
-rw-r--r--shell/ash_test/ash-misc/compound.right14
-rwxr-xr-xshell/ash_test/ash-misc/compound.tests21
-rw-r--r--shell/ash_test/ash-misc/continue1.right8
-rwxr-xr-xshell/ash_test/ash-misc/continue1.tests4
-rw-r--r--shell/ash_test/ash-misc/continue2.right1
-rwxr-xr-xshell/ash_test/ash-misc/continue2.tests3
-rw-r--r--shell/ash_test/ash-misc/continue3.right2
-rwxr-xr-xshell/ash_test/ash-misc/continue3.tests3
-rw-r--r--shell/ash_test/ash-misc/empty_for.right1
-rwxr-xr-xshell/ash_test/ash-misc/empty_for.tests3
-rw-r--r--shell/ash_test/ash-misc/empty_for2.right4
-rwxr-xr-xshell/ash_test/ash-misc/empty_for2.tests6
-rw-r--r--shell/ash_test/ash-misc/exit1.right1
-rwxr-xr-xshell/ash_test/ash-misc/exit1.tests4
-rw-r--r--shell/ash_test/ash-misc/for_with_bslashes.right8
-rwxr-xr-xshell/ash_test/ash-misc/for_with_bslashes.tests10
-rw-r--r--shell/ash_test/ash-misc/for_with_keywords.right4
-rwxr-xr-xshell/ash_test/ash-misc/for_with_keywords.tests2
-rw-r--r--shell/ash_test/ash-misc/if_false_exitcode.right1
-rwxr-xr-xshell/ash_test/ash-misc/if_false_exitcode.tests2
-rw-r--r--shell/ash_test/ash-misc/nommu1.right7
-rwxr-xr-xshell/ash_test/ash-misc/nommu1.tests12
-rw-r--r--shell/ash_test/ash-misc/nommu2.right5
-rwxr-xr-xshell/ash_test/ash-misc/nommu2.tests5
-rw-r--r--shell/ash_test/ash-misc/nommu3.right2
-rwxr-xr-xshell/ash_test/ash-misc/nommu3.tests15
-rw-r--r--shell/ash_test/ash-misc/opts1.right2
-rwxr-xr-xshell/ash_test/ash-misc/opts1.tests5
-rw-r--r--shell/ash_test/ash-misc/pid.right1
-rwxr-xr-xshell/ash_test/ash-misc/pid.tests1
-rw-r--r--shell/ash_test/ash-misc/pipefail.right40
-rwxr-xr-xshell/ash_test/ash-misc/pipefail.tests45
-rw-r--r--shell/ash_test/ash-misc/read.right4
-rwxr-xr-xshell/ash_test/ash-misc/read.tests4
-rw-r--r--shell/ash_test/ash-misc/return1.right1
-rwxr-xr-xshell/ash_test/ash-misc/return1.tests4
-rw-r--r--shell/ash_test/ash-misc/shift.right6
-rwxr-xr-xshell/ash_test/ash-misc/shift.tests14
-rw-r--r--shell/ash_test/ash-misc/sigint1.right1
-rwxr-xr-xshell/ash_test/ash-misc/sigint1.tests41
-rw-r--r--shell/ash_test/ash-misc/unicode1.right3
-rwxr-xr-xshell/ash_test/ash-misc/unicode1.tests13
-rw-r--r--shell/ash_test/ash-misc/until1.right3
-rwxr-xr-xshell/ash_test/ash-misc/until1.tests11
-rw-r--r--shell/ash_test/ash-misc/while1.right1
-rwxr-xr-xshell/ash_test/ash-misc/while1.tests2
-rw-r--r--shell/ash_test/ash-misc/while2.right2
-rwxr-xr-xshell/ash_test/ash-misc/while2.tests2
-rw-r--r--shell/ash_test/ash-misc/while4.right1
-rwxr-xr-xshell/ash_test/ash-misc/while4.tests6
-rw-r--r--shell/ash_test/ash-misc/while_in_subshell.right1
-rwxr-xr-xshell/ash_test/ash-misc/while_in_subshell.tests2
-rw-r--r--shell/ash_test/ash-signals/save-ret.right2
-rwxr-xr-xshell/ash_test/ash-signals/save-ret.tests4
-rw-r--r--shell/ash_test/ash-vars/empty.right3
-rwxr-xr-xshell/ash_test/ash-vars/empty.tests5
-rw-r--r--shell/ash_test/ash-vars/glob_and_vars.right1
-rwxr-xr-xshell/ash_test/ash-vars/glob_and_vars.tests2
-rw-r--r--shell/ash_test/ash-vars/param_expand_len.right9
-rwxr-xr-xshell/ash_test/ash-vars/param_expand_len.tests17
-rw-r--r--shell/ash_test/ash-vars/param_glob.right4
-rwxr-xr-xshell/ash_test/ash-vars/param_glob.tests9
-rw-r--r--shell/ash_test/ash-vars/param_subshell.right7
-rwxr-xr-xshell/ash_test/ash-vars/param_subshell.tests15
-rw-r--r--shell/ash_test/ash-vars/star.right6
-rwxr-xr-xshell/ash_test/ash-vars/star.tests8
-rw-r--r--shell/ash_test/ash-vars/var_expand_in_assign.right5
-rwxr-xr-xshell/ash_test/ash-vars/var_expand_in_assign.tests15
-rw-r--r--shell/ash_test/ash-vars/var_expand_in_redir.right3
-rwxr-xr-xshell/ash_test/ash-vars/var_expand_in_redir.tests13
-rw-r--r--shell/ash_test/ash-vars/var_expand_on_ifs.right9
-rwxr-xr-xshell/ash_test/ash-vars/var_expand_on_ifs.tests11
-rw-r--r--shell/ash_test/ash-vars/var_in_pipes.right6
-rwxr-xr-xshell/ash_test/ash-vars/var_in_pipes.tests7
-rw-r--r--shell/ash_test/ash-vars/var_leaks.right1
-rwxr-xr-xshell/ash_test/ash-vars/var_leaks.tests14
-rw-r--r--shell/hush_test/hush-misc/assignment2.right (renamed from shell/hush_test/hush-misc/assignment2.rigth)0
103 files changed, 795 insertions, 0 deletions
diff --git a/shell/ash_test/ash-heredoc/heredoc_huge.right b/shell/ash_test/ash-heredoc/heredoc_huge.right
new file mode 100644
index 000000000..11740f674
--- /dev/null
+++ b/shell/ash_test/ash-heredoc/heredoc_huge.right
@@ -0,0 +1,3 @@
1546ed3f5c81c780d3ab86ada14824237 -
2546ed3f5c81c780d3ab86ada14824237 -
3End
diff --git a/shell/ash_test/ash-heredoc/heredoc_huge.tests b/shell/ash_test/ash-heredoc/heredoc_huge.tests
new file mode 100755
index 000000000..c2ec2817b
--- /dev/null
+++ b/shell/ash_test/ash-heredoc/heredoc_huge.tests
@@ -0,0 +1,9 @@
1# This creates 120k heredoc
2echo 'cat <<HERE | md5sum' >"$0.tmp"
3yes "123456789 123456789 123456789 123456789" | head -3000 >>"$0.tmp"
4echo 'HERE' >>"$0.tmp"
5
6yes "123456789 123456789 123456789 123456789" | head -3000 | md5sum
7. "$0.tmp"
8rm "$0.tmp"
9echo End
diff --git a/shell/ash_test/ash-misc/and-or.right b/shell/ash_test/ash-misc/and-or.right
new file mode 100644
index 000000000..f9fa5fbf8
--- /dev/null
+++ b/shell/ash_test/ash-misc/and-or.right
@@ -0,0 +1,18 @@
1a1
2a4
3b1
4b3
5b4
6b6
7c4
8c5
9c7
10c8
11ff1
12ff3
13ft2
14ft3
15tf2
16tf3
17tt2
18tt4
diff --git a/shell/ash_test/ash-misc/and-or.tests b/shell/ash_test/ash-misc/and-or.tests
new file mode 100755
index 000000000..485458abe
--- /dev/null
+++ b/shell/ash_test/ash-misc/and-or.tests
@@ -0,0 +1,34 @@
1false || echo a1
2false && echo a2
3true || echo a3
4true && echo a4
5
6false || echo b1 || echo b2
7false || echo b3 && echo b4
8false && echo b5 || echo b6
9false && echo b7 && echo b8
10
11true || echo c1 || echo c2
12true || echo c3 && echo c4
13true && echo c5 || echo c6
14true && echo c7 && echo c8
15
16false || false || echo ff1
17false || false && echo ff2
18false && false || echo ff3
19false && false && echo ff4
20
21false || true || echo ft1
22false || true && echo ft2
23false && true || echo ft3
24false && true && echo ft4
25
26true || false || echo tf1
27true || false && echo tf2
28true && false || echo tf3
29true && false && echo tf4
30
31true || true || echo tt1
32true || true && echo tt2
33true && true || echo tt3
34true && true && echo tt4
diff --git a/shell/ash_test/ash-misc/assignment1.right b/shell/ash_test/ash-misc/assignment1.right
new file mode 100644
index 000000000..d0a13d3d8
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment1.right
@@ -0,0 +1,9 @@
1if1:0
2while1:0
3until1:0
4if2:0
5while2:0
6until2:0
7if3:0
8while3:0
9until3:0
diff --git a/shell/ash_test/ash-misc/assignment1.tests b/shell/ash_test/ash-misc/assignment1.tests
new file mode 100755
index 000000000..033b35250
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment1.tests
@@ -0,0 +1,42 @@
1# Assignments after some keywords should still work
2
3if a=1 true; then a=1 true; elif a=1 true; then a=1 true; else a=1 true; fi
4echo if1:$?
5while a=1 true; do a=1 true; break; done
6echo while1:$?
7until a=1 false; do a=1 true; break; done
8echo until1:$?
9
10if a=1 true
11 then a=1 true
12 elif a=1 true
13 then a=1 true
14 else a=1 true
15 fi
16echo if2:$?
17while a=1 true
18 do a=1 true
19 break
20 done
21echo while2:$?
22until a=1 false
23 do a=1 true
24 break
25 done
26echo until2:$?
27
28if
29 a=1 true; then
30 a=1 true; elif
31 a=1 true; then
32 a=1 true; else
33 a=1 true; fi
34echo if3:$?
35while
36 a=1 true; do
37 a=1 true; break; done
38echo while3:$?
39until
40 a=1 false; do
41 a=1 true; break; done
42echo until3:$?
diff --git a/shell/ash_test/ash-misc/assignment3.right b/shell/ash_test/ash-misc/assignment3.right
new file mode 100644
index 000000000..0f02d7cbc
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment3.right
@@ -0,0 +1,2 @@
1Done:0
2abc=123
diff --git a/shell/ash_test/ash-misc/assignment3.tests b/shell/ash_test/ash-misc/assignment3.tests
new file mode 100755
index 000000000..790129be1
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment3.tests
@@ -0,0 +1,5 @@
1# This must be interpreted as assignments
2a=1 b\
3=2 c=3
4echo Done:$?
5echo abc=$a$b$c
diff --git a/shell/ash_test/ash-misc/assignment4.right b/shell/ash_test/ash-misc/assignment4.right
new file mode 100644
index 000000000..31c896f62
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment4.right
@@ -0,0 +1 @@
Done:0
diff --git a/shell/ash_test/ash-misc/assignment4.tests b/shell/ash_test/ash-misc/assignment4.tests
new file mode 100755
index 000000000..6f46d0a33
--- /dev/null
+++ b/shell/ash_test/ash-misc/assignment4.tests
@@ -0,0 +1,3 @@
1# There was a bug where we misinterpreted assignments after 'do':
2for i in 1; do eval b=; done
3echo Done:$?
diff --git a/shell/ash_test/ash-misc/break1.right b/shell/ash_test/ash-misc/break1.right
new file mode 100644
index 000000000..04a4b1757
--- /dev/null
+++ b/shell/ash_test/ash-misc/break1.right
@@ -0,0 +1,2 @@
1A
2OK:0
diff --git a/shell/ash_test/ash-misc/break1.tests b/shell/ash_test/ash-misc/break1.tests
new file mode 100755
index 000000000..3a6b060d9
--- /dev/null
+++ b/shell/ash_test/ash-misc/break1.tests
@@ -0,0 +1,2 @@
1while true; do echo A; break; echo B; done
2echo OK:$?
diff --git a/shell/ash_test/ash-misc/break2.right b/shell/ash_test/ash-misc/break2.right
new file mode 100644
index 000000000..8a15cb95f
--- /dev/null
+++ b/shell/ash_test/ash-misc/break2.right
@@ -0,0 +1,3 @@
1A
2AA
3OK:0
diff --git a/shell/ash_test/ash-misc/break2.tests b/shell/ash_test/ash-misc/break2.tests
new file mode 100755
index 000000000..7da9faf34
--- /dev/null
+++ b/shell/ash_test/ash-misc/break2.tests
@@ -0,0 +1,6 @@
1while true; do
2 echo A
3 while true; do echo AA; break 2; echo BB; done
4 echo B
5done
6echo OK:$?
diff --git a/shell/ash_test/ash-misc/break3.right b/shell/ash_test/ash-misc/break3.right
new file mode 100644
index 000000000..04a4b1757
--- /dev/null
+++ b/shell/ash_test/ash-misc/break3.right
@@ -0,0 +1,2 @@
1A
2OK:0
diff --git a/shell/ash_test/ash-misc/break3.tests b/shell/ash_test/ash-misc/break3.tests
new file mode 100755
index 000000000..d138dcac5
--- /dev/null
+++ b/shell/ash_test/ash-misc/break3.tests
@@ -0,0 +1,2 @@
1v=break; while true; do echo A; $v; echo B; break; echo C; done
2echo OK:$?
diff --git a/shell/ash_test/ash-misc/break4.right b/shell/ash_test/ash-misc/break4.right
new file mode 100644
index 000000000..6f41c141d
--- /dev/null
+++ b/shell/ash_test/ash-misc/break4.right
@@ -0,0 +1,6 @@
1A
2AA
3TRUE
4A
5AA
6OK:0
diff --git a/shell/ash_test/ash-misc/break4.tests b/shell/ash_test/ash-misc/break4.tests
new file mode 100755
index 000000000..67da2889c
--- /dev/null
+++ b/shell/ash_test/ash-misc/break4.tests
@@ -0,0 +1,12 @@
1cond=true
2while $cond; do
3 echo A
4 if test "$cond" = true; then
5 cond='echo TRUE'
6 else
7 cond=false
8 fi
9 while true; do echo AA; continue 2; echo BB; done
10 echo B
11done
12echo OK:$?
diff --git a/shell/ash_test/ash-misc/break5.right b/shell/ash_test/ash-misc/break5.right
new file mode 100644
index 000000000..0b9df2a4f
--- /dev/null
+++ b/shell/ash_test/ash-misc/break5.right
@@ -0,0 +1,13 @@
1A
2B
30
4A:a
5B
6D
7A:b
8B
9D
10A:c
11B
12D
130
diff --git a/shell/ash_test/ash-misc/break5.tests b/shell/ash_test/ash-misc/break5.tests
new file mode 100755
index 000000000..273e040ec
--- /dev/null
+++ b/shell/ash_test/ash-misc/break5.tests
@@ -0,0 +1,4 @@
1while true; do echo A; { echo B; break; echo C; }; echo D; done
2echo $?
3for v in a b c; do echo A:$v; (echo B; break; echo C); echo D; done
4echo $?
diff --git a/shell/ash_test/ash-misc/builtin1.right b/shell/ash_test/ash-misc/builtin1.right
new file mode 100644
index 000000000..2e55ecb09
--- /dev/null
+++ b/shell/ash_test/ash-misc/builtin1.right
@@ -0,0 +1,2 @@
1VARIABLE=export
2OK:0
diff --git a/shell/ash_test/ash-misc/builtin1.tests b/shell/ash_test/ash-misc/builtin1.tests
new file mode 100755
index 000000000..1a2941faa
--- /dev/null
+++ b/shell/ash_test/ash-misc/builtin1.tests
@@ -0,0 +1,6 @@
1# builtins, unlike keywords like "while", can be constructed
2# with substitutions
3VARIABLE=export
4$VARIABLE VARIABLE
5env | grep ^VARIABLE
6echo OK:$?
diff --git a/shell/ash_test/ash-misc/case1.right b/shell/ash_test/ash-misc/case1.right
new file mode 100644
index 000000000..4afb2f51c
--- /dev/null
+++ b/shell/ash_test/ash-misc/case1.right
@@ -0,0 +1,22 @@
1OK_1
2OK_1
3OK_21
4OK_22
5OK_23
6OK_31
7OK_32
8OK_41
9OK_42
10OK_43
11OK_44
12OK_51
13OK_52
14OK_53
15OK_sub1
16OK_sub2
17OK_sub3
18OK_sub4
19OK_sub5
20OK_sub6
21OK_esac1
22Done
diff --git a/shell/ash_test/ash-misc/case1.tests b/shell/ash_test/ash-misc/case1.tests
new file mode 100755
index 000000000..d72b57f53
--- /dev/null
+++ b/shell/ash_test/ash-misc/case1.tests
@@ -0,0 +1,40 @@
1case w in a) echo SKIP;; w) echo OK_1;; w) echo WRONG;; esac
2
3case w in
4 a) echo SKIP;;
5 w)echo OK_1 ;;
6 w)
7 echo WRONG
8 ;;
9esac
10
11t=w
12case $t in a) echo SKIP;; w) echo OK_21;; w) echo WRONG;; esac;
13case "$t" in a) echo SKIP;; w) echo OK_22;; w) echo WRONG;; esac;
14case w in a) echo SKIP;; $t) echo OK_23;; "$t") echo WRONG;; esac;
15
16case '' in a) echo SKIP;; w) echo WRONG;; *) echo OK_31;; esac;
17case '' in a) echo SKIP;; '') echo OK_32;; *) echo WRONG;; esac;
18
19case `echo w` in a) echo SKIP;; w) echo OK_41;; w) echo WRONG;; esac;
20case "`echo w`" in a) echo SKIP;; w) echo OK_42;; w) echo WRONG;; esac;
21case `echo w w` in a) echo SKIP;; w) echo WRONG;; 'w w') echo OK_43;; esac;
22case `echo w w` in a) echo SKIP;; w) echo WRONG;; w*) echo OK_44;; esac;
23
24case w in `echo w`) echo OK_51;; `echo WRONG >&2`w) echo WRONG;; esac;
25case w in `echo OK_52 >&2`) echo SKIP;; `echo`w) echo OK_53;; esac;
26
27# parsing cases in subshells can easily get messy
28 case m in m) echo OK_sub1;; esac
29 case m in (m) echo OK_sub2;; esac
30(case m in m) echo OK_sub3;; esac)
31(case m in (m) echo OK_sub4;; esac)
32(
33 case m in m) echo OK_sub5;; esac
34)
35(
36 case m in (m) echo OK_sub6;; esac
37)
38(case esac in "esac") echo OK_esac1;; esac)
39
40echo Done
diff --git a/shell/ash_test/ash-misc/colon.right b/shell/ash_test/ash-misc/colon.right
new file mode 100644
index 000000000..2a87d0293
--- /dev/null
+++ b/shell/ash_test/ash-misc/colon.right
@@ -0,0 +1,2 @@
10
2OK: 0
diff --git a/shell/ash_test/ash-misc/colon.tests b/shell/ash_test/ash-misc/colon.tests
new file mode 100755
index 000000000..cb8ab5306
--- /dev/null
+++ b/shell/ash_test/ash-misc/colon.tests
@@ -0,0 +1,5 @@
1false
2:
3echo $?
4(while :; do exit; done)
5echo OK: $?
diff --git a/shell/ash_test/ash-misc/compound.right b/shell/ash_test/ash-misc/compound.right
new file mode 100644
index 000000000..757d42fe4
--- /dev/null
+++ b/shell/ash_test/ash-misc/compound.right
@@ -0,0 +1,14 @@
1new group
20
31
42
53
64
75
86
9new group
10new group
110
121
132
143
diff --git a/shell/ash_test/ash-misc/compound.tests b/shell/ash_test/ash-misc/compound.tests
new file mode 100755
index 000000000..a5e85c3d5
--- /dev/null
+++ b/shell/ash_test/ash-misc/compound.tests
@@ -0,0 +1,21 @@
1echo new group
2echo 0; { :; }
3echo 1; { : ;}
4echo 2; ({ :; })
5echo 3; ({ : ;})
6echo 4; ( : )
7echo 5; ( :; )
8echo 6; ( : ;)
9# not sure if POSIX requires these, but bash accepts them ...
10#echo 7; {( : )}
11#echo 8; {( :; )}
12#echo 9; {( : ;)}
13
14echo new group
15#echo 0; {(:);}
16
17echo new group
18echo 0; (:)
19echo 1; (:;)
20echo 2; (:);
21echo 3; (:;);
diff --git a/shell/ash_test/ash-misc/continue1.right b/shell/ash_test/ash-misc/continue1.right
new file mode 100644
index 000000000..c4a5565bc
--- /dev/null
+++ b/shell/ash_test/ash-misc/continue1.right
@@ -0,0 +1,8 @@
1A:a
2A:b
3A:c
4OK1
5A:a
6A:b
7A:c
8OK2
diff --git a/shell/ash_test/ash-misc/continue1.tests b/shell/ash_test/ash-misc/continue1.tests
new file mode 100755
index 000000000..72d356660
--- /dev/null
+++ b/shell/ash_test/ash-misc/continue1.tests
@@ -0,0 +1,4 @@
1for v in a b c; do echo A:$v; continue 666; done
2echo OK1
3for v in a b c; do echo A:$v; continue 666; done
4echo OK2
diff --git a/shell/ash_test/ash-misc/continue2.right b/shell/ash_test/ash-misc/continue2.right
new file mode 100644
index 000000000..49d3ebd3a
--- /dev/null
+++ b/shell/ash_test/ash-misc/continue2.right
@@ -0,0 +1 @@
Ok:1
diff --git a/shell/ash_test/ash-misc/continue2.tests b/shell/ash_test/ash-misc/continue2.tests
new file mode 100755
index 000000000..c2df07195
--- /dev/null
+++ b/shell/ash_test/ash-misc/continue2.tests
@@ -0,0 +1,3 @@
1e=''
2(while test $e && exit 1; true; do e=1; continue; done)
3echo Ok:$?
diff --git a/shell/ash_test/ash-misc/continue3.right b/shell/ash_test/ash-misc/continue3.right
new file mode 100644
index 000000000..aa47d0d46
--- /dev/null
+++ b/shell/ash_test/ash-misc/continue3.right
@@ -0,0 +1,2 @@
10
20
diff --git a/shell/ash_test/ash-misc/continue3.tests b/shell/ash_test/ash-misc/continue3.tests
new file mode 100755
index 000000000..0aff867cd
--- /dev/null
+++ b/shell/ash_test/ash-misc/continue3.tests
@@ -0,0 +1,3 @@
1# Test that "continue" does affect exitcode (sets to 0)
2e=''
3while echo $?; test $e && exit; true; do e=1; false; continue; done
diff --git a/shell/ash_test/ash-misc/empty_for.right b/shell/ash_test/ash-misc/empty_for.right
new file mode 100644
index 000000000..290d39b7e
--- /dev/null
+++ b/shell/ash_test/ash-misc/empty_for.right
@@ -0,0 +1 @@
OK: 0
diff --git a/shell/ash_test/ash-misc/empty_for.tests b/shell/ash_test/ash-misc/empty_for.tests
new file mode 100755
index 000000000..0cb52e849
--- /dev/null
+++ b/shell/ash_test/ash-misc/empty_for.tests
@@ -0,0 +1,3 @@
1false
2for a in; do echo "HELLO"; done
3echo OK: $?
diff --git a/shell/ash_test/ash-misc/empty_for2.right b/shell/ash_test/ash-misc/empty_for2.right
new file mode 100644
index 000000000..1acee9eb8
--- /dev/null
+++ b/shell/ash_test/ash-misc/empty_for2.right
@@ -0,0 +1,4 @@
1PARAM:abc
2PARAM:d e
3PARAM:123
4OK: 0
diff --git a/shell/ash_test/ash-misc/empty_for2.tests b/shell/ash_test/ash-misc/empty_for2.tests
new file mode 100755
index 000000000..2b12ec2c1
--- /dev/null
+++ b/shell/ash_test/ash-misc/empty_for2.tests
@@ -0,0 +1,6 @@
1if test $# = 0; then
2 exec "$THIS_SH" $0 abc "d e" 123
3fi
4false
5for v; do echo "PARAM:$v"; done
6echo OK: $?
diff --git a/shell/ash_test/ash-misc/exit1.right b/shell/ash_test/ash-misc/exit1.right
new file mode 100644
index 000000000..dd2cfc279
--- /dev/null
+++ b/shell/ash_test/ash-misc/exit1.right
@@ -0,0 +1 @@
Once
diff --git a/shell/ash_test/ash-misc/exit1.tests b/shell/ash_test/ash-misc/exit1.tests
new file mode 100755
index 000000000..41e0d092d
--- /dev/null
+++ b/shell/ash_test/ash-misc/exit1.tests
@@ -0,0 +1,4 @@
1trap "echo Not shown" EXIT
2(exit) # must be silent
3trap "echo Once; exit" EXIT
4{ exit; }
diff --git a/shell/ash_test/ash-misc/for_with_bslashes.right b/shell/ash_test/ash-misc/for_with_bslashes.right
new file mode 100644
index 000000000..02d96692c
--- /dev/null
+++ b/shell/ash_test/ash-misc/for_with_bslashes.right
@@ -0,0 +1,8 @@
1a
2b\c
3b\\c
4b"c
5b'c
6b$c
7b`true`c
8Zero:0
diff --git a/shell/ash_test/ash-misc/for_with_bslashes.tests b/shell/ash_test/ash-misc/for_with_bslashes.tests
new file mode 100755
index 000000000..363f3d85b
--- /dev/null
+++ b/shell/ash_test/ash-misc/for_with_bslashes.tests
@@ -0,0 +1,10 @@
1# UNFIXED BUG.
2# commented-out words contain ^C character.
3# It's a SPECIAL_VAR_SYMBOL, for now hush does not escape it.
4# When it is fixed, update this test.
5
6for a in 'a' 'b\c' 'b\\c' 'b"c' "b'c" 'b$c' 'b`true`c' ### 'b#c'
7do
8 echo $a
9done
10echo Zero:$?
diff --git a/shell/ash_test/ash-misc/for_with_keywords.right b/shell/ash_test/ash-misc/for_with_keywords.right
new file mode 100644
index 000000000..eb04e9af9
--- /dev/null
+++ b/shell/ash_test/ash-misc/for_with_keywords.right
@@ -0,0 +1,4 @@
1do
2done
3then
4OK: 0
diff --git a/shell/ash_test/ash-misc/for_with_keywords.tests b/shell/ash_test/ash-misc/for_with_keywords.tests
new file mode 100755
index 000000000..a8b8e4264
--- /dev/null
+++ b/shell/ash_test/ash-misc/for_with_keywords.tests
@@ -0,0 +1,2 @@
1for if in do done then; do echo $if; done
2echo OK: $?
diff --git a/shell/ash_test/ash-misc/if_false_exitcode.right b/shell/ash_test/ash-misc/if_false_exitcode.right
new file mode 100644
index 000000000..7b24a35ff
--- /dev/null
+++ b/shell/ash_test/ash-misc/if_false_exitcode.right
@@ -0,0 +1 @@
Ok:0
diff --git a/shell/ash_test/ash-misc/if_false_exitcode.tests b/shell/ash_test/ash-misc/if_false_exitcode.tests
new file mode 100755
index 000000000..01b36b100
--- /dev/null
+++ b/shell/ash_test/ash-misc/if_false_exitcode.tests
@@ -0,0 +1,2 @@
1if false; then echo Bad; fi
2echo Ok:$?
diff --git a/shell/ash_test/ash-misc/nommu1.right b/shell/ash_test/ash-misc/nommu1.right
new file mode 100644
index 000000000..d206a854b
--- /dev/null
+++ b/shell/ash_test/ash-misc/nommu1.right
@@ -0,0 +1,7 @@
1Ok
2Ok
3Ok
4Ok
5Ok
6Ok
7Done
diff --git a/shell/ash_test/ash-misc/nommu1.tests b/shell/ash_test/ash-misc/nommu1.tests
new file mode 100755
index 000000000..e14ada5f9
--- /dev/null
+++ b/shell/ash_test/ash-misc/nommu1.tests
@@ -0,0 +1,12 @@
1(echo \
2Ok)
3( (echo \
4Ok) )
5( ( (echo \
6Ok) ) )
7
8(echo \Ok)
9( (echo \Ok) )
10( ( (echo \Ok) ) )
11
12echo Done
diff --git a/shell/ash_test/ash-misc/nommu2.right b/shell/ash_test/ash-misc/nommu2.right
new file mode 100644
index 000000000..fb8ba8b5c
--- /dev/null
+++ b/shell/ash_test/ash-misc/nommu2.right
@@ -0,0 +1,5 @@
1Ok
2Ok
3Ok
4Ok
5Done
diff --git a/shell/ash_test/ash-misc/nommu2.tests b/shell/ash_test/ash-misc/nommu2.tests
new file mode 100755
index 000000000..61ed5ce5b
--- /dev/null
+++ b/shell/ash_test/ash-misc/nommu2.tests
@@ -0,0 +1,5 @@
1echo Not shown | if true; then echo $(echo Ok); fi
2echo Not shown | if true; then echo `echo Ok`; fi
3echo Not shown | ( if true; then echo $(echo Ok); fi )
4echo Not shown | ( if true; then echo `echo Ok`; fi )
5echo Done
diff --git a/shell/ash_test/ash-misc/nommu3.right b/shell/ash_test/ash-misc/nommu3.right
new file mode 100644
index 000000000..da1534bef
--- /dev/null
+++ b/shell/ash_test/ash-misc/nommu3.right
@@ -0,0 +1,2 @@
1Ok
20
diff --git a/shell/ash_test/ash-misc/nommu3.tests b/shell/ash_test/ash-misc/nommu3.tests
new file mode 100755
index 000000000..ac82a6a11
--- /dev/null
+++ b/shell/ash_test/ash-misc/nommu3.tests
@@ -0,0 +1,15 @@
1#!/bin/sh
2
3func()
4{
5 while read p; do echo "$p"; done
6}
7
8pipe_to_func()
9{
10 # We had a NOMMU bug which caused "echo Ok |" part to be lost
11 echo Ok | func
12}
13
14pipe_to_func | cat
15echo $?
diff --git a/shell/ash_test/ash-misc/opts1.right b/shell/ash_test/ash-misc/opts1.right
new file mode 100644
index 000000000..4da75737d
--- /dev/null
+++ b/shell/ash_test/ash-misc/opts1.right
@@ -0,0 +1,2 @@
1Param1: >-10qwertyuiop<
2Done
diff --git a/shell/ash_test/ash-misc/opts1.tests b/shell/ash_test/ash-misc/opts1.tests
new file mode 100755
index 000000000..45a23d66b
--- /dev/null
+++ b/shell/ash_test/ash-misc/opts1.tests
@@ -0,0 +1,5 @@
1if test $# = 0; then
2 exec "$THIS_SH" $0 -10qwertyuiop
3fi
4echo "Param1: >$1<"
5echo Done
diff --git a/shell/ash_test/ash-misc/pid.right b/shell/ash_test/ash-misc/pid.right
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/shell/ash_test/ash-misc/pid.right
@@ -0,0 +1 @@
0
diff --git a/shell/ash_test/ash-misc/pid.tests b/shell/ash_test/ash-misc/pid.tests
new file mode 100755
index 000000000..eaeaa717b
--- /dev/null
+++ b/shell/ash_test/ash-misc/pid.tests
@@ -0,0 +1 @@
test `(echo $$)` = `echo $$`; echo $?
diff --git a/shell/ash_test/ash-misc/pipefail.right b/shell/ash_test/ash-misc/pipefail.right
new file mode 100644
index 000000000..5845d8939
--- /dev/null
+++ b/shell/ash_test/ash-misc/pipefail.right
@@ -0,0 +1,40 @@
1Default:
2true | true:
30
41
5true | false:
61
70
8false | true:
90
101
11exit 2 | exit 3 | exit 4:
124
130
14Pipefail on:
15true | true:
160
171
18true | false:
191
200
21false | true:
221
230
24exit 2 | exit 3 | exit 4:
254
260
27Pipefail off:
28true | true:
290
301
31true | false:
321
330
34false | true:
350
361
37exit 2 | exit 3 | exit 4:
384
390
40Done
diff --git a/shell/ash_test/ash-misc/pipefail.tests b/shell/ash_test/ash-misc/pipefail.tests
new file mode 100755
index 000000000..9df841861
--- /dev/null
+++ b/shell/ash_test/ash-misc/pipefail.tests
@@ -0,0 +1,45 @@
1echo Default:
2echo "true | true:"
3 true | true; echo $?
4! true | true; echo $?
5echo "true | false:"
6 true | false; echo $?
7! true | false; echo $?
8echo "false | true:"
9 false | true; echo $?
10! false | true; echo $?
11echo "exit 2 | exit 3 | exit 4:"
12 exit 2 | exit 3 | exit 4; echo $?
13! exit 2 | exit 3 | exit 4; echo $?
14
15echo Pipefail on:
16set -o pipefail
17echo "true | true:"
18 true | true; echo $?
19! true | true; echo $?
20echo "true | false:"
21 true | false; echo $?
22! true | false; echo $?
23echo "false | true:"
24 false | true; echo $?
25! false | true; echo $?
26echo "exit 2 | exit 3 | exit 4:"
27 exit 2 | exit 3 | exit 4; echo $?
28! exit 2 | exit 3 | exit 4; echo $?
29
30echo Pipefail off:
31set +o pipefail
32echo "true | true:"
33 true | true; echo $?
34! true | true; echo $?
35echo "true | false:"
36 true | false; echo $?
37! true | false; echo $?
38echo "false | true:"
39 false | true; echo $?
40! false | true; echo $?
41echo "exit 2 | exit 3 | exit 4:"
42 exit 2 | exit 3 | exit 4; echo $?
43! exit 2 | exit 3 | exit 4; echo $?
44
45echo Done
diff --git a/shell/ash_test/ash-misc/read.right b/shell/ash_test/ash-misc/read.right
new file mode 100644
index 000000000..0e50e2a23
--- /dev/null
+++ b/shell/ash_test/ash-misc/read.right
@@ -0,0 +1,4 @@
1read
2cat
3echo "REPLY=$REPLY"
4REPLY=exec <read.tests
diff --git a/shell/ash_test/ash-misc/read.tests b/shell/ash_test/ash-misc/read.tests
new file mode 100755
index 000000000..ff1acbde1
--- /dev/null
+++ b/shell/ash_test/ash-misc/read.tests
@@ -0,0 +1,4 @@
1exec <read.tests
2read
3cat
4echo "REPLY=$REPLY"
diff --git a/shell/ash_test/ash-misc/return1.right b/shell/ash_test/ash-misc/return1.right
new file mode 100644
index 000000000..7b24a35ff
--- /dev/null
+++ b/shell/ash_test/ash-misc/return1.right
@@ -0,0 +1 @@
Ok:0
diff --git a/shell/ash_test/ash-misc/return1.tests b/shell/ash_test/ash-misc/return1.tests
new file mode 100755
index 000000000..eeb92ef3f
--- /dev/null
+++ b/shell/ash_test/ash-misc/return1.tests
@@ -0,0 +1,4 @@
1echo "true && return; echo Should not be printed" >return_sourced
2. ./return_sourced
3rm return_sourced
4echo Ok:$?
diff --git a/shell/ash_test/ash-misc/shift.right b/shell/ash_test/ash-misc/shift.right
new file mode 100644
index 000000000..d281e358c
--- /dev/null
+++ b/shell/ash_test/ash-misc/shift.right
@@ -0,0 +1,6 @@
1./shift.tests abc d e
2./shift.tests d e 123
3./shift.tests d e 123
4./shift.tests
5./shift.tests
6./shift.tests
diff --git a/shell/ash_test/ash-misc/shift.tests b/shell/ash_test/ash-misc/shift.tests
new file mode 100755
index 000000000..53ef249f2
--- /dev/null
+++ b/shell/ash_test/ash-misc/shift.tests
@@ -0,0 +1,14 @@
1if test $# = 0; then
2 exec "$THIS_SH" $0 abc "d e" 123
3fi
4echo $0 $1 $2
5shift
6echo $0 $1 $2
7shift 999
8echo $0 $1 $2
9shift 2
10echo $0 $1 $2
11shift 2
12echo $0 $1 $2
13shift
14echo $0 $1 $2
diff --git a/shell/ash_test/ash-misc/sigint1.right b/shell/ash_test/ash-misc/sigint1.right
new file mode 100644
index 000000000..a9094b056
--- /dev/null
+++ b/shell/ash_test/ash-misc/sigint1.right
@@ -0,0 +1 @@
Sending SIGINT to main shell PID
diff --git a/shell/ash_test/ash-misc/sigint1.tests b/shell/ash_test/ash-misc/sigint1.tests
new file mode 100755
index 000000000..3d483d32a
--- /dev/null
+++ b/shell/ash_test/ash-misc/sigint1.tests
@@ -0,0 +1,41 @@
1# What should happen if non-interactive shell gets SIGINT?
2
3(sleep 1; echo Sending SIGINT to main shell PID; exec kill -INT $$) &
4
5# We create a child which exits with 0 even on SIGINT
6# (The complex command is necessary only if SIGINT is generated by ^C,
7# in this testcase even bare "sleep 2" would do because
8# in the testcase we don't send SIGINT *to the child*...)
9$THIS_SH -c 'trap "exit 0" SIGINT; sleep 2'
10
11# In one second, we (main shell) get SIGINT here.
12# The question is whether we should, or should not, exit.
13
14# bash will not stop here. It will execute next command(s).
15
16# The rationale for this is described here:
17# http://www.cons.org/cracauer/sigint.html
18#
19# Basically, bash will not exit on SIGINT immediately if it waits
20# for a child. It will wait for the child to exit.
21# If child exits NOT by dying on SIGINT, then bash will not exit.
22#
23# The idea is that the following script:
24# | emacs file.txt
25# | more cmds
26# User may use ^C to interrupt editor's ops like search. But then
27# emacs exits normally. User expects that script doesn't stop.
28#
29# This is a nice idea, but detecting "did process really exit
30# with SIGINT?" is racy. Consider:
31# | bash -c 'while true; do /bin/true; done'
32# When ^C is pressed while bash waits for /bin/true to exit,
33# it may happen that /bin/true exits with exitcode 0 before
34# ^C is delivered to it as SIGINT. bash will see SIGINT, then
35# it will see that child exited with 0, and bash will NOT EXIT.
36
37# Therefore we do not implement bash behavior.
38# I'd say that emacs need to put itself into a separate pgrp
39# to isolate shell from getting stray SIGINTs from ^C.
40
41echo Next command after SIGINT was executed
diff --git a/shell/ash_test/ash-misc/unicode1.right b/shell/ash_test/ash-misc/unicode1.right
new file mode 100644
index 000000000..d3bbbf697
--- /dev/null
+++ b/shell/ash_test/ash-misc/unicode1.right
@@ -0,0 +1,3 @@
11
21
3Ok
diff --git a/shell/ash_test/ash-misc/unicode1.tests b/shell/ash_test/ash-misc/unicode1.tests
new file mode 100755
index 000000000..8788ba910
--- /dev/null
+++ b/shell/ash_test/ash-misc/unicode1.tests
@@ -0,0 +1,13 @@
1LANG=en_US.UTF-8
2
3# A combining character U+300
4a=`printf "\xcc\x80"`
5# Should print 1
6echo ${#a}
7
8# A Japanese katakana charachter U+30a3
9a=`printf "\xe3\x82\xa3"`
10# Should print 1
11echo ${#a}
12
13echo Ok
diff --git a/shell/ash_test/ash-misc/until1.right b/shell/ash_test/ash-misc/until1.right
new file mode 100644
index 000000000..be2daad95
--- /dev/null
+++ b/shell/ash_test/ash-misc/until1.right
@@ -0,0 +1,3 @@
11
21
3Ok:0
diff --git a/shell/ash_test/ash-misc/until1.tests b/shell/ash_test/ash-misc/until1.tests
new file mode 100755
index 000000000..10ab28381
--- /dev/null
+++ b/shell/ash_test/ash-misc/until1.tests
@@ -0,0 +1,11 @@
1x=1
2until test "$x" = 4; do echo $x; x=4; done
3
4# We had a bug in multi-line form
5x=1
6until test "$x" = 4; do
7 echo $x
8 x=4
9done
10
11echo Ok:$?
diff --git a/shell/ash_test/ash-misc/while1.right b/shell/ash_test/ash-misc/while1.right
new file mode 100644
index 000000000..7c4d7beb0
--- /dev/null
+++ b/shell/ash_test/ash-misc/while1.right
@@ -0,0 +1 @@
OK:0
diff --git a/shell/ash_test/ash-misc/while1.tests b/shell/ash_test/ash-misc/while1.tests
new file mode 100755
index 000000000..11e201e6a
--- /dev/null
+++ b/shell/ash_test/ash-misc/while1.tests
@@ -0,0 +1,2 @@
1while false; do echo NOT SHOWN; done
2echo OK:$?
diff --git a/shell/ash_test/ash-misc/while2.right b/shell/ash_test/ash-misc/while2.right
new file mode 100644
index 000000000..07207cc84
--- /dev/null
+++ b/shell/ash_test/ash-misc/while2.right
@@ -0,0 +1,2 @@
1Hello
2OK:0
diff --git a/shell/ash_test/ash-misc/while2.tests b/shell/ash_test/ash-misc/while2.tests
new file mode 100755
index 000000000..2247adc74
--- /dev/null
+++ b/shell/ash_test/ash-misc/while2.tests
@@ -0,0 +1,2 @@
1while echo Hello; false; do echo NOT SHOWN; done
2echo OK:$?
diff --git a/shell/ash_test/ash-misc/while4.right b/shell/ash_test/ash-misc/while4.right
new file mode 100644
index 000000000..7b24a35ff
--- /dev/null
+++ b/shell/ash_test/ash-misc/while4.right
@@ -0,0 +1 @@
Ok:0
diff --git a/shell/ash_test/ash-misc/while4.tests b/shell/ash_test/ash-misc/while4.tests
new file mode 100755
index 000000000..ba80e603a
--- /dev/null
+++ b/shell/ash_test/ash-misc/while4.tests
@@ -0,0 +1,6 @@
1false
2while false && echo Not reached; do
3 echo BUG
4 break
5done
6echo Ok:$?
diff --git a/shell/ash_test/ash-misc/while_in_subshell.right b/shell/ash_test/ash-misc/while_in_subshell.right
new file mode 100644
index 000000000..290d39b7e
--- /dev/null
+++ b/shell/ash_test/ash-misc/while_in_subshell.right
@@ -0,0 +1 @@
OK: 0
diff --git a/shell/ash_test/ash-misc/while_in_subshell.tests b/shell/ash_test/ash-misc/while_in_subshell.tests
new file mode 100755
index 000000000..def8e092b
--- /dev/null
+++ b/shell/ash_test/ash-misc/while_in_subshell.tests
@@ -0,0 +1,2 @@
1(while true; do exit; done)
2echo OK: $?
diff --git a/shell/ash_test/ash-signals/save-ret.right b/shell/ash_test/ash-signals/save-ret.right
new file mode 100644
index 000000000..a3e12ce5e
--- /dev/null
+++ b/shell/ash_test/ash-signals/save-ret.right
@@ -0,0 +1,2 @@
1YEAH
20
diff --git a/shell/ash_test/ash-signals/save-ret.tests b/shell/ash_test/ash-signals/save-ret.tests
new file mode 100755
index 000000000..0786b6d96
--- /dev/null
+++ b/shell/ash_test/ash-signals/save-ret.tests
@@ -0,0 +1,4 @@
1# make sure we do not corrupt $? across traps
2trap "echo YEAH; false" USR1
3kill -USR1 $$
4echo $?
diff --git a/shell/ash_test/ash-vars/empty.right b/shell/ash_test/ash-vars/empty.right
new file mode 100644
index 000000000..2cb3c70f2
--- /dev/null
+++ b/shell/ash_test/ash-vars/empty.right
@@ -0,0 +1,3 @@
1a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
2a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
3a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
diff --git a/shell/ash_test/ash-vars/empty.tests b/shell/ash_test/ash-vars/empty.tests
new file mode 100755
index 000000000..a9c247e31
--- /dev/null
+++ b/shell/ash_test/ash-vars/empty.tests
@@ -0,0 +1,5 @@
1e=
2
3echo a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F
4echo a $e b $e c $e d $e e $e f $e 1 $e 2 $e 3 $e 4 $e 5 $e 6 $e 7 $e 8 $e 9 $e 0 $e A $e B $e C $e D $e E $e F
5echo $e a $e b $e c $e d $e e $e f $e 1 $e 2 $e 3 $e 4 $e 5 $e 6 $e 7 $e 8 $e 9 $e 0 $e A $e B $e C $e D $e E $e F
diff --git a/shell/ash_test/ash-vars/glob_and_vars.right b/shell/ash_test/ash-vars/glob_and_vars.right
new file mode 100644
index 000000000..3ac7ec5ff
--- /dev/null
+++ b/shell/ash_test/ash-vars/glob_and_vars.right
@@ -0,0 +1 @@
./glob_and_vars.right ./glob_and_vars.tests
diff --git a/shell/ash_test/ash-vars/glob_and_vars.tests b/shell/ash_test/ash-vars/glob_and_vars.tests
new file mode 100755
index 000000000..482cf9d8a
--- /dev/null
+++ b/shell/ash_test/ash-vars/glob_and_vars.tests
@@ -0,0 +1,2 @@
1v=.
2echo $v/glob_and_vars.[tr]*
diff --git a/shell/ash_test/ash-vars/param_expand_len.right b/shell/ash_test/ash-vars/param_expand_len.right
new file mode 100644
index 000000000..96e8cb59b
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_expand_len.right
@@ -0,0 +1,9 @@
10
20
31
4Make sure len parsing doesnt break arg count
50 0
64 4
7Testing len op
84 3 2 1 0 0
90 3 0
diff --git a/shell/ash_test/ash-vars/param_expand_len.tests b/shell/ash_test/ash-vars/param_expand_len.tests
new file mode 100755
index 000000000..fe20a45e9
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_expand_len.tests
@@ -0,0 +1,17 @@
1"$THIS_SH" -c 'echo $#'
2"$THIS_SH" -c 'echo $#' arg0
3"$THIS_SH" -c 'echo $#' arg0 arg1
4
5echo Make sure len parsing doesnt break arg count
6set --
7echo $# ${#}
8set -- aaaa bbb cc d
9echo $# ${#}
10
11echo Testing len op
12echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6}
13
14unset e
15f=abc
16g=
17echo ${#e} ${#f} ${#g}
diff --git a/shell/ash_test/ash-vars/param_glob.right b/shell/ash_test/ash-vars/param_glob.right
new file mode 100644
index 000000000..bdee8fe0f
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_glob.right
@@ -0,0 +1,4 @@
1param_glob.tests
2param_glob.tests
3param_glob.t*
4param_glob.t*
diff --git a/shell/ash_test/ash-vars/param_glob.tests b/shell/ash_test/ash-vars/param_glob.tests
new file mode 100755
index 000000000..4d74fee02
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_glob.tests
@@ -0,0 +1,9 @@
1if test $# = 0; then
2 exec "$THIS_SH" "$0" 'param_glob.t*'
3 echo NOT SHOWN
4 exit
5fi
6echo $*
7echo $@
8echo "$*"
9echo "$@"
diff --git a/shell/ash_test/ash-vars/param_subshell.right b/shell/ash_test/ash-vars/param_subshell.right
new file mode 100644
index 000000000..f3c3767de
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_subshell.right
@@ -0,0 +1,7 @@
11=1
22=2
33=3
44=4
55=5
66=6
77=7
diff --git a/shell/ash_test/ash-vars/param_subshell.tests b/shell/ash_test/ash-vars/param_subshell.tests
new file mode 100755
index 000000000..27fdc5b9b
--- /dev/null
+++ b/shell/ash_test/ash-vars/param_subshell.tests
@@ -0,0 +1,15 @@
1if test $# = 0; then
2 "$THIS_SH" "$0" 1 2 3 4 5 6 7 8 9
3 exit
4fi
5echo 1=$1
6{ echo 2=$2; }
7{ echo 3=$3; } &
8# cant use usleep as it isnt standard in $PATH --
9# we fail when testing busybox compiled solely as "hush"
10wait
11( echo 4=$4 )
12( echo 5=$5 ) &
13wait
14true | echo 6=$6 | cat
15true | { echo 7=$7; } | cat
diff --git a/shell/ash_test/ash-vars/star.right b/shell/ash_test/ash-vars/star.right
new file mode 100644
index 000000000..0ecc55bc2
--- /dev/null
+++ b/shell/ash_test/ash-vars/star.right
@@ -0,0 +1,6 @@
1.1.
2.abc.
3.d.
4.e.
5.f.
6.1 abc d e f.
diff --git a/shell/ash_test/ash-vars/star.tests b/shell/ash_test/ash-vars/star.tests
new file mode 100755
index 000000000..5554c4090
--- /dev/null
+++ b/shell/ash_test/ash-vars/star.tests
@@ -0,0 +1,8 @@
1if test $# = 0; then
2 exec "$THIS_SH" star.tests 1 abc 'd e f'
3fi
4# 'd e f' should be split into 3 separate args:
5for a in $*; do echo ".$a."; done
6
7# must produce .1 abc d e f.
8for a in "$*"; do echo ".$a."; done
diff --git a/shell/ash_test/ash-vars/var_expand_in_assign.right b/shell/ash_test/ash-vars/var_expand_in_assign.right
new file mode 100644
index 000000000..352210d7e
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_expand_in_assign.right
@@ -0,0 +1,5 @@
1. .
2.abc d e.
3.abc d e.
4.abc d e.
5.abc d e.
diff --git a/shell/ash_test/ash-vars/var_expand_in_assign.tests b/shell/ash_test/ash-vars/var_expand_in_assign.tests
new file mode 100755
index 000000000..18cdc74c0
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_expand_in_assign.tests
@@ -0,0 +1,15 @@
1if test $# = 0; then
2 exec "$THIS_SH" "$0" abc "d e"
3fi
4
5space=' '
6echo .$space.
7
8a=$*
9echo .$a.
10a=$@
11echo .$a.
12a="$*"
13echo .$a.
14a="$@"
15echo .$a.
diff --git a/shell/ash_test/ash-vars/var_expand_in_redir.right b/shell/ash_test/ash-vars/var_expand_in_redir.right
new file mode 100644
index 000000000..423299c97
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_expand_in_redir.right
@@ -0,0 +1,3 @@
1TEST1
2TEST2
3TEST3
diff --git a/shell/ash_test/ash-vars/var_expand_in_redir.tests b/shell/ash_test/ash-vars/var_expand_in_redir.tests
new file mode 100755
index 000000000..bda6bdd7f
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_expand_in_redir.tests
@@ -0,0 +1,13 @@
1if test $# = 0; then
2 exec "$THIS_SH" "$0" abc "d e"
3fi
4
5echo TEST1 >"$1.out"
6echo TEST2 >"$2.out"
7# bash says: "$@.out": ambiguous redirect
8# ash handles it as if it is '$*' - we do the same
9echo TEST3 >"$@.out"
10
11cat abc.out "d e.out" "abc d e.out"
12
13rm abc.out "d e.out" "abc d e.out"
diff --git a/shell/ash_test/ash-vars/var_expand_on_ifs.right b/shell/ash_test/ash-vars/var_expand_on_ifs.right
new file mode 100644
index 000000000..2ed2069f7
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_expand_on_ifs.right
@@ -0,0 +1,9 @@
11 a b c
22 a + b c
33 a b c
44 a b c
55 a b c
66 a b + c
77 a b c
88 a b c
99 a b c
diff --git a/shell/ash_test/ash-vars/var_expand_on_ifs.tests b/shell/ash_test/ash-vars/var_expand_on_ifs.tests
new file mode 100755
index 000000000..a12ff8ec8
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_expand_on_ifs.tests
@@ -0,0 +1,11 @@
1b=' b '
2e=''
3echo 1 a $b c
4echo 2 a +$b c
5echo 3 a $e$b c
6echo 4 a "$e"$b c
7echo 5 a ""$b c
8echo 6 a $b+ c
9echo 7 a $b$e c
10echo 8 a $b"$e" c
11echo 9 a $b"" c
diff --git a/shell/ash_test/ash-vars/var_in_pipes.right b/shell/ash_test/ash-vars/var_in_pipes.right
new file mode 100644
index 000000000..faf65bed4
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_in_pipes.right
@@ -0,0 +1,6 @@
1b=1
2b=2
3b=3
4b=4
5b=5
6b=6
diff --git a/shell/ash_test/ash-vars/var_in_pipes.tests b/shell/ash_test/ash-vars/var_in_pipes.tests
new file mode 100755
index 000000000..3f8cd2729
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_in_pipes.tests
@@ -0,0 +1,7 @@
1b=1 env | grep ^b=
2true | b=2 env | grep ^b=
3a=1 true | b=3 env | grep ^b=
4
5(b=4 env) | grep ^b=
6(true | b=5 env) | grep ^b=
7(a=1 true | b=6 env) | grep ^b=
diff --git a/shell/ash_test/ash-vars/var_leaks.right b/shell/ash_test/ash-vars/var_leaks.right
new file mode 100644
index 000000000..d86bac9de
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_leaks.right
@@ -0,0 +1 @@
OK
diff --git a/shell/ash_test/ash-vars/var_leaks.tests b/shell/ash_test/ash-vars/var_leaks.tests
new file mode 100755
index 000000000..27c8c6504
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_leaks.tests
@@ -0,0 +1,14 @@
1# external program
2a=b /bin/true
3env | grep ^a=
4
5# builtin
6a=b true
7env | grep ^a=
8
9# exec with redirection only
10# in bash, this leaks!
11a=b exec 1>&1
12env | grep ^a=
13
14echo OK
diff --git a/shell/hush_test/hush-misc/assignment2.rigth b/shell/hush_test/hush-misc/assignment2.right
index 591552cde..591552cde 100644
--- a/shell/hush_test/hush-misc/assignment2.rigth
+++ b/shell/hush_test/hush-misc/assignment2.right