From 4aca87515a5083ae0e31ce3177189fd43b6d05ac Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 3 Jan 2015 13:58:15 +0100 Subject: patch to Vanilla Tomato 1.28 --- .../busybox/shell/hush_test/hush-arith/arith.right | 138 ++++++++++ .../busybox/shell/hush_test/hush-arith/arith.tests | 302 +++++++++++++++++++++ .../busybox/shell/hush_test/hush-arith/arith1.sub | 40 +++ .../busybox/shell/hush_test/hush-arith/arith2.sub | 57 ++++ .../hush-bugs/and_or_and_backgrounding.right | 4 + .../hush-bugs/and_or_and_backgrounding.tests | 31 +++ .../busybox/shell/hush_test/hush-glob/glob1.right | 2 + .../busybox/shell/hush_test/hush-glob/glob1.tests | 2 + .../hush_test/hush-glob/glob_and_assign.right | 6 + .../hush_test/hush-glob/glob_and_assign.tests | 10 + .../shell/hush_test/hush-glob/glob_redir.right | 2 + .../shell/hush_test/hush-glob/glob_redir.tests | 9 + .../shell/hush_test/hush-leak/leak_argv1.right | 2 + .../shell/hush_test/hush-leak/leak_argv1.tests | 117 ++++++++ .../busybox/shell/hush_test/hush-misc/and-or.right | 18 ++ .../busybox/shell/hush_test/hush-misc/and-or.tests | 34 +++ .../shell/hush_test/hush-misc/assignment1.right | 9 + .../shell/hush_test/hush-misc/assignment1.tests | 42 +++ .../shell/hush_test/hush-misc/assignment2.rigth | 2 + .../shell/hush_test/hush-misc/assignment2.tests | 4 + .../busybox/shell/hush_test/hush-misc/break1.right | 2 + .../busybox/shell/hush_test/hush-misc/break1.tests | 3 + .../busybox/shell/hush_test/hush-misc/break2.right | 3 + .../busybox/shell/hush_test/hush-misc/break2.tests | 6 + .../busybox/shell/hush_test/hush-misc/break3.right | 2 + .../busybox/shell/hush_test/hush-misc/break3.tests | 2 + .../busybox/shell/hush_test/hush-misc/break4.right | 6 + .../busybox/shell/hush_test/hush-misc/break4.tests | 12 + .../busybox/shell/hush_test/hush-misc/break5.right | 13 + .../busybox/shell/hush_test/hush-misc/break5.tests | 4 + .../shell/hush_test/hush-misc/builtin1.right | 2 + .../shell/hush_test/hush-misc/builtin1.tests | 6 + .../busybox/shell/hush_test/hush-misc/case1.right | 14 + .../busybox/shell/hush_test/hush-misc/case1.tests | 25 ++ .../busybox/shell/hush_test/hush-misc/colon.right | 2 + .../busybox/shell/hush_test/hush-misc/colon.tests | 5 + .../shell/hush_test/hush-misc/continue1.right | 8 + .../shell/hush_test/hush-misc/continue1.tests | 4 + .../shell/hush_test/hush-misc/continue2.right | 1 + .../shell/hush_test/hush-misc/continue2.tests | 3 + .../shell/hush_test/hush-misc/continue3.right | 2 + .../shell/hush_test/hush-misc/continue3.tests | 3 + .../shell/hush_test/hush-misc/empty_for.right | 1 + .../shell/hush_test/hush-misc/empty_for.tests | 3 + .../shell/hush_test/hush-misc/empty_for2.right | 4 + .../shell/hush_test/hush-misc/empty_for2.tests | 6 + .../busybox/shell/hush_test/hush-misc/exec.right | 6 + .../busybox/shell/hush_test/hush-misc/exec.tests | 30 ++ .../busybox/shell/hush_test/hush-misc/exit1.right | 1 + .../busybox/shell/hush_test/hush-misc/exit1.tests | 4 + .../busybox/shell/hush_test/hush-misc/export.right | 6 + .../busybox/shell/hush_test/hush-misc/export.tests | 7 + .../hush_test/hush-misc/for_with_bslashes.right | 8 + .../hush_test/hush-misc/for_with_bslashes.tests | 10 + .../hush_test/hush-misc/for_with_keywords.right | 4 + .../hush_test/hush-misc/for_with_keywords.tests | 2 + .../busybox/shell/hush_test/hush-misc/func1.right | 6 + .../busybox/shell/hush_test/hush-misc/func1.tests | 16 ++ .../busybox/shell/hush_test/hush-misc/func2.right | 5 + .../busybox/shell/hush_test/hush-misc/func2.tests | 9 + .../shell/hush_test/hush-misc/heredoc1.right | 5 + .../shell/hush_test/hush-misc/heredoc1.tests | 9 + .../shell/hush_test/hush-misc/heredoc2.right | 9 + .../shell/hush_test/hush-misc/heredoc2.tests | 12 + .../shell/hush_test/hush-misc/heredoc3.right | 9 + .../shell/hush_test/hush-misc/heredoc3.tests | 12 + .../shell/hush_test/hush-misc/heredoc_huge.right | 3 + .../shell/hush_test/hush-misc/heredoc_huge.tests | 9 + .../hush_test/hush-misc/if_false_exitcode.right | 1 + .../hush_test/hush-misc/if_false_exitcode.tests | 2 + .../busybox/shell/hush_test/hush-misc/pid.right | 1 + .../busybox/shell/hush_test/hush-misc/pid.tests | 1 + .../busybox/shell/hush_test/hush-misc/read.right | 4 + .../busybox/shell/hush_test/hush-misc/read.tests | 4 + .../busybox/shell/hush_test/hush-misc/redir1.right | 12 + .../busybox/shell/hush_test/hush-misc/redir1.tests | 40 +++ .../busybox/shell/hush_test/hush-misc/redir2.right | 1 + .../busybox/shell/hush_test/hush-misc/redir2.tests | 2 + .../busybox/shell/hush_test/hush-misc/redir3.right | 14 + .../busybox/shell/hush_test/hush-misc/redir3.tests | 9 + .../busybox/shell/hush_test/hush-misc/redir4.right | 18 ++ .../busybox/shell/hush_test/hush-misc/redir4.tests | 85 ++++++ .../busybox/shell/hush_test/hush-misc/shift.right | 6 + .../busybox/shell/hush_test/hush-misc/shift.tests | 14 + .../shell/hush_test/hush-misc/syntax_err.right | 4 + .../shell/hush_test/hush-misc/syntax_err.tests | 3 + .../hush_test/hush-misc/syntax_err_negate.right | 2 + .../hush_test/hush-misc/syntax_err_negate.tests | 2 + .../busybox/shell/hush_test/hush-misc/until1.right | 3 + .../busybox/shell/hush_test/hush-misc/until1.tests | 11 + .../busybox/shell/hush_test/hush-misc/while1.right | 1 + .../busybox/shell/hush_test/hush-misc/while1.tests | 2 + .../busybox/shell/hush_test/hush-misc/while2.right | 2 + .../busybox/shell/hush_test/hush-misc/while2.tests | 2 + .../hush_test/hush-misc/while_in_subshell.right | 1 + .../hush_test/hush-misc/while_in_subshell.tests | 2 + .../shell/hush_test/hush-parsing/argv0.right | 1 + .../shell/hush_test/hush-parsing/argv0.tests | 4 + .../shell/hush_test/hush-parsing/escape1.right | 4 + .../shell/hush_test/hush-parsing/escape1.tests | 6 + .../shell/hush_test/hush-parsing/escape2.right | 4 + .../shell/hush_test/hush-parsing/escape2.tests | 4 + .../shell/hush_test/hush-parsing/escape3.right | 23 ++ .../shell/hush_test/hush-parsing/escape3.tests | 10 + .../shell/hush_test/hush-parsing/escape5.right | 9 + .../shell/hush_test/hush-parsing/escape5.tests | 7 + .../shell/hush_test/hush-parsing/negate.right | 35 +++ .../shell/hush_test/hush-parsing/negate.tests | 16 ++ .../shell/hush_test/hush-parsing/noeol.right | 1 + .../shell/hush_test/hush-parsing/noeol.tests | 2 + .../shell/hush_test/hush-parsing/noeol2.right | 1 + .../shell/hush_test/hush-parsing/noeol2.tests | 7 + .../shell/hush_test/hush-parsing/noeol3.right | 1 + .../shell/hush_test/hush-parsing/noeol3.tests | 2 + .../hush_test/hush-parsing/process_subst.right | 3 + .../hush_test/hush-parsing/process_subst.tests | 3 + .../shell/hush_test/hush-parsing/quote1.right | 1 + .../shell/hush_test/hush-parsing/quote1.tests | 2 + .../shell/hush_test/hush-parsing/quote2.right | 1 + .../shell/hush_test/hush-parsing/quote2.tests | 2 + .../shell/hush_test/hush-parsing/quote3.right | 12 + .../shell/hush_test/hush-parsing/quote3.tests | 21 ++ .../shell/hush_test/hush-parsing/quote4.right | 1 + .../shell/hush_test/hush-parsing/quote4.tests | 2 + .../shell/hush_test/hush-parsing/redir_space.right | 3 + .../shell/hush_test/hush-parsing/redir_space.tests | 6 + .../shell/hush_test/hush-parsing/starquoted.right | 8 + .../shell/hush_test/hush-parsing/starquoted.tests | 8 + .../shell/hush_test/hush-parsing/starquoted2.right | 5 + .../shell/hush_test/hush-parsing/starquoted2.tests | 19 ++ .../busybox/shell/hush_test/hush-psubst/tick.right | 2 + .../busybox/shell/hush_test/hush-psubst/tick.tests | 4 + .../shell/hush_test/hush-psubst/tick2.right | 1 + .../shell/hush_test/hush-psubst/tick2.tests | 5 + .../shell/hush_test/hush-psubst/tick3.right | 6 + .../shell/hush_test/hush-psubst/tick3.tests | 12 + .../shell/hush_test/hush-psubst/tick4.right | 7 + .../shell/hush_test/hush-psubst/tick4.tests | 7 + .../shell/hush_test/hush-psubst/tick_huge.right | 3 + .../shell/hush_test/hush-psubst/tick_huge.tests | 7 + .../busybox/shell/hush_test/hush-trap/catch.right | 4 + .../busybox/shell/hush_test/hush-trap/catch.tests | 20 ++ .../busybox/shell/hush_test/hush-trap/exit.right | 2 + .../busybox/shell/hush_test/hush-trap/exit.tests | 3 + .../shell/hush_test/hush-trap/save-ret.right | 2 + .../shell/hush_test/hush-trap/save-ret.tests | 4 + .../busybox/shell/hush_test/hush-trap/usage.right | 14 + .../busybox/shell/hush_test/hush-trap/usage.tests | 23 ++ .../busybox/shell/hush_test/hush-vars/empty.right | 3 + .../busybox/shell/hush_test/hush-vars/empty.tests | 5 + .../shell/hush_test/hush-vars/glob_and_vars.right | 1 + .../shell/hush_test/hush-vars/glob_and_vars.tests | 2 + .../hush_test/hush-vars/param_expand_alt.right | 8 + .../hush_test/hush-vars/param_expand_alt.tests | 22 ++ .../hush_test/hush-vars/param_expand_assign.right | 27 ++ .../hush_test/hush-vars/param_expand_assign.tests | 38 +++ .../hush_test/hush-vars/param_expand_default.right | 8 + .../hush_test/hush-vars/param_expand_default.tests | 22 ++ .../hush-vars/param_expand_indicate_error.right | 28 ++ .../hush-vars/param_expand_indicate_error.tests | 40 +++ .../hush_test/hush-vars/param_expand_len.right | 4 + .../hush_test/hush-vars/param_expand_len.tests | 12 + .../shell/hush_test/hush-vars/param_glob.right | 4 + .../shell/hush_test/hush-vars/param_glob.tests | 10 + .../shell/hush_test/hush-vars/param_subshell.right | 7 + .../shell/hush_test/hush-vars/param_subshell.tests | 15 + .../busybox/shell/hush_test/hush-vars/star.right | 6 + .../busybox/shell/hush_test/hush-vars/star.tests | 8 + .../busybox/shell/hush_test/hush-vars/unset.right | 19 ++ .../busybox/shell/hush_test/hush-vars/unset.tests | 36 +++ .../busybox/shell/hush_test/hush-vars/var1.right | 4 + .../busybox/shell/hush_test/hush-vars/var1.tests | 9 + .../busybox/shell/hush_test/hush-vars/var2.right | 2 + .../busybox/shell/hush_test/hush-vars/var2.tests | 4 + .../busybox/shell/hush_test/hush-vars/var3.right | 2 + .../busybox/shell/hush_test/hush-vars/var3.tests | 4 + .../hush_test/hush-vars/var_expand_in_assign.right | 5 + .../hush_test/hush-vars/var_expand_in_assign.tests | 15 + .../hush_test/hush-vars/var_expand_in_redir.right | 3 + .../hush_test/hush-vars/var_expand_in_redir.tests | 13 + .../shell/hush_test/hush-vars/var_in_pipes.right | 6 + .../shell/hush_test/hush-vars/var_in_pipes.tests | 7 + .../shell/hush_test/hush-vars/var_leaks.right | 1 + .../shell/hush_test/hush-vars/var_leaks.tests | 14 + .../shell/hush_test/hush-vars/var_posix1.right | 33 +++ .../shell/hush_test/hush-vars/var_posix1.tests | 43 +++ .../shell/hush_test/hush-vars/var_preserved.right | 4 + .../shell/hush_test/hush-vars/var_preserved.tests | 16 ++ .../hush_test/hush-vars/var_subst_in_for.right | 40 +++ .../hush_test/hush-vars/var_subst_in_for.tests | 40 +++ .../shell/hush_test/hush-z_slow/leak_all1.right | 3 + .../shell/hush_test/hush-z_slow/leak_all1.tests | 145 ++++++++++ .../shell/hush_test/hush-z_slow/leak_all2.right | 3 + .../shell/hush_test/hush-z_slow/leak_all2.tests | 93 +++++++ .../hush_test/hush-z_slow/leak_heredoc1.right | 3 + .../hush_test/hush-z_slow/leak_heredoc1.tests | 34 +++ .../shell/hush_test/hush-z_slow/leak_var.right | 2 + .../shell/hush_test/hush-z_slow/leak_var.tests | 47 ++++ .../shell/hush_test/hush-z_slow/leak_var2.right | 3 + .../shell/hush_test/hush-z_slow/leak_var2.tests | 40 +++ .../shell/hush_test/hush-z_slow/leak_var3.right | 3 + .../shell/hush_test/hush-z_slow/leak_var3.tests | 41 +++ release/src/router/busybox/shell/hush_test/run-all | 89 ++++++ 203 files changed, 2860 insertions(+) create mode 100644 release/src/router/busybox/shell/hush_test/hush-arith/arith.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-arith/arith.tests create mode 100755 release/src/router/busybox/shell/hush_test/hush-arith/arith1.sub create mode 100755 release/src/router/busybox/shell/hush_test/hush-arith/arith2.sub create mode 100644 release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-glob/glob1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-glob/glob1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/and-or.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/and-or.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/assignment1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/assignment1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/assignment2.rigth create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/assignment2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/break1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/break1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/break2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/break2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/break3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/break3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/break4.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/break4.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/break5.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/break5.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/builtin1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/builtin1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/case1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/case1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/colon.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/colon.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/continue1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/continue1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/continue2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/continue2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/continue3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/continue3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/empty_for.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/empty_for.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/exec.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/exec.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/exit1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/exit1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/export.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/export.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/for_with_bslashes.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/for_with_bslashes.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/for_with_keywords.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/for_with_keywords.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/func1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/func1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/func2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/func2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/heredoc1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/heredoc1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/heredoc2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/heredoc2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/heredoc3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/heredoc3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/heredoc_huge.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/heredoc_huge.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/pid.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/pid.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/read.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/read.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/redir1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/redir1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/redir2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/redir2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/redir3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/redir3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/redir4.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/redir4.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/shift.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/shift.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/until1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/until1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/while1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/while1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/while2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/while2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/escape1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/escape3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/escape3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/escape5.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/escape5.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/negate.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/quote3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/quote3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-psubst/tick.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-psubst/tick.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-psubst/tick2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-psubst/tick2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-psubst/tick3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-psubst/tick3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-psubst/tick4.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-psubst/tick4.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-trap/catch.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-trap/catch.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-trap/exit.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-trap/exit.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-trap/save-ret.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-trap/save-ret.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-trap/usage.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-trap/usage.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/empty.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/empty.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_glob.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_glob.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/star.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/star.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/unset.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/unset.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var3.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var2.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var2.tests create mode 100644 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.right create mode 100755 release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.tests create mode 100755 release/src/router/busybox/shell/hush_test/run-all (limited to 'release/src/router/busybox/shell/hush_test') diff --git a/release/src/router/busybox/shell/hush_test/hush-arith/arith.right b/release/src/router/busybox/shell/hush_test/hush-arith/arith.right new file mode 100644 index 00000000..8cde0ee5 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-arith/arith.right @@ -0,0 +1,138 @@ +Format: 'expected actual' +163 163 +4 4 +16 16 +8 8 +2 2 +4 4 +2 2 +2 2 +1 1 +0 0 +0 0 +0 0 +1 1 +1 1 +2 2 +-3 -3 +-2 -2 +1 1 +0 0 +2 2 +131072 131072 +29 29 +33 33 +49 49 +1 1 +1 1 +0 0 +0 0 +1 1 +1 1 +1 1 +2 2 +3 3 +1 1 +58 58 +2 2 +60 60 +1 1 +256 256 +16 16 +62 62 +4 4 +29 29 +5 5 +-4 -4 +4 4 +1 1 +32 32 +32 32 +1 1 +1 1 +32 32 +20 20 +30 30 +20 20 +30 30 +hush: error in arithmetic +6 6 +6,5,3 6,5,3 +263 263 +255 255 +40 40 +hush: error in arithmetic +hush: divide by 0 +hush: can't exec 'let': No such file or directory +hush: error in arithmetic +hush: can't exec 'let': No such file or directory +abc +def +ghi +hush: error in arithmetic +16 16 +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +9 9 +hush: error in arithmetic +hush: error in arithmetic +9 9 +9 9 +9 9 +7 7 +7 +4 4 +32767 32767 +32768 32768 +131072 131072 +2147483647 2147483647 +1 1 +4 4 +4 4 +5 5 +5 5 +4 4 +3 3 +3 3 +4 4 +4 4 +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +4 4 +7 7 +-7 -7 +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +6 6 +3 3 +7 7 +4 4 +0 0 +3 3 +7 7 +2 2 +-2 -2 +1 1 +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +hush: error in arithmetic +5 5 +1 1 +4 4 +0 0 +hush: error in arithmetic +hush: error in arithmetic +8 12 +hush: error in arithmetic +42 +42 +42 +hush: can't exec 'a[b[c]d]=e': No such file or directory diff --git a/release/src/router/busybox/shell/hush_test/hush-arith/arith.tests b/release/src/router/busybox/shell/hush_test/hush-arith/arith.tests new file mode 100755 index 00000000..57e66e88 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-arith/arith.tests @@ -0,0 +1,302 @@ +#ash# set +o posix +#ash# declare -i iv jv + +echo "Format: 'expected actual'" + +iv=$(( 3 + 5 * 32 )) +echo 163 $iv +#ash# iv=iv+3 +#ash# echo 166 $iv +iv=2 +jv=iv + +: $((jv *= 2)) ##hush## let "jv *= 2" +echo 4 $jv +jv=$(( $jv << 2 )) +echo 16 $jv + +: $((jv=$jv / 2)) ##hush## let jv="$jv / 2" +echo 8 $jv +#ash# jv="jv >> 2" +: $((jv=jv >> 2)) ##hush## let jv="jv >> 2" +echo 2 $jv + +iv=$((iv+ $jv)) +echo 4 $iv +echo 2 $((iv -= jv)) +echo 2 $iv +echo 1 $(( iv == jv )) +echo 0 $(( iv != $jv )) +echo 0 $(( iv < jv )) +echo 0 $(( $iv > $jv )) +echo 1 $(( iv <= $jv )) +echo 1 $(( $iv >= jv )) + +echo 2 $jv +echo -3 $(( ~$jv )) +echo -2 $(( ~1 )) +echo 1 $(( ! 0 )) + +echo 0 $(( jv % 2 )) +echo 2 $(( $iv % 4 )) + +echo 131072 $(( iv <<= 16 )) +echo 29 $(( iv %= 33 )) + +echo 33 $(( 33 & 55 )) +echo 49 $(( 33 | 17 )) + +echo 1 $(( iv && $jv )) +echo 1 $(( $iv || jv )) + +echo 0 $(( iv && 0 )) +echo 0 $(( iv & 0 )) +echo 1 $(( iv && 1 )) +echo 1 $(( iv & 1 )) + +echo 1 $(( $jv || 0 )) +echo 2 $(( jv | 0 )) +echo 3 $(( jv | 1 )) +echo 1 $(( $jv || 1 )) + +: $((iv *= jv)) ##hush## let 'iv *= jv' +echo 58 $iv +echo 2 $jv +: $((jv += $iv)) ##hush## let "jv += $iv" +echo 60 $jv + +echo 1 $(( jv /= iv )) +echo 256 $(( jv <<= 8 )) +echo 16 $(( jv >>= 4 )) + +echo 62 $(( iv |= 4 )) +echo 4 $(( iv &= 4 )) + +echo 29 $(( iv += (jv + 9))) +echo 5 $(( (iv + 4) % 7 )) + +# unary plus, minus +echo -4 $(( +4 - 8 )) +echo 4 $(( -4 + 8 )) + +# conditional expressions +echo 1 $(( 4<5 ? 1 : 32)) +echo 32 $(( 4>5 ? 1 : 32)) +echo 32 $(( 4>(2+3) ? 1 : 32)) +echo 1 $(( 4<(2+3) ? 1 : 32)) +echo 1 $(( (2+2)<(2+3) ? 1 : 32)) +echo 32 $(( (2+2)>(2+3) ? 1 : 32)) + +# check that the unevaluated part of the ternary operator does not do +# evaluation or assignment +x=i+=2 +y=j+=2 +#ash# declare -i i=1 j=1 + i=1 + j=1 +echo 20 $((1 ? 20 : (x+=2))) +#ash# echo $i,$x # ash mishandles this +echo 30 $((0 ? (y+=2) : 30)) +#ash# echo $j,$y # ash mishandles this + +x=i+=2 +y=j+=2 +#ash# declare -i i=1 j=1 + i=1 + j=1 +echo 20 $((1 ? 20 : (x+=2))) +#ash# echo $i,$x # ash mishandles this +echo 30 $((0 ? (y+=2) : 30)) +#ash# echo $i,$y # ash mishandles this + +# check precedence of assignment vs. conditional operator +# should be an error +#ash# declare -i x=2 + x=2 +#ashnote# bash reports error but continues, ash aborts - using subshell to 'emulate' bash: +( y=$((1 ? 20 : x+=2)) ) + +# check precedence of assignment vs. conditional operator +#ash# declare -i x=2 + x=2 +# ash says "line NNN: syntax error: 0 ? x+=2 : 20" +#ash# echo 20 $((0 ? x+=2 : 20)) + +# associativity of assignment-operator operator +#ash# declare -i i=1 j=2 k=3 +i=1 +j=2 +k=3 +echo 6 $((i += j += k)) +echo 6,5,3 $i,$j,$k + +# octal, hex +echo 263 $(( 0x100 | 007 )) +echo 255 $(( 0xff )) +#ash# echo 255 $(( 16#ff )) +#ash# echo 127 $(( 16#FF/2 )) +#ash# echo 36 $(( 8#44 )) + +echo 40 $(( 8 ^ 32 )) + +#ash# # other bases +#ash# echo 10 $(( 16#a )) +#ash# echo 10 $(( 32#a )) +#ash# echo 10 $(( 56#a )) +#ash# echo 10 $(( 64#a )) +#ash# +#ash# echo 10 $(( 16#A )) +#ash# echo 10 $(( 32#A )) +#ash# echo 36 $(( 56#A )) +#ash# echo 36 $(( 64#A )) +#ash# +#ash# echo 62 $(( 64#@ )) +#ash# echo 63 $(( 64#_ )) + +#ash# # weird bases (error) +#ash# echo $(( 3425#56 )) + +#ash# # missing number after base +#ash# echo 0 $(( 2# )) + +# these should generate errors +( echo $(( 7 = 43 )) ) +#ash# echo $(( 2#44 )) +( echo $(( 44 / 0 )) ) +( let 'jv += $iv' ) +( echo $(( jv += \$iv )) ) +( let 'rv = 7 + (43 * 6' ) + +#ash# # more errors +#ash# declare -i i +#ash# i=0#4 +#ash# i=2#110#11 + +((echo abc; echo def;); echo ghi) + +#ash# if (((4+4) + (4 + 7))); then +#ash# echo ok +#ash# fi + +#ash# (()) # make sure the null expression works OK + +#ash# a=(0 2 4 6) +#ash# echo 6 $(( a[1] + a[2] )) +#ash# echo 1 $(( (a[1] + a[2]) == a[3] )) +#ash# (( (a[1] + a[2]) == a[3] )) ; echo 0 $? + +# test pushing and popping the expression stack +unset A +A="4 + " +( echo A $(( ( 4 + A ) + 4 )) ) +A="3 + 5" +echo 16 $(( ( 4 + A ) + 4 )) + +# badly-formed conditional expressions +( echo $(( 4 ? : $A )) ) +( echo $(( 1 ? 20 )) ) +( echo $(( 4 ? 20 : )) ) + +# precedence and short-circuit evaluation +B=9 +echo 9 $B + +# error +( echo $(( 0 && B=42 )); echo 9 $B ) + +# error +( echo $(( 1 || B=88 )); echo 9 $B ) + +# ash mistakenly evaluates B=... below +#ash# echo 0 $(( 0 && (B=42) )) +echo 9 $B +#ash# echo 0 $(( (${$} - $$) && (B=42) )) +echo 9 $B +#ash# echo 1 $(( 1 || (B=88) )) +echo 9 $B + + +# until command with (( )) command +x=7 + +echo 7 $x +#ash# until (( x == 4 )) + until test "$x" = 4 +do + echo $x + x=4 +done + +echo 4 $x + +# exponentiation +echo 32767 $(( 2**15 - 1)) +echo 32768 $(( 2**(16-1))) +echo 131072 $(( 2**16*2 )) +echo 2147483647 $(( 2**31-1)) +echo 1 $(( 2**0 )) + +# {pre,post}-{inc,dec}rement and associated errors + +x=4 + +echo 4 $x +echo 4 $(( x++ )) +echo 5 $x +echo 5 $(( x-- )) +echo 4 $x + +echo 3 $(( --x )) +echo 3 $x + +echo 4 $(( ++x )) +echo 4 $x + +# bash 3.2 apparently thinks that ++7 is 7 +#ash# echo 7 $(( ++7 )) +( echo $(( 7-- )) ) + +( echo $(( --x=7 )) ) +( echo $(( ++x=7 )) ) + +( echo $(( x++=7 )) ) +( echo $(( x--=7 )) ) + +echo 4 $x + +echo 7 $(( +7 )) +echo -7 $(( -7 )) + +# bash 3.2 apparently thinks that ++7 is 7 +#ash# echo $(( ++7 )) +#ash# echo $(( --7 )) + +${THIS_SH} ./arith1.sub +${THIS_SH} ./arith2.sub + +x=4 +y=7 + +#ash# (( x=8 , y=12 )) + x=8 + y=12 +echo $x $y + +#ash# # should be an error +#ash# (( x=9 y=41 )) + +# These are errors +unset b +( echo $((a b)) ) +#ash# ((a b)) + +n=42 +printf "%d\n" $n +printf "%i\n" $n +#ash# echo $(( 8#$(printf "%o\n" $n) )) +printf "%u\n" $n +#ash# echo $(( 16#$(printf "%x\n" $n) )) +#ash# echo $(( 16#$(printf "%X\n" $n) )) + +# causes longjmp botches through bash-2.05b +a[b[c]d]=e diff --git a/release/src/router/busybox/shell/hush_test/hush-arith/arith1.sub b/release/src/router/busybox/shell/hush_test/hush-arith/arith1.sub new file mode 100755 index 00000000..80aa9992 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-arith/arith1.sub @@ -0,0 +1,40 @@ +# test of redone post-increment and post-decrement code +( echo $(( 4-- )) ) +( echo $(( 4++ )) ) +( echo $(( 4 -- )) ) +( echo $(( 4 ++ )) ) + +#ash# (( array[0]++ )) +#ash# echo ${array} + +#ash# (( array[0] ++ )) +#ash# echo ${array} + +#ash# (( a++ )) +#ash# echo $a +#ash# (( a ++ )) +#ash# echo $a + a=2 + +echo 6 $(( a ++ + 4 )) +echo 3 $a + +echo 7 $(( a+++4 )) +echo 4 $a + +echo 0 $(( a---4 )) +echo 3 $a + +echo 7 $(( a -- + 4 )) +echo 2 $a + +echo -2 $(( a -- - 4 )) +echo 1 $a + +#ash# (( ++ + 7 )) + +#ash# (( ++ )) +( echo $(( +++7 )) ) +# bash 3.2 apparently thinks that ++ +7 is 7 +#ash# echo $(( ++ + 7 )) +#ash# (( -- )) diff --git a/release/src/router/busybox/shell/hush_test/hush-arith/arith2.sub b/release/src/router/busybox/shell/hush_test/hush-arith/arith2.sub new file mode 100755 index 00000000..f7e3c923 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-arith/arith2.sub @@ -0,0 +1,57 @@ +# bash 3.2 apparently thinks that ++7 is 7 etc +( echo $(( --7 )) ) +( echo $(( ++7 )) ) +( echo $(( -- 7 )) ) +( echo $(( ++ 7 )) ) + +#ash# ((++array[0] )) +#ash# echo 1 $array +#ash# (( ++ array[0] )) +#ash# echo 2 $array + +#ash# (( ++a )) +#ash# echo 1 $a +#ash# (( ++ a )) +#ash# echo 2 $a + +#ash# (( --a )) +#ash# echo 1 $a +#ash# (( -- a )) +#ash# echo 0 $a + a=0 + +echo 5 $(( 4 + ++a )) +echo 1 $a + +# ash doesn't handle it right... +#ash# echo 6 $(( 4+++a )) +#ash# echo 2 $a + a=2 + +# ash doesn't handle it right... +#ash# echo 3 $(( 4---a )) +#ash# echo 1 $a + a=1 + +echo 4 $(( 4 - -- a )) +echo 0 $a + +#ash# (( -- )) +# bash 3.2 apparently thinks that ---7 is -7 +#ash# echo $(( ---7 )) +( echo $(( -- - 7 )) ) + +#ash# (( ++ )) +# bash 3.2: 7 +#ash# echo 7 $(( ++7 )) +( echo $(( ++ + 7 )) ) + +# bash 3.2: -7 +#ash# echo -7 $(( ++-7 )) +# bash 3.2: -7 +#ash# echo -7 $(( ++ - 7 )) + +# bash 3.2: 7 +#ash# echo 7 $(( +--7 )) +# bash 3.2: 7 +#ash# echo 7 $(( -- + 7 )) diff --git a/release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.right b/release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.right new file mode 100644 index 00000000..90ce63e0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.right @@ -0,0 +1,4 @@ +First +Second +Third +Done diff --git a/release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.tests b/release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.tests new file mode 100755 index 00000000..05acfb86 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-bugs/and_or_and_backgrounding.tests @@ -0,0 +1,31 @@ +# UNFIXED BUG: hush thinks that ; && || & have the same precedence. +# According to this doc, && || have higher precedence than ; &. +# See example below. +# Precedence of ; is not a problem in practice. Precedence of & is. +# +#http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html +# +#2.9.3 Lists +# +#An AND-OR list is a sequence of one or more pipelines separated by +#the operators "&&" and "||" . +# +#A list is a sequence of one or more AND-OR lists separated by the operators +#';' and '&' and optionally terminated by ';', '&', or . +# +#The operators "&&" and "||" shall have equal precedence and shall be +#evaluated with left associativity. For example, both of the following +#commands write solely bar to standard output: +# +# false && echo foo || echo bar +# true || echo foo && echo bar +# +#A ';' or terminator shall cause the preceding AND-OR list +#to be executed sequentially; an '&' shall cause asynchronous execution +#of the preceding AND-OR list. + +echo First && sleep 0.2 && echo Third & +sleep 0.1 +echo Second +wait +echo Done diff --git a/release/src/router/busybox/shell/hush_test/hush-glob/glob1.right b/release/src/router/busybox/shell/hush_test/hush-glob/glob1.right new file mode 100644 index 00000000..f29ab4e6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-glob/glob1.right @@ -0,0 +1,2 @@ +glob1.tests +glob1.tests diff --git a/release/src/router/busybox/shell/hush_test/hush-glob/glob1.tests b/release/src/router/busybox/shell/hush_test/hush-glob/glob1.tests new file mode 100755 index 00000000..f980ce06 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-glob/glob1.tests @@ -0,0 +1,2 @@ +echo *glob1?t[e]sts* +echo "glob1"?'t'[e]s* diff --git a/release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.right b/release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.right new file mode 100644 index 00000000..d46e4436 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.right @@ -0,0 +1,6 @@ +ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp +ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp +*.tmp +ZVAR=z.tmp z.tmp +ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp +ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp diff --git a/release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.tests b/release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.tests new file mode 100755 index 00000000..0b158f20 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-glob/glob_and_assign.tests @@ -0,0 +1,10 @@ +>ZVAR=z.tmp +>z.tmp +ZVAR=*.tmp echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" +ZVAR=*.tmp /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" +ZVAR=*.tmp +echo "$ZVAR" +echo $ZVAR +echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" +/bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" +rm ZVAR=z.tmp z.tmp diff --git a/release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.right b/release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.right new file mode 100644 index 00000000..fbd0309b --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.right @@ -0,0 +1,2 @@ +z.tmp: +?.tmp: TEST diff --git a/release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.tests b/release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.tests new file mode 100755 index 00000000..621d1201 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-glob/glob_redir.tests @@ -0,0 +1,9 @@ +# Redirections are not globbed. +# bash: +# if run as "sh", they are not globbed, but +# if run as "bash", they are! +>z.tmp +echo TEST >?.tmp +echo 'z.tmp:' `cat 'z.tmp'` +echo '?.tmp:' `cat '?.tmp'` +rm 'z.tmp' '?.tmp' diff --git a/release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.right b/release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.right new file mode 100644 index 00000000..7bccc1ee --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.right @@ -0,0 +1,2 @@ +Measuring memory leak... +vsz does not grow diff --git a/release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.tests b/release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.tests new file mode 100755 index 00000000..34991ce2 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-leak/leak_argv1.tests @@ -0,0 +1,117 @@ +pid=$$ + +# Warm up +beg=`ps -o pid,vsz | grep "^ *$pid "` +i=1 +while test $i != X; do + 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 + shift + shift 2 + shift 5 + shift 11 + 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 + shift 3 + shift 7 + i=1$i + if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi + if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi + if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi + if test $i = 1111111111111111111111111111111111111111111114; then i=5; fi + if test $i = 1111111111111111111111111111111111111111111115; then i=6; fi + if test $i = 1111111111111111111111111111111111111111111116; then i=7; fi + if test $i = 1111111111111111111111111111111111111111111117; then i=8; fi + if test $i = 1111111111111111111111111111111111111111111118; then i=9; fi + if test $i = 1111111111111111111111111111111111111111111119; then i=a; fi + if test $i = 111111111111111111111111111111111111111111111a; then i=b; fi + if test $i = 111111111111111111111111111111111111111111111b; then i=c; fi + if test $i = 111111111111111111111111111111111111111111111c; then i=d; fi + if test $i = 111111111111111111111111111111111111111111111d; then i=e; fi + if test $i = 111111111111111111111111111111111111111111111e; then i=f; fi + if test $i = 111111111111111111111111111111111111111111111f; then i=g; fi + if test $i = 111111111111111111111111111111111111111111111g; then i=h; fi + if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi + if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi + if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi +done +end=`ps -o pid,vsz | grep "^ *$pid "` + +# Warm up again (I do need it on my machine) +beg=`ps -o pid,vsz | grep "^ *$pid "` +i=1 +while test $i != X; do + 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 + shift + shift 2 + shift 5 + shift 11 + 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 + shift 3 + shift 7 + i=1$i + if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi + if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi + if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi + if test $i = 1111111111111111111111111111111111111111111114; then i=5; fi + if test $i = 1111111111111111111111111111111111111111111115; then i=6; fi + if test $i = 1111111111111111111111111111111111111111111116; then i=7; fi + if test $i = 1111111111111111111111111111111111111111111117; then i=8; fi + if test $i = 1111111111111111111111111111111111111111111118; then i=9; fi + if test $i = 1111111111111111111111111111111111111111111119; then i=a; fi + if test $i = 111111111111111111111111111111111111111111111a; then i=b; fi + if test $i = 111111111111111111111111111111111111111111111b; then i=c; fi + if test $i = 111111111111111111111111111111111111111111111c; then i=d; fi + if test $i = 111111111111111111111111111111111111111111111d; then i=e; fi + if test $i = 111111111111111111111111111111111111111111111e; then i=f; fi + if test $i = 111111111111111111111111111111111111111111111f; then i=g; fi + if test $i = 111111111111111111111111111111111111111111111g; then i=h; fi + if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi + if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi + if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi +done +end=`ps -o pid,vsz | grep "^ *$pid "` +if test "$beg" != "$end"; then + true echo "vsz grows: $beg -> $end" +else + true echo "vsz does not grow" +fi + +echo "Measuring memory leak..." +beg=`ps -o pid,vsz | grep "^ *$pid "` +i=1 +while test $i != X; do + 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 + shift + shift 2 + shift 5 + shift 11 + 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 + shift 3 + shift 7 + i=1$i + if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi + if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi + if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi + if test $i = 1111111111111111111111111111111111111111111114; then i=5; fi + if test $i = 1111111111111111111111111111111111111111111115; then i=6; fi + if test $i = 1111111111111111111111111111111111111111111116; then i=7; fi + if test $i = 1111111111111111111111111111111111111111111117; then i=8; fi + if test $i = 1111111111111111111111111111111111111111111118; then i=9; fi + if test $i = 1111111111111111111111111111111111111111111119; then i=a; fi + if test $i = 111111111111111111111111111111111111111111111a; then i=b; fi + if test $i = 111111111111111111111111111111111111111111111b; then i=c; fi + if test $i = 111111111111111111111111111111111111111111111c; then i=d; fi + if test $i = 111111111111111111111111111111111111111111111d; then i=e; fi + if test $i = 111111111111111111111111111111111111111111111e; then i=f; fi + if test $i = 111111111111111111111111111111111111111111111f; then i=g; fi + if test $i = 111111111111111111111111111111111111111111111g; then i=h; fi + if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi + if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi + if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi +done +end=`ps -o pid,vsz | grep "^ *$pid "` + +if test "$beg" != "$end"; then + echo "vsz grows: $beg -> $end" +else + echo "vsz does not grow" +fi diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/and-or.right b/release/src/router/busybox/shell/hush_test/hush-misc/and-or.right new file mode 100644 index 00000000..f9fa5fbf --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/and-or.right @@ -0,0 +1,18 @@ +a1 +a4 +b1 +b3 +b4 +b6 +c4 +c5 +c7 +c8 +ff1 +ff3 +ft2 +ft3 +tf2 +tf3 +tt2 +tt4 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/and-or.tests b/release/src/router/busybox/shell/hush_test/hush-misc/and-or.tests new file mode 100755 index 00000000..485458ab --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/and-or.tests @@ -0,0 +1,34 @@ +false || echo a1 +false && echo a2 +true || echo a3 +true && echo a4 + +false || echo b1 || echo b2 +false || echo b3 && echo b4 +false && echo b5 || echo b6 +false && echo b7 && echo b8 + +true || echo c1 || echo c2 +true || echo c3 && echo c4 +true && echo c5 || echo c6 +true && echo c7 && echo c8 + +false || false || echo ff1 +false || false && echo ff2 +false && false || echo ff3 +false && false && echo ff4 + +false || true || echo ft1 +false || true && echo ft2 +false && true || echo ft3 +false && true && echo ft4 + +true || false || echo tf1 +true || false && echo tf2 +true && false || echo tf3 +true && false && echo tf4 + +true || true || echo tt1 +true || true && echo tt2 +true && true || echo tt3 +true && true && echo tt4 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/assignment1.right b/release/src/router/busybox/shell/hush_test/hush-misc/assignment1.right new file mode 100644 index 00000000..d0a13d3d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/assignment1.right @@ -0,0 +1,9 @@ +if1:0 +while1:0 +until1:0 +if2:0 +while2:0 +until2:0 +if3:0 +while3:0 +until3:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/assignment1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/assignment1.tests new file mode 100755 index 00000000..033b3525 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/assignment1.tests @@ -0,0 +1,42 @@ +# Assignments after some keywords should still work + +if a=1 true; then a=1 true; elif a=1 true; then a=1 true; else a=1 true; fi +echo if1:$? +while a=1 true; do a=1 true; break; done +echo while1:$? +until a=1 false; do a=1 true; break; done +echo until1:$? + +if a=1 true + then a=1 true + elif a=1 true + then a=1 true + else a=1 true + fi +echo if2:$? +while a=1 true + do a=1 true + break + done +echo while2:$? +until a=1 false + do a=1 true + break + done +echo until2:$? + +if + a=1 true; then + a=1 true; elif + a=1 true; then + a=1 true; else + a=1 true; fi +echo if3:$? +while + a=1 true; do + a=1 true; break; done +echo while3:$? +until + a=1 false; do + a=1 true; break; done +echo until3:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/assignment2.rigth b/release/src/router/busybox/shell/hush_test/hush-misc/assignment2.rigth new file mode 100644 index 00000000..591552cd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/assignment2.rigth @@ -0,0 +1,2 @@ +hush: can't exec 'a=b': No such file or directory +1 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/assignment2.tests b/release/src/router/busybox/shell/hush_test/hush-misc/assignment2.tests new file mode 100755 index 00000000..540e01ec --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/assignment2.tests @@ -0,0 +1,4 @@ +# This must not be interpreted as an assignment +a''=b true +echo $? +# (buglet: $? should be 127. it is currently 1) diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break1.right b/release/src/router/busybox/shell/hush_test/hush-misc/break1.right new file mode 100644 index 00000000..04a4b175 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break1.right @@ -0,0 +1,2 @@ +A +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/break1.tests new file mode 100755 index 00000000..912f149c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break1.tests @@ -0,0 +1,3 @@ +while true; do echo A; break; echo B; done +echo OK:$? + diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break2.right b/release/src/router/busybox/shell/hush_test/hush-misc/break2.right new file mode 100644 index 00000000..8a15cb95 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break2.right @@ -0,0 +1,3 @@ +A +AA +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break2.tests b/release/src/router/busybox/shell/hush_test/hush-misc/break2.tests new file mode 100755 index 00000000..7da9faf3 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break2.tests @@ -0,0 +1,6 @@ +while true; do + echo A + while true; do echo AA; break 2; echo BB; done + echo B +done +echo OK:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break3.right b/release/src/router/busybox/shell/hush_test/hush-misc/break3.right new file mode 100644 index 00000000..04a4b175 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break3.right @@ -0,0 +1,2 @@ +A +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break3.tests b/release/src/router/busybox/shell/hush_test/hush-misc/break3.tests new file mode 100755 index 00000000..d138dcac --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break3.tests @@ -0,0 +1,2 @@ +v=break; while true; do echo A; $v; echo B; break; echo C; done +echo OK:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break4.right b/release/src/router/busybox/shell/hush_test/hush-misc/break4.right new file mode 100644 index 00000000..6f41c141 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break4.right @@ -0,0 +1,6 @@ +A +AA +TRUE +A +AA +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break4.tests b/release/src/router/busybox/shell/hush_test/hush-misc/break4.tests new file mode 100755 index 00000000..67da2889 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break4.tests @@ -0,0 +1,12 @@ +cond=true +while $cond; do + echo A + if test "$cond" = true; then + cond='echo TRUE' + else + cond=false + fi + while true; do echo AA; continue 2; echo BB; done + echo B +done +echo OK:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break5.right b/release/src/router/busybox/shell/hush_test/hush-misc/break5.right new file mode 100644 index 00000000..0b9df2a4 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break5.right @@ -0,0 +1,13 @@ +A +B +0 +A:a +B +D +A:b +B +D +A:c +B +D +0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/break5.tests b/release/src/router/busybox/shell/hush_test/hush-misc/break5.tests new file mode 100755 index 00000000..273e040e --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/break5.tests @@ -0,0 +1,4 @@ +while true; do echo A; { echo B; break; echo C; }; echo D; done +echo $? +for v in a b c; do echo A:$v; (echo B; break; echo C); echo D; done +echo $? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/builtin1.right b/release/src/router/busybox/shell/hush_test/hush-misc/builtin1.right new file mode 100644 index 00000000..2e55ecb0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/builtin1.right @@ -0,0 +1,2 @@ +VARIABLE=export +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/builtin1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/builtin1.tests new file mode 100755 index 00000000..1a2941fa --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/builtin1.tests @@ -0,0 +1,6 @@ +# builtins, unlike keywords like "while", can be constructed +# with substitutions +VARIABLE=export +$VARIABLE VARIABLE +env | grep ^VARIABLE +echo OK:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/case1.right b/release/src/router/busybox/shell/hush_test/hush-misc/case1.right new file mode 100644 index 00000000..e9e371ac --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/case1.right @@ -0,0 +1,14 @@ +OK_1 +OK_1 +OK_21 +OK_22 +OK_23 +OK_31 +OK_32 +OK_41 +OK_42 +OK_43 +OK_44 +OK_51 +OK_52 +OK_53 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/case1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/case1.tests new file mode 100755 index 00000000..0174893e --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/case1.tests @@ -0,0 +1,25 @@ +case w in a) echo SKIP;; w) echo OK_1;; w) echo WRONG;; esac + +case w in + a) echo SKIP;; + w)echo OK_1 ;; + w) + echo WRONG + ;; +esac + +t=w +case $t in a) echo SKIP;; w) echo OK_21;; w) echo WRONG;; esac; +case "$t" in a) echo SKIP;; w) echo OK_22;; w) echo WRONG;; esac; +case w in a) echo SKIP;; $t) echo OK_23;; "$t") echo WRONG;; esac; + +case '' in a) echo SKIP;; w) echo WRONG;; *) echo OK_31;; esac; +case '' in a) echo SKIP;; '') echo OK_32;; *) echo WRONG;; esac; + +case `echo w` in a) echo SKIP;; w) echo OK_41;; w) echo WRONG;; esac; +case "`echo w`" in a) echo SKIP;; w) echo OK_42;; w) echo WRONG;; esac; +case `echo w w` in a) echo SKIP;; w) echo WRONG;; 'w w') echo OK_43;; esac; +case `echo w w` in a) echo SKIP;; w) echo WRONG;; w*) echo OK_44;; esac; + +case w in `echo w`) echo OK_51;; `echo WRONG >&2`w) echo WRONG;; esac; +case w in `echo OK_52 >&2`) echo SKIP;; `echo`w) echo OK_53;; esac; diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/colon.right b/release/src/router/busybox/shell/hush_test/hush-misc/colon.right new file mode 100644 index 00000000..2a87d029 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/colon.right @@ -0,0 +1,2 @@ +0 +OK: 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/colon.tests b/release/src/router/busybox/shell/hush_test/hush-misc/colon.tests new file mode 100755 index 00000000..cb8ab530 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/colon.tests @@ -0,0 +1,5 @@ +false +: +echo $? +(while :; do exit; done) +echo OK: $? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/continue1.right b/release/src/router/busybox/shell/hush_test/hush-misc/continue1.right new file mode 100644 index 00000000..c4a5565b --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/continue1.right @@ -0,0 +1,8 @@ +A:a +A:b +A:c +OK1 +A:a +A:b +A:c +OK2 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/continue1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/continue1.tests new file mode 100755 index 00000000..72d35666 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/continue1.tests @@ -0,0 +1,4 @@ +for v in a b c; do echo A:$v; continue 666; done +echo OK1 +for v in a b c; do echo A:$v; continue 666; done +echo OK2 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/continue2.right b/release/src/router/busybox/shell/hush_test/hush-misc/continue2.right new file mode 100644 index 00000000..49d3ebd3 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/continue2.right @@ -0,0 +1 @@ +Ok:1 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/continue2.tests b/release/src/router/busybox/shell/hush_test/hush-misc/continue2.tests new file mode 100755 index 00000000..c2df0719 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/continue2.tests @@ -0,0 +1,3 @@ +e='' +(while test $e && exit 1; true; do e=1; continue; done) +echo Ok:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/continue3.right b/release/src/router/busybox/shell/hush_test/hush-misc/continue3.right new file mode 100644 index 00000000..aa47d0d4 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/continue3.right @@ -0,0 +1,2 @@ +0 +0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/continue3.tests b/release/src/router/busybox/shell/hush_test/hush-misc/continue3.tests new file mode 100755 index 00000000..0aff867c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/continue3.tests @@ -0,0 +1,3 @@ +# Test that "continue" does affect exitcode (sets to 0) +e='' +while echo $?; test $e && exit; true; do e=1; false; continue; done diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/empty_for.right b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for.right new file mode 100644 index 00000000..290d39b7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for.right @@ -0,0 +1 @@ +OK: 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/empty_for.tests b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for.tests new file mode 100755 index 00000000..0cb52e84 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for.tests @@ -0,0 +1,3 @@ +false +for a in; do echo "HELLO"; done +echo OK: $? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.right b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.right new file mode 100644 index 00000000..1acee9eb --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.right @@ -0,0 +1,4 @@ +PARAM:abc +PARAM:d e +PARAM:123 +OK: 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.tests b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.tests new file mode 100755 index 00000000..2b12ec2c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/empty_for2.tests @@ -0,0 +1,6 @@ +if test $# = 0; then + exec "$THIS_SH" $0 abc "d e" 123 +fi +false +for v; do echo "PARAM:$v"; done +echo OK: $? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/exec.right b/release/src/router/busybox/shell/hush_test/hush-misc/exec.right new file mode 100644 index 00000000..a0de6089 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/exec.right @@ -0,0 +1,6 @@ +pass fd out open +pass fd out dup +pass fd out close +pass fd in open +pass fd in dup +pass fd in close diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/exec.tests b/release/src/router/busybox/shell/hush_test/hush-misc/exec.tests new file mode 100755 index 00000000..6de50fa7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/exec.tests @@ -0,0 +1,30 @@ +# make sure we have a way of checking these things +cd /proc/$$/fd || cd /dev/fd || exit 1 + +[ -e 44 ] && exit 1 +exec 44>/dev/null +[ -e 44 ] || exit 1 +echo pass fd out open + +[ -e 55 ] && exit 1 +exec 55>&44 +[ -e 55 ] || exit 1 +echo pass fd out dup + +exec 44>&- +[ -e 44 ] && exit 1 +echo pass fd out close + +[ -e 66 ] && exit 1 +exec 66"$0.tmp" +yes "123456789 123456789 123456789 123456789" | head -3000 >>"$0.tmp" +echo 'HERE' >>"$0.tmp" + +yes "123456789 123456789 123456789 123456789" | head -3000 | md5sum +. "$0.tmp" +rm "$0.tmp" +echo End diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.right b/release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.right new file mode 100644 index 00000000..7b24a35f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.right @@ -0,0 +1 @@ +Ok:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.tests b/release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.tests new file mode 100755 index 00000000..01b36b10 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/if_false_exitcode.tests @@ -0,0 +1,2 @@ +if false; then echo Bad; fi +echo Ok:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/pid.right b/release/src/router/busybox/shell/hush_test/hush-misc/pid.right new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/pid.right @@ -0,0 +1 @@ +0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/pid.tests b/release/src/router/busybox/shell/hush_test/hush-misc/pid.tests new file mode 100755 index 00000000..eaeaa717 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/pid.tests @@ -0,0 +1 @@ +test `(echo $$)` = `echo $$`; echo $? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/read.right b/release/src/router/busybox/shell/hush_test/hush-misc/read.right new file mode 100644 index 00000000..0e50e2a2 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/read.right @@ -0,0 +1,4 @@ +read +cat +echo "REPLY=$REPLY" +REPLY=exec /dev/null +var=bad +>shell_test_$$ var=ok +echo "Test 0: var:$var" +test -f shell_test_$$ && echo "File created:ok" + +rm shell_test_$$ 2>/dev/null +var=bad +var=ok >shell_test_$$ +echo "Test 1: var:$var" +test -f shell_test_$$ && echo "File created:ok" + +rm shell_test_$$ 2>/dev/null +var=ok +true | var=bad >shell_test_$$ +echo "Test 2: var:$var" +test -f shell_test_$$ && echo "File created:ok" + +rm shell_test_$$ 2>/dev/null +var=bad +{ var=ok >shell_test_$$; } +echo "Test 3: var:$var" +test -f shell_test_$$ && echo "File created:ok" + +rm shell_test_$$ 2>/dev/null +var=ok +{ var=bad >shell_test_$$; } & +# cant use usleep as it isnt standard in $PATH -- +# we fail when testing busybox compiled solely as "hush" +wait +echo "Test 4: var:$var" +test -f shell_test_$$ && echo "File created:ok" + +rm shell_test_$$ 2>/dev/null +var=ok +( var=bad >shell_test_$$ ) +echo "Test 5: var:$var" +test -f shell_test_$$ && echo "File created:ok" + +rm shell_test_$$ 2>/dev/null diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/redir2.right b/release/src/router/busybox/shell/hush_test/hush-misc/redir2.right new file mode 100644 index 00000000..7326d960 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/redir2.right @@ -0,0 +1 @@ +Ok diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/redir2.tests b/release/src/router/busybox/shell/hush_test/hush-misc/redir2.tests new file mode 100755 index 00000000..81983cae --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/redir2.tests @@ -0,0 +1,2 @@ +echo NOT SHOWN \2>/dev/null +echo Ok diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/redir3.right b/release/src/router/busybox/shell/hush_test/hush-misc/redir3.right new file mode 100644 index 00000000..3d20bbf6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/redir3.right @@ -0,0 +1,14 @@ +hush: can't open '/does/not/exist': No such file or directory +One:1 +hush: can't open '/cant/be/created': No such file or directory +One:1 +Ok +hush: can't open '/cant/be/created': No such file or directory +Zero:0 +hush: can't open '/cant/be/created': No such file or directory +One:1 +hush: can't open '/cant/be/created': No such file or directory +One:1 +hush: can't open '/cant/be/created': No such file or directory +Zero:0 +Done diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/redir3.tests b/release/src/router/busybox/shell/hush_test/hush-misc/redir3.tests new file mode 100755 index 00000000..7c28e432 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/redir3.tests @@ -0,0 +1,9 @@ +echo Error >/does/not/exist; echo One:$? +t=BAD +t=Ok >>/cant/be/created; echo One:$? +echo $t +! >/cant/be/created; echo Zero:$? +exec >/cant/be/created; echo One:$? +exec /bin/true >/cant/be/created; echo One:$? +! exec /bin/true >/cant/be/created; echo Zero:$? +echo Done diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/redir4.right b/release/src/router/busybox/shell/hush_test/hush-misc/redir4.right new file mode 100644 index 00000000..ead25f60 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/redir4.right @@ -0,0 +1,18 @@ +shell_test +\shell_test +\shell_test +\shell_test +Here1 +Ok1 +Here2 +Ok2 +Here3 +Ok3 +Here4 +Ok4 +Now with variable refs +shell_test_1 +\shell_test_1 +\shell_test_1 +\shell_test_1 +Done diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/redir4.tests b/release/src/router/busybox/shell/hush_test/hush-misc/redir4.tests new file mode 100755 index 00000000..c50b8ced --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/redir4.tests @@ -0,0 +1,85 @@ +rm *shell_test* 2>/dev/null + +>\shell_test +echo *shell_test* +rm *shell_test* + +>\\shell_test +echo *shell_test* +rm *shell_test* + +>"\shell_test" +echo *shell_test* +rm *shell_test* + +>"\\shell_test" +echo *shell_test* +rm *shell_test* + + +cat <<\shell_test +Here1 +shell_test +echo Ok1 + +cat <<\\shell_test +Here2 +\shell_test +echo Ok2 + +cat <<"\shell_test" +Here3 +\shell_test +echo Ok3 + +cat <<"\\shell_test" +Here4 +\shell_test +echo Ok4 + + +echo Now with variable refs +i=1 + + +>\shell_test_$i +echo *shell_test* +rm *shell_test* + +>\\shell_test_$i +echo *shell_test* +rm *shell_test* + +>"\shell_test_$i" +echo *shell_test* +rm *shell_test* + +>"\\shell_test_$i" +echo *shell_test* +rm *shell_test* + +echo Done;exit +# UNFIXED BUG. bash apparently will expand $i even in terminating delimiter. +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html +# does not mandate this behavior. +# This is not likely to be used much in real-world. + +cat <<\shell_test_$i +Here1 +shell_test_$i +echo Ok1 + +cat <<\\shell_test_$i +Here2 +\shell_test_$i +echo Ok2 + +cat <<"\shell_test_$i" +Here3 +\shell_test_$i +echo Ok3 + +cat <<"\\shell_test_$i" +Here4 +\shell_test_$i +echo Ok4 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/shift.right b/release/src/router/busybox/shell/hush_test/hush-misc/shift.right new file mode 100644 index 00000000..d281e358 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/shift.right @@ -0,0 +1,6 @@ +./shift.tests abc d e +./shift.tests d e 123 +./shift.tests d e 123 +./shift.tests +./shift.tests +./shift.tests diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/shift.tests b/release/src/router/busybox/shell/hush_test/hush-misc/shift.tests new file mode 100755 index 00000000..53ef249f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/shift.tests @@ -0,0 +1,14 @@ +if test $# = 0; then + exec "$THIS_SH" $0 abc "d e" 123 +fi +echo $0 $1 $2 +shift +echo $0 $1 $2 +shift 999 +echo $0 $1 $2 +shift 2 +echo $0 $1 $2 +shift 2 +echo $0 $1 $2 +shift +echo $0 $1 $2 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.right b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.right new file mode 100644 index 00000000..680e7967 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.right @@ -0,0 +1,4 @@ +shown +hush: syntax error: unterminated ' +test +not shown diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.tests b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.tests new file mode 100755 index 00000000..d10ed42e --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err.tests @@ -0,0 +1,3 @@ +echo shown +echo test `echo 'aa` +echo not shown diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.right b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.right new file mode 100644 index 00000000..8c701062 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.right @@ -0,0 +1,2 @@ +bash 3.2 fails this +hush: syntax error: ! ! command diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.tests b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.tests new file mode 100755 index 00000000..d61b1b09 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/syntax_err_negate.tests @@ -0,0 +1,2 @@ +echo bash 3.2 fails this +! ! true diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/until1.right b/release/src/router/busybox/shell/hush_test/hush-misc/until1.right new file mode 100644 index 00000000..be2daad9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/until1.right @@ -0,0 +1,3 @@ +1 +1 +Ok:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/until1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/until1.tests new file mode 100755 index 00000000..10ab2838 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/until1.tests @@ -0,0 +1,11 @@ +x=1 +until test "$x" = 4; do echo $x; x=4; done + +# We had a bug in multi-line form +x=1 +until test "$x" = 4; do + echo $x + x=4 +done + +echo Ok:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/while1.right b/release/src/router/busybox/shell/hush_test/hush-misc/while1.right new file mode 100644 index 00000000..7c4d7beb --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/while1.right @@ -0,0 +1 @@ +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/while1.tests b/release/src/router/busybox/shell/hush_test/hush-misc/while1.tests new file mode 100755 index 00000000..11e201e6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/while1.tests @@ -0,0 +1,2 @@ +while false; do echo NOT SHOWN; done +echo OK:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/while2.right b/release/src/router/busybox/shell/hush_test/hush-misc/while2.right new file mode 100644 index 00000000..07207cc8 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/while2.right @@ -0,0 +1,2 @@ +Hello +OK:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/while2.tests b/release/src/router/busybox/shell/hush_test/hush-misc/while2.tests new file mode 100755 index 00000000..2247adc7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/while2.tests @@ -0,0 +1,2 @@ +while echo Hello; false; do echo NOT SHOWN; done +echo OK:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.right b/release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.right new file mode 100644 index 00000000..290d39b7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.right @@ -0,0 +1 @@ +OK: 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.tests b/release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.tests new file mode 100755 index 00000000..def8e092 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-misc/while_in_subshell.tests @@ -0,0 +1,2 @@ +(while true; do exit; done) +echo OK: $? diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right @@ -0,0 +1 @@ +OK diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests new file mode 100755 index 00000000..f5c40f6f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests @@ -0,0 +1,4 @@ +if test $# = 0; then + exec "$THIS_SH" "$0" arg +fi +echo OK diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right new file mode 100644 index 00000000..1899b87e --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right @@ -0,0 +1,4 @@ +\ +a\b +\\ +c\\d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.tests new file mode 100755 index 00000000..25ac96b2 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.tests @@ -0,0 +1,6 @@ +test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 + +echo "\\" +echo a"\\"b +echo '\\' +echo c'\\'d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right new file mode 100644 index 00000000..f55fd4a4 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right @@ -0,0 +1,4 @@ +*?[a]* +a*?[a]*b +*?[a]* +c*?[a]*d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests new file mode 100755 index 00000000..ee718018 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests @@ -0,0 +1,4 @@ +echo "*?[a]*" +echo a"*?[a]*"b +echo '*?[a]*' +echo c'*?[a]*'d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.right new file mode 100644 index 00000000..da02a976 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.right @@ -0,0 +1,23 @@ +v: a \ b \\ c \\\ d \\\\ e +v: a \ b \\ c \\\ d \\\\ e +Unquoted: +.a. +.\. +.b. +.\\. +.c. +.\\\. +.d. +.\\\\. +.e. +Quoted: +.a. +.\. +.b. +.\\. +.c. +.\\\. +.d. +.\\\\. +.e. +done diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.tests new file mode 100755 index 00000000..18705bd0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.tests @@ -0,0 +1,10 @@ +test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 + +v='a \ b \\ c \\\ d \\\\ e' +echo v: $v +echo v: "$v" +echo Unquoted: +for a in $v; do echo .$a.; done +echo Quoted: +for a in $v; do echo ".$a."; done +echo done diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.right new file mode 100644 index 00000000..3cdd393c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.right @@ -0,0 +1,9 @@ +a\nb\nc\n +a +b +c +a\nb\nc\n +a +b +c +Done diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.tests new file mode 100755 index 00000000..337a98ec --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.tests @@ -0,0 +1,7 @@ +v="a\nb\nc\n" +echo "$v" +printf "$v" +v='a\nb\nc\n' +echo "$v" +printf "$v" +echo Done diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/negate.right b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.right new file mode 100644 index 00000000..01166012 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.right @@ -0,0 +1,35 @@ +! printing ! +0 +1 +1 +0 +0 +0 +! +a +b +c +! 1 +a 1 +b 1 +c 1 +! 1 +a 1 +b 1 +c 1 +0 +0 +0 +0 +1 +1 +1 +1 +0 +0 +0 +0 +1 +1 +1 +1 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests new file mode 100755 index 00000000..c25127d7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests @@ -0,0 +1,16 @@ +echo ! printing ! +! false +echo $? +! true +echo $? +if ! false; then false; echo $?; fi +echo $? +if ! false; then ! false; echo $?; fi +echo $? +for a in ! a b c; do echo $a; done +for a in ! a b c; do ! printf "$a "; echo $?; done +for a in ! a b c; do ! /usr/bin/printf "$a "; echo $?; done +for a in ! a b c; do ! printf "$a " | false; echo $?; done +for a in ! a b c; do ! printf "$a " | true; echo $?; done +for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done +for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right new file mode 100644 index 00000000..e427984d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right @@ -0,0 +1 @@ +HELLO diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests new file mode 100755 index 00000000..a93113a0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests @@ -0,0 +1,2 @@ +# next line has no EOL! +echo HELLO \ No newline at end of file diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right @@ -0,0 +1 @@ +1 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.tests new file mode 100755 index 00000000..1220f056 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.tests @@ -0,0 +1,7 @@ +# last line has no EOL! +if true +then + echo 1 +else + echo 2 +fi \ No newline at end of file diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right new file mode 100644 index 00000000..56f8515b --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right @@ -0,0 +1 @@ +hush: syntax error: unterminated " diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests new file mode 100755 index 00000000..ec958ed7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests @@ -0,0 +1,2 @@ +# last line has no EOL! +echo "unterminated \ No newline at end of file diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right new file mode 100644 index 00000000..397bc806 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right @@ -0,0 +1,3 @@ +TESTzzBEST +TEST$(echo zz)BEST +TEST'BEST diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.tests new file mode 100755 index 00000000..21996bc0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.tests @@ -0,0 +1,3 @@ +echo "TEST`echo zz;echo;echo`BEST" +echo "TEST`echo '$(echo zz)'`BEST" +echo "TEST`echo "'"`BEST" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right new file mode 100644 index 00000000..cb382054 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right @@ -0,0 +1 @@ +'1' diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests new file mode 100755 index 00000000..f5589546 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests @@ -0,0 +1,2 @@ +a=1 +echo "'$a'" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right new file mode 100644 index 00000000..3bc9edcd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right @@ -0,0 +1 @@ +>1 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests new file mode 100755 index 00000000..bd966f30 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests @@ -0,0 +1,2 @@ +a=1 +echo ">$a" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.right new file mode 100644 index 00000000..bbe46df6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.right @@ -0,0 +1,12 @@ +Testing: in "" +.. +Testing: in '' +.. +Testing: in $empty +Testing: in $empty"" +.. +Testing: in $empty'' +.. +Testing: in "$empty" +.. +Finished diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.tests new file mode 100755 index 00000000..b5fd5978 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.tests @@ -0,0 +1,21 @@ +empty='' + +echo 'Testing: in ""' +for a in ""; do echo ".$a."; done + +echo 'Testing: in '"''" +for a in ''; do echo ".$a."; done + +echo 'Testing: in $empty' +for a in $empty; do echo ".$a."; done + +echo 'Testing: in $empty""' +for a in $empty""; do echo ".$a."; done + +echo 'Testing: in $empty'"''" +for a in $empty''; do echo ".$a."; done + +echo 'Testing: in "$empty"' +for a in "$empty"; do echo ".$a."; done + +echo Finished diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right new file mode 100644 index 00000000..b2901ea9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right @@ -0,0 +1 @@ +a b diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests new file mode 100755 index 00000000..f1dabfa5 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests @@ -0,0 +1,2 @@ +a_b='a b' +echo "$a_b" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right new file mode 100644 index 00000000..08429520 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right @@ -0,0 +1,3 @@ +z1.tmp: 1 +z2.tmp: 1 +"z1.tmp z2.tmp": TEST 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests new file mode 100755 index 00000000..c0b54309 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests @@ -0,0 +1,6 @@ +v='z1.tmp z2.tmp' +echo TEST >$v +echo 'z1.tmp:' `cat 'z1.tmp' 2>/dev/null; echo $?` +echo 'z2.tmp:' `cat 'z2.tmp' 2>/dev/null; echo $?` +echo '"z1.tmp z2.tmp":' `cat 'z1.tmp z2.tmp' 2>/dev/null; echo $?` +rm z*.tmp diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.right b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.right new file mode 100644 index 00000000..b56323fe --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.right @@ -0,0 +1,8 @@ +.1 abc d e f. +.1. +.abc. +.d e f. +.-1 abc d e f-. +.-1. +.abc. +.d e f-. diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.tests new file mode 100755 index 00000000..2fe49b1c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.tests @@ -0,0 +1,8 @@ +if test $# = 0; then + exec "$THIS_SH" "$0" 1 abc 'd e f' +fi + +for a in "$*"; do echo ".$a."; done +for a in "$@"; do echo ".$a."; done +for a in "-$*-"; do echo ".$a."; done +for a in "-$@-"; do echo ".$a."; done diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right new file mode 100644 index 00000000..e1562ed6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right @@ -0,0 +1,5 @@ +Should be printed +Should be printed +Empty: +Empty: +Empty: diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.tests new file mode 100755 index 00000000..f305c4cd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.tests @@ -0,0 +1,19 @@ +if test $# != 0; then + exec "$THIS_SH" "$0" +fi + +# No params! +for a in "$*"; do echo Should be printed; done +for a in "$@"; do echo Should not be printed; done +# Yes, believe it or not, bash is mesmerized by "$@" and stops +# treating "" as "this word cannot be expanded to nothing, +# but must be at least null string". Now it can be expanded to nothing. +for a in "$@"""; do echo Should not be printed; done +for a in """$@"; do echo Should not be printed; done +for a in """$@"''"$@"''; do echo Should not be printed; done +for a in ""; do echo Should be printed; done + +# Bug 207: "$@" expands to nothing, and we erroneously glob "%s\n" twice: +printf 'Empty:%s\n' "$@" +printf "Empty:%s\n" "$@" +printf "Empty:%s\\n" "$@" diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick.right b/release/src/router/busybox/shell/hush_test/hush-psubst/tick.right new file mode 100644 index 00000000..6ed281c7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick.right @@ -0,0 +1,2 @@ +1 +1 diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick.tests b/release/src/router/busybox/shell/hush_test/hush-psubst/tick.tests new file mode 100755 index 00000000..1f749a9c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick.tests @@ -0,0 +1,4 @@ +true +false; echo `echo $?` +true +{ false; echo `echo $?`; } diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick2.right b/release/src/router/busybox/shell/hush_test/hush-psubst/tick2.right new file mode 100644 index 00000000..216c883b --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick2.right @@ -0,0 +1 @@ +BAZ diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick2.tests b/release/src/router/busybox/shell/hush_test/hush-psubst/tick2.tests new file mode 100755 index 00000000..db4e944f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick2.tests @@ -0,0 +1,5 @@ +if false; then + echo "FOO" + tmp=`echo BAR >&2` +fi +echo BAZ diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick3.right b/release/src/router/busybox/shell/hush_test/hush-psubst/tick3.right new file mode 100644 index 00000000..dc84e926 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick3.right @@ -0,0 +1,6 @@ +\TESTZZBEST +$TEST +Q +a\bc +a"c +done:0 diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick3.tests b/release/src/router/busybox/shell/hush_test/hush-psubst/tick3.tests new file mode 100755 index 00000000..469c43c2 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick3.tests @@ -0,0 +1,12 @@ +test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 + +TEST=Q +# \` is special +echo `echo '\'TEST\`echo ZZ\`BEST` +# \$ and \\ are special +echo `echo \\$TEST` +echo `echo \$TEST` +echo a`echo \\\\b`c +# \" etc are NOT special (passed verbatim WITH \)! +echo a`echo \"`c +echo done:$? diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick4.right b/release/src/router/busybox/shell/hush_test/hush-psubst/tick4.right new file mode 100644 index 00000000..d8030eaf --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick4.right @@ -0,0 +1,7 @@ +(TEST) BEST +TEST) BEST +((TEST) BEST +) +abc +a)c +OK: 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick4.tests b/release/src/router/busybox/shell/hush_test/hush-psubst/tick4.tests new file mode 100755 index 00000000..f2305fb3 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick4.tests @@ -0,0 +1,7 @@ +echo $(echo '(TEST)' BEST) +echo $(echo 'TEST)' BEST) +echo $(echo \(\(TEST\) BEST) +echo $(echo \)) +echo $(echo a"`echo "b"`"c ) +echo $(echo a"`echo ")"`"c ) +echo OK: $? diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.right b/release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.right new file mode 100644 index 00000000..11740f67 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.right @@ -0,0 +1,3 @@ +546ed3f5c81c780d3ab86ada14824237 - +546ed3f5c81c780d3ab86ada14824237 - +End diff --git a/release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.tests b/release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.tests new file mode 100755 index 00000000..acce92fb --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-psubst/tick_huge.tests @@ -0,0 +1,7 @@ +# This creates 120k file +yes "123456789 123456789 123456789 123456789" | head -3000 >>"$0.tmp" + +echo "`cat $0.tmp`" | md5sum +rm "$0.tmp" +yes "123456789 123456789 123456789 123456789" | head -3000 | md5sum +echo End diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/catch.right b/release/src/router/busybox/shell/hush_test/hush-trap/catch.right new file mode 100644 index 00000000..9e34c4c4 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/catch.right @@ -0,0 +1,4 @@ +sending USR2 +caught +sending USR2 +sending USR2 diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/catch.tests b/release/src/router/busybox/shell/hush_test/hush-trap/catch.tests new file mode 100755 index 00000000..d2a21d17 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/catch.tests @@ -0,0 +1,20 @@ +# avoid ugly warnings about signals not being caught +trap ":" USR1 USR2 + +"$THIS_SH" -c ' +trap "echo caught" USR2 +echo "sending USR2" +kill -USR2 $$ + +trap "" USR2 +echo "sending USR2" +kill -USR2 $$ + +trap "-" USR2 +echo "sending USR2" +kill -USR2 $$ + +echo "not reached" +' + +trap "-" USR1 USR2 diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/exit.right b/release/src/router/busybox/shell/hush_test/hush-trap/exit.right new file mode 100644 index 00000000..b4932fb7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/exit.right @@ -0,0 +1,2 @@ +cow +moo diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/exit.tests b/release/src/router/busybox/shell/hush_test/hush-trap/exit.tests new file mode 100755 index 00000000..092543c2 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/exit.tests @@ -0,0 +1,3 @@ +"$THIS_SH" -c 'trap "echo cow" 0' +"$THIS_SH" -c 'trap "echo moo" EXIT' +"$THIS_SH" -c 'trap "echo no" 0; trap 0' diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/save-ret.right b/release/src/router/busybox/shell/hush_test/hush-trap/save-ret.right new file mode 100644 index 00000000..a3e12ce5 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/save-ret.right @@ -0,0 +1,2 @@ +YEAH +0 diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/save-ret.tests b/release/src/router/busybox/shell/hush_test/hush-trap/save-ret.tests new file mode 100755 index 00000000..0786b6d9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/save-ret.tests @@ -0,0 +1,4 @@ +# make sure we do not corrupt $? across traps +trap "echo YEAH; false" USR1 +kill -USR1 $$ +echo $? diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/usage.right b/release/src/router/busybox/shell/hush_test/hush-trap/usage.right new file mode 100644 index 00000000..c0dbd6c3 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/usage.right @@ -0,0 +1,14 @@ +___ +___ +___ +trap -- 'a' EXIT +trap -- 'a' INT +trap -- 'a' USR1 +trap -- 'a' USR2 +___ +___ +trap -- 'a' USR1 +trap -- 'a' USR2 +___ +___ +trap -- 'a' USR2 diff --git a/release/src/router/busybox/shell/hush_test/hush-trap/usage.tests b/release/src/router/busybox/shell/hush_test/hush-trap/usage.tests new file mode 100755 index 00000000..d29c6e74 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-trap/usage.tests @@ -0,0 +1,23 @@ +# no output -- default state +echo ___ +trap + +# assign some traps +echo ___ +trap "a" EXIT INT USR1 USR2 + +# show them all +echo ___ +trap + +# clear one +echo ___ +trap 0 INT +echo ___ +trap + +# clear another +echo ___ +trap "-" USR1 +echo ___ +trap diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/empty.right b/release/src/router/busybox/shell/hush_test/hush-vars/empty.right new file mode 100644 index 00000000..2cb3c70f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/empty.right @@ -0,0 +1,3 @@ +a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F +a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F +a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/empty.tests b/release/src/router/busybox/shell/hush_test/hush-vars/empty.tests new file mode 100755 index 00000000..a9c247e3 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/empty.tests @@ -0,0 +1,5 @@ +e= + +echo a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F +echo 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 +echo $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/release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.right b/release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.right new file mode 100644 index 00000000..3ac7ec5f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.right @@ -0,0 +1 @@ +./glob_and_vars.right ./glob_and_vars.tests diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.tests b/release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.tests new file mode 100755 index 00000000..482cf9d8 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/glob_and_vars.tests @@ -0,0 +1,2 @@ +v=. +echo $v/glob_and_vars.[tr]* diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.right new file mode 100644 index 00000000..4d2197a5 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.right @@ -0,0 +1,8 @@ +hush: syntax error: unterminated ${name} +hush: syntax error: unterminated ${name} +_0 _0 +_ _ _ _ _ +_aaaa _ _ _word _word +_ _ _ _ _ +_ _ _ _word _ +_fff _ _ _word _word diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.tests new file mode 100755 index 00000000..dcdca86d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_alt.tests @@ -0,0 +1,22 @@ +# first try some invalid patterns (do in subshell due to parsing error) +"$THIS_SH" -c 'echo ${+} ; echo moo' +"$THIS_SH" -c 'echo ${:+} ; echo moo' + +# now some funky ones +echo _${#+} _${#:+} + +# now some valid ones +set -- +echo _$1 _${1+} _${1:+} _${1+word} _${1:+word} + +set -- aaaa +echo _$1 _${1+} _${1:+} _${1+word} _${1:+word} + +unset f +echo _$f _${f+} _${f:+} _${f+word} _${f:+word} + +f= +echo _$f _${f+} _${f:+} _${f+word} _${f:+word} + +f=fff +echo _$f _${f+} _${f:+} _${f+word} _${f:+word} diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.right new file mode 100644 index 00000000..d5b25807 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.right @@ -0,0 +1,27 @@ +hush: syntax error: unterminated ${name} +hush: syntax error: unterminated ${name} +0 +0 +hush: $1: cannot assign in this way +hush: $1: cannot assign in this way +hush: $1: cannot assign in this way +hush: $1: cannot assign in this way +_aa +_aa +_aa +_aa +_ +_ +_ +_word +_word +_ +_ +_ +_ +_word +_fff +_fff +_fff +_fff +_fff diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.tests new file mode 100755 index 00000000..149cb20d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_assign.tests @@ -0,0 +1,38 @@ +# first try some invalid patterns (do in subshell due to parsing error) +"$THIS_SH" -c 'echo ${=}' +"$THIS_SH" -c 'echo ${:=}' + +# now some funky ones +"$THIS_SH" -c 'echo ${#=}' +"$THIS_SH" -c 'echo ${#:=}' + +# should error out +"$THIS_SH" -c 'set --; echo _${1=}' +"$THIS_SH" -c 'set --; echo _${1:=}' +"$THIS_SH" -c 'set --; echo _${1=word}' +"$THIS_SH" -c 'set --; echo _${1:=word}' + +# should not error +"$THIS_SH" -c 'set aa; echo _${1=}' +"$THIS_SH" -c 'set aa; echo _${1:=}' +"$THIS_SH" -c 'set aa; echo _${1=word}' +"$THIS_SH" -c 'set aa; echo _${1:=word}' + +# should work fine +unset f; echo _$f +unset f; echo _${f=} +unset f; echo _${f:=} +unset f; echo _${f=word} +unset f; echo _${f:=word} + +f=; echo _$f +f=; echo _${f=} +f=; echo _${f:=} +f=; echo _${f=word} +f=; echo _${f:=word} + +f=fff; echo _$f +f=fff; echo _${f=} +f=fff; echo _${f:=} +f=fff; echo _${f=word} +f=fff; echo _${f:=word} diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.right new file mode 100644 index 00000000..acc71720 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.right @@ -0,0 +1,8 @@ +hush: syntax error: unterminated ${name} +hush: syntax error: unterminated ${name} +_0 _0 +_ _ _ _word _word +_aaaa _aaaa _aaaa _aaaa _aaaa +_ _ _ _word _word +_ _ _ _ _word +_fff _fff _fff _fff _fff diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.tests new file mode 100755 index 00000000..1ea05174 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_default.tests @@ -0,0 +1,22 @@ +# first try some invalid patterns (do in subshell due to parsing error) +"$THIS_SH" -c 'echo ${-}' +"$THIS_SH" -c 'echo ${:-}' + +# now some funky ones +echo _${#-} _${#:-} + +# now some valid ones +set -- +echo _$1 _${1-} _${1:-} _${1-word} _${1:-word} + +set -- aaaa +echo _$1 _${1-} _${1:-} _${1-word} _${1:-word} + +unset f +echo _$f _${f-} _${f:-} _${f-word} _${f:-word} + +f= +echo _$f _${f-} _${f:-} _${f-word} _${f:-word} + +f=fff +echo _$f _${f-} _${f:-} _${f-word} _${f:-word} diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.right new file mode 100644 index 00000000..590bb200 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.right @@ -0,0 +1,28 @@ +hush: syntax error: unterminated ${name} +0 +0 +_ +hush: 1: parameter null or not set +hush: 1: parameter null or not set +hush: 1: message1 +hush: 1: message1 +_aaaa +_aaaa +_aaaa +_aaaa +_aaaa +_ +hush: f: parameter null or not set +hush: f: parameter null or not set +hush: f: message3 +hush: f: message3 +_ +_ +hush: f: parameter null or not set +_ +hush: f: message4 +_fff +_fff +_fff +_fff +_fff diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.tests new file mode 100755 index 00000000..bccba3e1 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_indicate_error.tests @@ -0,0 +1,40 @@ +# do all of these in subshells since it's supposed to error out + +# first try some invalid patterns +#"$THIS_SH" -c 'echo ${?}' -- this is valid as it's the same as $? +"$THIS_SH" -c 'echo ${:?}' + +# then some funky ones +"$THIS_SH" -c 'echo ${#?}' +"$THIS_SH" -c 'echo ${#:?}' + +# now some valid ones +"$THIS_SH" -c 'set --; echo _$1' +"$THIS_SH" -c 'set --; echo _${1?}' +"$THIS_SH" -c 'set --; echo _${1:?}' +"$THIS_SH" -c 'set --; echo _${1?message1}' +"$THIS_SH" -c 'set --; echo _${1:?message1}' + +"$THIS_SH" -c 'set -- aaaa; echo _$1' +"$THIS_SH" -c 'set -- aaaa; echo _${1?}' +"$THIS_SH" -c 'set -- aaaa; echo _${1:?}' +"$THIS_SH" -c 'set -- aaaa; echo _${1?word}' +"$THIS_SH" -c 'set -- aaaa; echo _${1:?word}' + +"$THIS_SH" -c 'unset f; echo _$f' +"$THIS_SH" -c 'unset f; echo _${f?}' +"$THIS_SH" -c 'unset f; echo _${f:?}' +"$THIS_SH" -c 'unset f; echo _${f?message3}' +"$THIS_SH" -c 'unset f; echo _${f:?message3}' + +"$THIS_SH" -c 'f=; echo _$f' +"$THIS_SH" -c 'f=; echo _${f?}' +"$THIS_SH" -c 'f=; echo _${f:?}' +"$THIS_SH" -c 'f=; echo _${f?word}' +"$THIS_SH" -c 'f=; echo _${f:?message4}' + +"$THIS_SH" -c 'f=fff; echo _$f' +"$THIS_SH" -c 'f=fff; echo _${f?}' +"$THIS_SH" -c 'f=fff; echo _${f:?}' +"$THIS_SH" -c 'f=fff; echo _${f?word}' +"$THIS_SH" -c 'f=fff; echo _${f:?word}' diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.right new file mode 100644 index 00000000..2d633a14 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.right @@ -0,0 +1,4 @@ +0 0 +4 4 +4 3 2 1 0 0 +0 3 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.tests new file mode 100755 index 00000000..90f47d2f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_expand_len.tests @@ -0,0 +1,12 @@ +# make sure len parsing doesnt break arg count +set -- +echo $# ${#} +set -- aaaa bbb cc d +echo $# ${#} + +echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6} + +unset e +f=abc +g= +echo ${#e} ${#f} ${#g} diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_glob.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_glob.right new file mode 100644 index 00000000..bdee8fe0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_glob.right @@ -0,0 +1,4 @@ +param_glob.tests +param_glob.tests +param_glob.t* +param_glob.t* diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_glob.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_glob.tests new file mode 100755 index 00000000..801d58ee --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_glob.tests @@ -0,0 +1,10 @@ +if test $# = 0; then + #BUG in builtin_exec! will glob param! + #exec "$THIS_SH" "$0" 'param_glob.t*' + "$THIS_SH" "$0" 'param_glob.t*' + exit +fi +echo $* +echo $@ +echo "$*" +echo "$@" diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.right b/release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.right new file mode 100644 index 00000000..f3c3767d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.right @@ -0,0 +1,7 @@ +1=1 +2=2 +3=3 +4=4 +5=5 +6=6 +7=7 diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.tests b/release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.tests new file mode 100755 index 00000000..27fdc5b9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/param_subshell.tests @@ -0,0 +1,15 @@ +if test $# = 0; then + "$THIS_SH" "$0" 1 2 3 4 5 6 7 8 9 + exit +fi +echo 1=$1 +{ echo 2=$2; } +{ echo 3=$3; } & +# cant use usleep as it isnt standard in $PATH -- +# we fail when testing busybox compiled solely as "hush" +wait +( echo 4=$4 ) +( echo 5=$5 ) & +wait +true | echo 6=$6 | cat +true | { echo 7=$7; } | cat diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/star.right b/release/src/router/busybox/shell/hush_test/hush-vars/star.right new file mode 100644 index 00000000..0ecc55bc --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/star.right @@ -0,0 +1,6 @@ +.1. +.abc. +.d. +.e. +.f. +.1 abc d e f. diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/star.tests b/release/src/router/busybox/shell/hush_test/hush-vars/star.tests new file mode 100755 index 00000000..5554c409 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/star.tests @@ -0,0 +1,8 @@ +if test $# = 0; then + exec "$THIS_SH" star.tests 1 abc 'd e f' +fi +# 'd e f' should be split into 3 separate args: +for a in $*; do echo ".$a."; done + +# must produce .1 abc d e f. +for a in "$*"; do echo ".$a."; done diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/unset.right b/release/src/router/busybox/shell/hush_test/hush-vars/unset.right new file mode 100644 index 00000000..8dea7c40 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/unset.right @@ -0,0 +1,19 @@ +hush: unset: -: invalid option +1 +hush: unset: -m: invalid option +1 +0 +___ +0 f g +0 g +0 +___ +0 f g +0 +0 f g +0 +___ +hush: HUSH_VERSION: readonly variable +1 f g +hush: HUSH_VERSION: readonly variable +1 diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/unset.tests b/release/src/router/busybox/shell/hush_test/hush-vars/unset.tests new file mode 100755 index 00000000..f59ce592 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/unset.tests @@ -0,0 +1,36 @@ +# check invalid options are rejected +unset - +echo $? +unset -m a b c +echo $? + +# check funky usage +unset +echo $? + +# check normal usage +echo ___ +f=f g=g +echo $? $f $g +unset f +echo $? $f $g +unset g +echo $? $f $g + +echo ___ +f=f g=g +echo $? $f $g +unset f g +echo $? $f $g +f=f g=g +echo $? $f $g +unset -v f g +echo $? $f $g + +# check read only vars +echo ___ +f=f g=g +unset HUSH_VERSION +echo $? $f $g +unset f HUSH_VERSION g +echo $? $f $g diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var1.right b/release/src/router/busybox/shell/hush_test/hush-vars/var1.right new file mode 100644 index 00000000..194e7dbe --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var1.right @@ -0,0 +1,4 @@ +http://busybox.net +http://busybox.net_abc +1 1 +1 1 diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var1.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var1.tests new file mode 100755 index 00000000..48a6782b --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var1.tests @@ -0,0 +1,9 @@ +URL=http://busybox.net + +echo $URL +echo ${URL}_abc + +true +false; echo $? ${?} +true +{ false; echo $? ${?}; } diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var2.right b/release/src/router/busybox/shell/hush_test/hush-vars/var2.right new file mode 100644 index 00000000..40bf4bff --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var2.right @@ -0,0 +1,2 @@ +http://busybox.net +http://busybox.net_abc diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var2.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var2.tests new file mode 100755 index 00000000..1292410f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var2.tests @@ -0,0 +1,4 @@ +_1=http://busybox.net + +echo $_1 +echo ${_1}_abc diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var3.right b/release/src/router/busybox/shell/hush_test/hush-vars/var3.right new file mode 100644 index 00000000..5e28d2fa --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var3.right @@ -0,0 +1,2 @@ +hush: syntax error: unterminated ${name} +hush: syntax error: unterminated ${name} diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var3.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var3.tests new file mode 100755 index 00000000..aea36d62 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var3.tests @@ -0,0 +1,4 @@ +# reject invalid vars +"$THIS_SH" -c 'echo ${1q}' +"$THIS_SH" -c 'echo ${&}' +#"$THIS_SH" -c 'echo ${$}' -- this is valid as it's the same as $$ diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.right new file mode 100644 index 00000000..352210d7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.right @@ -0,0 +1,5 @@ +. . +.abc d e. +.abc d e. +.abc d e. +.abc d e. diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.tests new file mode 100755 index 00000000..18cdc74c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_assign.tests @@ -0,0 +1,15 @@ +if test $# = 0; then + exec "$THIS_SH" "$0" abc "d e" +fi + +space=' ' +echo .$space. + +a=$* +echo .$a. +a=$@ +echo .$a. +a="$*" +echo .$a. +a="$@" +echo .$a. diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.right new file mode 100644 index 00000000..423299c9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.right @@ -0,0 +1,3 @@ +TEST1 +TEST2 +TEST3 diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.tests new file mode 100755 index 00000000..bda6bdd7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_expand_in_redir.tests @@ -0,0 +1,13 @@ +if test $# = 0; then + exec "$THIS_SH" "$0" abc "d e" +fi + +echo TEST1 >"$1.out" +echo TEST2 >"$2.out" +# bash says: "$@.out": ambiguous redirect +# ash handles it as if it is '$*' - we do the same +echo TEST3 >"$@.out" + +cat abc.out "d e.out" "abc d e.out" + +rm abc.out "d e.out" "abc d e.out" diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.right new file mode 100644 index 00000000..faf65bed --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.right @@ -0,0 +1,6 @@ +b=1 +b=2 +b=3 +b=4 +b=5 +b=6 diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.tests new file mode 100755 index 00000000..3f8cd272 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_in_pipes.tests @@ -0,0 +1,7 @@ +b=1 env | grep ^b= +true | b=2 env | grep ^b= +a=1 true | b=3 env | grep ^b= + +(b=4 env) | grep ^b= +(true | b=5 env) | grep ^b= +(a=1 true | b=6 env) | grep ^b= diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.right new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.right @@ -0,0 +1 @@ +OK diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.tests new file mode 100755 index 00000000..27c8c650 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_leaks.tests @@ -0,0 +1,14 @@ +# external program +a=b /bin/true +env | grep ^a= + +# builtin +a=b true +env | grep ^a= + +# exec with redirection only +# in bash, this leaks! +a=b exec 1>&1 +env | grep ^a= + +echo OK diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.right new file mode 100644 index 00000000..373b16ca --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.right @@ -0,0 +1,33 @@ +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +Empty: +abcdcd +abcdcd +abcdcd +cdcd +babcdcd +babcdcd +ababcdcd +Empty: +ababcd +ababcd +ababcd +abab +ababcdc +ababcdc +ababcdcd +Empty: +end diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.tests new file mode 100755 index 00000000..0ce531d6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_posix1.tests @@ -0,0 +1,43 @@ +unset var + +echo Empty:${var#} +echo Empty:${var##} +echo Empty:${var#*} +echo Empty:${var##*} +echo Empty:${var%} +echo Empty:${var%%} +echo Empty:${var%*} +echo Empty:${var%%*} + +var= + +echo Empty:${var#} +echo Empty:${var##} +echo Empty:${var#*} +echo Empty:${var##*} +echo Empty:${var%} +echo Empty:${var%%} +echo Empty:${var%*} +echo Empty:${var%%*} + +var=ababcdcd + +echo ${var#ab} +echo ${var##ab} +echo ${var#a*b} +echo ${var##a*b} +echo ${var#?} +echo ${var##?} +echo ${var#*} +echo Empty:${var##*} + +echo ${var%cd} +echo ${var%%cd} +echo ${var%c*d} +echo ${var%%c*d} +echo ${var%?} +echo ${var%%?} +echo ${var%*} +echo Empty:${var%%*} + +echo end diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.right new file mode 100644 index 00000000..2a9917c9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.right @@ -0,0 +1,4 @@ +a=b +a=b +a=b +OK diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.tests new file mode 100755 index 00000000..1bddd870 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_preserved.tests @@ -0,0 +1,16 @@ +export a=b + +# external program +a=c /bin/true +env | grep ^a= + +# builtin +a=d true +env | grep ^a= + +# exec with redirection only +# in bash, this leaks! +a=e exec 1>&1 +env | grep ^a= + +echo OK diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.right b/release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.right new file mode 100644 index 00000000..c8aca1c1 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.right @@ -0,0 +1,40 @@ +Testing: in x y z +.x. +.y. +.z. +Testing: in u $empty v +.u. +.v. +Testing: in u " $empty" v +.u. +. . +.v. +Testing: in u $empty $empty$a v +.u. +.a. +.v. +Testing: in $a_b +.a. +.b. +Testing: in $* +.abc. +.d. +.e. +Testing: in $@ +.abc. +.d. +.e. +Testing: in -$*- +.-abc. +.d. +.e-. +Testing: in -$@- +.-abc. +.d. +.e-. +Testing: in $a_b -$a_b- +.a. +.b. +.-a. +.b-. +Finished diff --git a/release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.tests b/release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.tests new file mode 100755 index 00000000..433c6062 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-vars/var_subst_in_for.tests @@ -0,0 +1,40 @@ +if test $# = 0; then + exec "$THIS_SH" "$0" abc "d e" +fi + +echo 'Testing: in x y z' +for a in x y z; do echo ".$a."; done + +echo 'Testing: in u $empty v' +empty='' +for a in u $empty v; do echo ".$a."; done + +echo 'Testing: in u " $empty" v' +empty='' +for a in u " $empty" v; do echo ".$a."; done + +echo 'Testing: in u $empty $empty$a v' +a='a' +for a in u $empty $empty$a v; do echo ".$a."; done + +echo 'Testing: in $a_b' +a_b='a b' +for a in $a_b; do echo ".$a."; done + +echo 'Testing: in $*' +for a in $*; do echo ".$a."; done + +echo 'Testing: in $@' +for a in $@; do echo ".$a."; done + +echo 'Testing: in -$*-' +for a in -$*-; do echo ".$a."; done + +echo 'Testing: in -$@-' +for a in -$@-; do echo ".$a."; done + +echo 'Testing: in $a_b -$a_b-' +a_b='a b' +for a in $a_b -$a_b-; do echo ".$a."; done + +echo Finished diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.right b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.right new file mode 100644 index 00000000..c6f0334f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.right @@ -0,0 +1,3 @@ +Warm up +Measuring memory leak... +Ok diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.tests b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.tests new file mode 100755 index 00000000..21fdb0d1 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all1.tests @@ -0,0 +1,145 @@ +# "Check many leaks" test #1 +# Cramming all kinds of weird commands in here. +# As you find leaks, please create separate, small test +# for each leak. +# Narrowing down the leak using this large test may be difficult. +# It is intended to be a blanket "is everything ok?" test + +echo "Warm up" +i=1 +l=1 +t=1 +export t +while test $i != 99; do + t=value1_$i; t=value2_$i true; t=value3_$i /bin/true; t=value4_$i exec 1>&1 + { t=value3_$i /bin/true; } >/dev/null; true; then + : << HERE >/dev/null; true <>/foo/bar + fi + { : /bin/*; } + unset var + echo >/dev/null ${var#} + echo >/dev/null ${var##} + echo >/dev/null ${var#*} + echo >/dev/null ${var##*} + echo >/dev/null ${var%} + echo >/dev/null ${var%%} + echo >/dev/null ${var%*} + echo >/dev/null ${var%%*} + var= + echo >/dev/null ${var#} + echo >/dev/null ${var##} + echo >/dev/null ${var#*} + echo >/dev/null ${var##*} + echo >/dev/null ${var%} + echo >/dev/null ${var%%} + echo >/dev/null ${var%*} + echo >/dev/null ${var%%*} + var=ababcdcd + echo >/dev/null ${var#ab} + echo >/dev/null ${var##ab} + echo >/dev/null ${var#a*b} + echo >/dev/null ${var##a*b} + echo >/dev/null ${var#?} + echo >/dev/null ${var##?} + echo >/dev/null ${var#*} + echo >/dev/null ${var##*} + echo >/dev/null ${var%cd} + echo >/dev/null ${var%%cd} + echo >/dev/null ${var%c*d} + echo >/dev/null ${var%%c*d} + echo >/dev/null ${var%?} + echo >/dev/null ${var%%?} + echo >/dev/null ${var%*} + echo >/dev/null ${var%%*} + set -- par1_$i par2_$i par3_$i par4_$i + trap "echo trap$i" WINCH + f() { true; true; true; true; true; true; true; true; } + f() { true; true; true; true; true; true; true; true; echo $1; } + f >/dev/null + : $((i++)) +done + +memleak + +echo "Measuring memory leak..." +# Please copy the entire block from above verbatim +i=1 +l=1 +t=1 +export t +while test $i != 99; do + t=value1_$i; t=value2_$i true; t=value3_$i /bin/true; t=value4_$i exec 1>&1 + { t=value3_$i /bin/true; } >/dev/null; true; then + : << HERE >/dev/null; true <>/foo/bar + fi + { : /bin/*; } + unset var + echo >/dev/null ${var#} + echo >/dev/null ${var##} + echo >/dev/null ${var#*} + echo >/dev/null ${var##*} + echo >/dev/null ${var%} + echo >/dev/null ${var%%} + echo >/dev/null ${var%*} + echo >/dev/null ${var%%*} + var= + echo >/dev/null ${var#} + echo >/dev/null ${var##} + echo >/dev/null ${var#*} + echo >/dev/null ${var##*} + echo >/dev/null ${var%} + echo >/dev/null ${var%%} + echo >/dev/null ${var%*} + echo >/dev/null ${var%%*} + var=ababcdcd + echo >/dev/null ${var#ab} + echo >/dev/null ${var##ab} + echo >/dev/null ${var#a*b} + echo >/dev/null ${var##a*b} + echo >/dev/null ${var#?} + echo >/dev/null ${var##?} + echo >/dev/null ${var#*} + echo >/dev/null ${var##*} + echo >/dev/null ${var%cd} + echo >/dev/null ${var%%cd} + echo >/dev/null ${var%c*d} + echo >/dev/null ${var%%c*d} + echo >/dev/null ${var%?} + echo >/dev/null ${var%%?} + echo >/dev/null ${var%*} + echo >/dev/null ${var%%*} + set -- par1_$i par2_$i par3_$i par4_$i + trap "echo trap$i" WINCH + f() { true; true; true; true; true; true; true; true; } + f() { true; true; true; true; true; true; true; true; echo $1; } + f >/dev/null + : $((i++)) +done + + +memleak +kb=$? +# Observed some variability, bumped to 12k +if test $kb -le 12; then + echo Ok #$kb +else + echo "Bad: $kb kb (or more) leaked" +fi diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.right b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.right new file mode 100644 index 00000000..c6f0334f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.right @@ -0,0 +1,3 @@ +Warm up +Measuring memory leak... +Ok diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.tests b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.tests new file mode 100755 index 00000000..d51ea806 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_all2.tests @@ -0,0 +1,93 @@ +# "Check many leaks" test #2 +# Cramming all kinds of weird commands in here. +# As you find leaks, please create separate, small test +# for each leak. +# Narrowing down the leak using this large test may be difficult. +# It is intended to be a blanket "is everything ok?" test + +echo "Warm up" +local_var="local val" +export dev_null="/dev/null" +>$dev_null +echo hi1 $local_var `echo ho` >>/dev/null +echo hi2 $local_var &- | cat 1<>/dev/null +{ echo hi4 $local_var `echo ho` 1<>/dev/null; } +( echo hi4 $local_var `echo ho` 1<>/dev/null ) +if echo $local_var; false + then echo not run + elif false <$dev_null + then none + else cat 0<>$dev_null 1<>"$dev_null" +fi >>/dev/null +{ + if echo $local_var; then cat <>/dev/null +} 1<>/dev/null +while { echo $dev_null >>$dev_null; }; do cat <"$dev_null"; break; done +( until { echo $dev_null >>$dev_null | false; }; do cat <"$dev_null"; break; done ) <$dev_null +f() { echo $1; } +f >/dev/null + +memleak + +echo "Measuring memory leak..." +# Please copy the entire block from above verbatim +local_var="local val" +export dev_null="/dev/null" +>$dev_null +echo hi1 $local_var `echo ho` >>/dev/null +echo hi2 $local_var &- | cat 1<>/dev/null +{ echo hi4 $local_var `echo ho` 1<>/dev/null; } +( echo hi4 $local_var `echo ho` 1<>/dev/null ) +if echo $local_var; false + then echo not run + elif false <$dev_null + then none + else cat 0<>$dev_null 1<>"$dev_null" +fi >>/dev/null +{ + if echo $local_var; then cat <>/dev/null +} 1<>/dev/null +while { echo $dev_null >>$dev_null; }; do cat <"$dev_null"; break; done +( until { echo $dev_null >>$dev_null | false; }; do cat <"$dev_null"; break; done ) <$dev_null +f() { echo $1; } +f >/dev/null + +# And same again + +local_var="local val" +export dev_null="/dev/null" +>$dev_null +echo hi1 $local_var `echo ho` >>/dev/null +echo hi2 $local_var &- | cat 1<>/dev/null +{ echo hi4 $local_var `echo ho` 1<>/dev/null; } +( echo hi4 $local_var `echo ho` 1<>/dev/null ) +if echo $local_var; false + then echo not run + elif false <$dev_null + then none + else cat 0<>$dev_null 1<>"$dev_null" +fi >>/dev/null +{ + if echo $local_var; then cat <>/dev/null +} 1<>/dev/null +while { echo $dev_null >>$dev_null; }; do cat <"$dev_null"; break; done +( until { echo $dev_null >>$dev_null | false; }; do cat <"$dev_null"; break; done ) <$dev_null +f() { echo $1; } +f >/dev/null + +memleak +kb=$? +if test $kb -le 4; then + echo Ok #$kb +else + echo "Bad: $kb kb (or more) leaked" +fi diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.right b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.right new file mode 100644 index 00000000..c6f0334f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.right @@ -0,0 +1,3 @@ +Warm up +Measuring memory leak... +Ok diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.tests b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.tests new file mode 100755 index 00000000..26cbb28a --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_heredoc1.tests @@ -0,0 +1,34 @@ +echo "Warm up" +i=1 +while test $i != 99; do + : <&1 + i=1$i + if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi + if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi + if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi + if test $i = 1111111111111111111111111111111111111111111114; then i=X; fi +done + +memleak + +echo "Measuring memory leak..." +i=1 +while test $i != X; do + t=111111111111111111111111111111111111111111111111111111111111111111111110$i + t=111111111111111111111111111111111111111111111111111111111111111111111111$i true + t=111111111111111111111111111111111111111111111111111111111111111111111112$i /bin/true + t=111111111111111111111111111111111111111111111111111111111111111111111113$i exec 1>&1 + i=1$i + if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi + if test $i = 1111111111111111111111111111111111111111111112; then i=3; fi + if test $i = 1111111111111111111111111111111111111111111113; then i=4; fi + if test $i = 1111111111111111111111111111111111111111111114; then i=X; fi +done + +memleak +kb=$? +if test $kb -le 4; then + echo Ok +else + echo "Bad: $kb kb (or more) leaked" +fi diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.right b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.right new file mode 100644 index 00000000..c6f0334f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.right @@ -0,0 +1,3 @@ +Warm up +Measuring memory leak... +Ok diff --git a/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.tests b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.tests new file mode 100755 index 00000000..9554c42c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-z_slow/leak_var3.tests @@ -0,0 +1,41 @@ +# Was seen leaking on NOMMU build + +echo "Warm up" +i=1; t=1; export t +while test $i != 400; do + t=valueA_$i true + : $((i++)) +done + +memleak +echo "Measuring memory leak..." + +# Please copy the entire block from above verbatim +i=1; t=1; export t +while test $i != 400; do + t=valueA_$i true + : $((i++)) +done +i=1; t=1; export t +while test $i != 400; do + t=valueA_$i true + : $((i++)) +done +i=1; t=1; export t +while test $i != 400; do + t=valueA_$i true + : $((i++)) +done +i=1; t=1; export t +while test $i != 400; do + t=valueA_$i true + : $((i++)) +done + +memleak +kb=$? +if test $kb -le 4; then + echo Ok #$kb +else + echo "Bad: $kb kb (or more) leaked" +fi diff --git a/release/src/router/busybox/shell/hush_test/run-all b/release/src/router/busybox/shell/hush_test/run-all new file mode 100755 index 00000000..57a5c253 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/run-all @@ -0,0 +1,89 @@ +#!/bin/sh + +unset LANG LANGUAGE +unset LC_COLLATE +unset LC_CTYPE +unset LC_MONETARY +unset LC_MESSAGES +unset LC_NUMERIC +unset LC_TIME +unset LC_ALL + +test -x hush || { + echo "No ./hush - creating a link to ../../busybox" + ln -s ../../busybox hush +} +if test -e ../../.config ; then + eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' ../../.config) +fi + +PATH="$PWD:$PATH" # for hush and recho/zecho/printenv +export PATH + +THIS_SH="$PWD/hush" +export THIS_SH + +do_test() +{ + test -d "$1" || return 0 + d=${d%/} +# echo Running tests in directory "$1" + ( + tret=0 + cd "$1" || { echo "cannot cd $1!"; exit 1; } + for x in run-*; do + test -f "$x" || continue + case "$x" in + "$0"|run-minimal|run-gprof) ;; + *.orig|*~) ;; + #*) echo $x ; sh $x ;; + *) + sh "$x" >"../$1-$x.fail" 2>&1 && \ + { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail"; + ;; + esac + done + # Many bash run-XXX scripts just do this, + # no point in duplication it all over the place + for x in *.tests; do + test -x "$x" || continue + name="${x%%.tests}" + test -f "$name.right" || continue +# echo Running test: "$x" + ( + "$THIS_SH" "./$x" >"$name.xx" 2>&1 + test $? -eq 77 && rm -f "../$1-$x.fail" && exit 77 + diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" + ) + case $? in + 0) echo "$1/$x: ok";; + 77) echo "$1/$x: skip (feature disabled)";; + *) echo "$1/$x: fail"; tret=1;; + esac + done + exit ${tret} + ) +} + +# Main part of this script +# Usage: run-all [directories] + +ret=0 + +if [ $# -lt 1 ]; then + # All sub directories + modules=`ls -d hush-*` + + for module in $modules; do + do_test $module || ret=1 + done +else + while [ $# -ge 1 ]; do + if [ -d $1 ]; then + do_test $1 || ret=1 + fi + shift + done +fi + +exit ${ret} -- cgit v1.2.3-54-g00ecf