Commit Graph

92 Commits

Author SHA1 Message Date
Mike Frysinger
b509c9c670 add a pathological test case for here doc related to eof marker and other ugly corner cases 2009-04-07 06:06:05 +00:00
Mike Frysinger
a4f331d3c3 implement support for parameter substitution via #/% operators 2009-04-07 06:03:22 +00:00
Denis Vlasenko
6c9be7f451 hush: heredoc support, based on patch by Mike Frysinger (vapier AT gentoo.org)
some TODOs are to be attacked later

function                                             old     new   delta
parse_stream                                        1461    1866    +405
parse_redirect                                         -     265    +265
setup_heredoc                                          -     116    +116
setup_redirects                                      151     196     +45
builtin_exit                                          49      47      -2
redirect_opt_num                                      61      55      -6
setup_redirect                                       212       -    -212
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/2 up/down: 831/-220)          Total: 611 bytes
2009-04-07 02:29:51 +00:00
Denis Vlasenko
0e15138c03 hush: fix "if false; then...fi" exitcode;
trim "keyword"-less hush by 10 bytes
2009-04-06 18:40:31 +00:00
Denis Vlasenko
4ed67dd3d5 make hush-misc/*.tests executable 2009-04-06 18:10:20 +00:00
Denis Vlasenko
cd418a2670 hush: fix a bunch of obscure while/until/continue bugs
function                                             old     new   delta
run_list                                            1159    1214     +55
done_pipe                                            106     123     +17
done_command                                          86      98     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 84/0)               Total: 84 bytes
2009-04-06 18:08:35 +00:00
Denis Vlasenko
8f8d013afc *.tests should be executable 2009-04-06 16:27:51 +00:00
Denis Vlasenko
715f712d15 move hush-parsing/and-or.tests to hush-misc/*
(which probably needs to be renamed to hush-execution...)
2009-04-06 16:17:51 +00:00
Mike Frysinger
3a64833eb9 add some brute force logic tests 2009-04-06 14:22:54 +00:00
Mike Frysinger
3c7167b508 add tests for basic fd open/close/dupe 2009-04-06 12:36:10 +00:00
Mike Frysinger
9052600feb fix redir1 tests -- usleep isnt standard in $PATH 2009-04-06 12:34:27 +00:00
Denis Vlasenko
c3ff48b921 fixing mode on hush-leak/leak_argv1.tests 2009-04-05 02:14:59 +00:00
Denis Vlasenko
8a496d5db0 fixing mode on hush-leak/leak_argv1.tests 2009-04-05 02:14:37 +00:00
Denis Vlasenko
30db43b5c5 hush: fix passing of $n on NOMMU 2009-04-05 02:10:39 +00:00
Denis Vlasenko
552433bc5a hush: fix "var=val >file" not creating file
function                                             old     new   delta
static.null_ptr                                        -       4      +4
run_list                                            2018    2020      +2
handle_dollar                                        667     626     -41
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 6/-41)             Total: -35 bytes
2009-04-04 19:29:21 +00:00
Denis Vlasenko
db2a9b683a hush: finally make cmd safe on NOMMU
function                                             old     new   delta
generate_stream_from_string                            -     157    +157
expand_variables                                    2050    2003     -47
generate_stream_from_list                            139       -    -139
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 157/-186)          Total: -29 bytes
2009-04-03 22:31:18 +00:00
Denis Vlasenko
b6e6556b31 hush: improve parse_stream: does not require parsing context struct;
cleans up on syntax errors (we used to leak memory in this case);
 much simplified interface to the rest of hush.

function                                             old     new   delta
parse_stream                                        1204    1447    +243
done_word                                            658     669     +11
static_get                                            22      28      +6
builtin_source                                        84      89      +5
parse_and_run_file                                    27      30      +3
parse_and_run_string                                  31      27      -4
builtin_eval                                          55      50      -5
hush_main                                            991     985      -6
free_pipe_list                                        39      31      -8
free_pipe                                            210     189     -21
expand_variables                                    2242    2199     -43
parse_and_run_stream                                 289     153    -136
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 268/-223)           Total: 45 bytes
2009-04-03 16:49:04 +00:00
Denis Vlasenko
3718168b87 hush: fix bug with local environment vars in pipes; simplify parse_stream()
function                                             old     new   delta
parse_stream                                        1238    1218     -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-20)             Total: -20 bytes
2009-04-03 03:19:15 +00:00
Mike Frysinger
a36258f288 trim trailing slashes from specified subdir so we output to the right place 2009-04-02 22:46:52 +00:00
Denis Vlasenko
b7aaae9052 hush: rename ->o_quote to ->o_escape
hush_test/hush-arith/*: new tests for arithmetic evaluation
2009-04-02 20:17:49 +00:00
Denis Vlasenko
d308106245 hust_test/*: use "$THIS_SH" instead of hush 2009-03-31 22:14:32 +00:00
Mike Frysinger
d690f68554 implement unset semantics as required by POSIX 2009-03-30 06:50:54 +00:00
Mike Frysinger
681a4b7f06 enable trap tests 2009-03-29 23:49:46 +00:00
Mike Frysinger
fd303b11ef add test cases for trap ... but disabled for now until trap support is committed 2009-03-29 09:54:40 +00:00
Mike Frysinger
0b87e4ad15 test for invalid named variables 2009-03-28 21:06:38 +00:00
Denis Vlasenko
e61f07f036 remove ((expr)) bash'ism 2009-03-28 19:31:34 +00:00
Mike Frysinger
78f9d8eb7a add hush tests for parameter expansion 2009-03-28 18:55:34 +00:00
Mike Frysinger
42ab86520e make sure we exit based on test failure rather than always exiting with 0 2009-03-28 15:43:47 +00:00
Denis Vlasenko
e1300f6fc7 hush: fix segv at repeated "set -- a b c" + "shift" 2009-03-22 11:41:18 +00:00
Denis Vlasenko
feecc7b74e hush: tweak testsuite 2009-03-20 12:12:33 +00:00
Denis Vlasenko
a8b6dff97f hush: fix bug 207 and "hush -c" parameter passing.
Now hush -c 'printf "%s\n" "$@"' (prints "\n")
 and hush -c 'printf "%s\n" "$@"' qwe asd (prints "asd\n")
 both work correctly
2009-03-20 12:05:14 +00:00
Denis Vlasenko
f886fd2bc7 hush: fix NOMMU bug (analogous to preceding commit for MMU) 2008-10-13 12:36:05 +00:00
Denis Vlasenko
d29084dd7d testcase for the last fix 2008-10-13 08:54:42 +00:00
Denis Vlasenko
afd7a8d744 hush: fix environment and memory leaks, add tests for them
function                                             old     new   delta
add_malloced_string_to_strings                         -     110    +110
run_list                                            1999    2086     +87
free_strings_and_unsetenv                              -      87     +87
hush_version_str                                       -      18     +18
pseudo_exec_argv                                     139     146      +7
static.version_str                                    17       -     -17
free_pipe                                            237     210     -27
done_word                                            790     642    -148
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/2 up/down: 309/-192)          Total: 117 bytes
2008-10-09 16:29:44 +00:00
Denis Vlasenko
2b576b8e76 hush: fix mishandling of a'b'c=fff as assignments. They are not.
function                                             old     new   delta
parse_stream                                        1920    2004     +84
done_word                                            715     752     +37
parse_and_run_stream                                 328     333      +5
builtin_exec                                          25      29      +4
pseudo_exec_argv                                     138     139      +1
run_list                                            2006    1999      -7
is_assignment                                        215     134     -81
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/2 up/down: 131/-88)            Total: 43 bytes
2008-08-04 00:46:07 +00:00
Denis Vlasenko
d498131168 hush: support $_NUMBERS variable names 2008-07-31 10:34:48 +00:00
Denis Vlasenko
f173607520 hush: fix "case ... in <newline> word)..." 2008-07-31 10:09:26 +00:00
Denis Vlasenko
4554b721ad hush: small fix for repeated continue and fix for wrong loop depth count
after Ctrl-C; with testcase for first one
2008-07-29 13:36:09 +00:00
Denis Vlasenko
fcf37c3183 hush: fix break'ing out of {} and () groups; with testcase
function                                             old     new   delta
builtin_break                                         93     129     +36
builtin_continue                                      21      47     +26
run_list                                            1973    1976      +3
2008-07-29 11:37:15 +00:00
Denis Vlasenko
dadfb4975b hush: add #defines to switch off break/continue if loops are not supported
*: remove a few inline keywords
no code changes
2008-07-29 10:16:05 +00:00
Denis Vlasenko
918a34b9e0 hush: fix "while false; ..." exitcode; add testsuites 2008-07-28 23:17:31 +00:00
Denis Vlasenko
6a2d40f239 hush: support "break N" and "continue N"
fix non-detection of builtins and applets in "v=break; ...; $v; ..." case
 add testsuite entries for the above

function                                             old     new   delta
builtin_break                                         12      93     +81
run_list                                            1948    1971     +23
builtin_continue                                      12      21      +9
pseudo_exec_argv                                     132     138      +6
builtin_exec                                          23      25      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 121/0)             Total: 121 bytes
2008-07-28 23:07:06 +00:00
Denis Vlasenko
be709c24d4 hush: finish and enable optional case...esac support. Code size cost:
function                                             old     new   delta
run_list                                            1891    2075    +184
parse_stream                                        1764    1847     +83
expand_strvec_to_string                                -      83     +83
done_word                                            647     715     +68
static.reserved_list                                 144     168     +24
static.reserved_match                                  -      12     +12
done_pipe                                             95     105     +10
builtin_exit                                          48      46      -2
builtin_eval                                         127      54     -73
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/2 up/down: 464/-75)           Total: 389 bytes
2008-07-28 00:01:16 +00:00
Denis Vlasenko
733e3fbc2f hush: support "for if in do done then; do echo $if; done" case
function                                             old     new   delta
done_pipe                                             83      95     +12
parse_stream                                        1758    1764      +6
done_word                                            674     647     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 18/-27)             Total: -9 bytes
2008-07-06 10:01:13 +00:00
Denis Vlasenko
ff182a3d68 hush: support "for v; do ... done" syntax (implied 'in "$@"') 2008-07-05 20:29:59 +00:00
Denis Vlasenko
afdcd12ed7 hush: fix a case where "$@" must expand to no word at all 2008-07-05 17:40:04 +00:00
Denis Vlasenko
1ba323e5b6 cosmetics in hush testsuites 2008-06-18 17:53:57 +00:00
Denis Vlasenko
324a3fdf87 fix globbing in unquoted $* and $@ 2008-06-18 17:49:58 +00:00
Denis Vlasenko
ab876cd107 hush: add testsuite for "no globbing in redirection" rule.
simplify redirection habdling
2008-06-18 16:29:32 +00:00
Denis Vlasenko
985de15bf3 hush: expand quote3.tests and move from hush-bugs to hush-parsing 2008-06-18 09:22:31 +00:00