diff options
Diffstat (limited to 'bin/sh')
206 files changed, 2848 insertions, 0 deletions
diff --git a/bin/sh/Makefile b/bin/sh/Makefile new file mode 100644 index 000000000000..8e36e6df6c88 --- /dev/null +++ b/bin/sh/Makefile @@ -0,0 +1,21 @@ +# $NetBSD: Makefile,v 1.4 2014/09/11 18:25:30 dholland Exp $ +# + +.include <bsd.own.mk> + +TESTSDIR = ${TESTSBASE}/bin/sh + +TESTS_SUBDIRS += dotcmd + +TESTS_SH= t_compexit +TESTS_SH+= t_exit +TESTS_SH+= t_expand +TESTS_SH+= t_evaltested +TESTS_SH+= t_fsplit +TESTS_SH+= t_here +TESTS_SH+= t_set_e +TESTS_SH+= t_ulimit +TESTS_SH+= t_varquote +TESTS_SH+= t_wait + +.include <bsd.test.mk> diff --git a/bin/sh/dotcmd/Makefile b/bin/sh/dotcmd/Makefile new file mode 100644 index 000000000000..fa9376237e2f --- /dev/null +++ b/bin/sh/dotcmd/Makefile @@ -0,0 +1,40 @@ +# $NetBSD: Makefile,v 1.2 2014/07/27 14:24:17 apb Exp $ +# + +.include <bsd.own.mk> + +TESTSDIR = ${TESTSBASE}/bin/sh/dotcmd + +TESTS_SH = t_dotcmd + +FILESDIR = ${TESTSDIR}/out + +# Testing scripts: dotcmd in various scopes includes a file with +# return / break / continue in various scopes. +# +.for cmd_scope in case compound file for func subshell until while +. for cmd in return break continue +FILES += ${cmd}_${cmd_scope} +FILESDIR_${cmd}_${cmd_scope} = ${TESTSDIR} +FILESBUILD_${cmd}_${cmd_scope} = yes + +${cmd}_${cmd_scope}: scoped_command + ${HOST_SH} ${.CURDIR}/scoped_command '${cmd_scope}' '${cmd}' '${cmd}' \ + >'${.TARGET}' + +. for dot_scope in case compound file for func subshell until while +FILES += \ + ${dot_scope}_${cmd}_${cmd_scope} \ + out/${dot_scope}_${cmd}_${cmd_scope}.out +FILESDIR_${dot_scope}_${cmd}_${cmd_scope} = ${TESTSDIR} +FILESBUILD_${dot_scope}_${cmd}_${cmd_scope} = yes +FILESMODE_${dot_scope}_${cmd}_${cmd_scope} = ${BINMODE} + +${dot_scope}_${cmd}_${cmd_scope}: scoped_command + ${HOST_SH} ${.CURDIR}/scoped_command '${dot_scope}' \ + '. "${cmd}_${cmd_scope}"' 'dotcmd' 'dotcmd' >'${.TARGET}' +. endfor +. endfor +.endfor + +.include <bsd.test.mk> diff --git a/bin/sh/dotcmd/out/case_break_case.out b/bin/sh/dotcmd/out/case_break_case.out new file mode 100644 index 000000000000..4c4205563e80 --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_case.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before case +before break +after break, return value: 0 +after case +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_compound.out b/bin/sh/dotcmd/out/case_break_compound.out new file mode 100644 index 000000000000..01113ca97a69 --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_compound.out @@ -0,0 +1,8 @@ +before case +before dotcmd +compound start +before break +after break, return value: 0 +compound end +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_file.out b/bin/sh/dotcmd/out/case_break_file.out new file mode 100644 index 000000000000..52640203d8da --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_file.out @@ -0,0 +1,6 @@ +before case +before dotcmd +before break +after break, return value: 0 +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_for.out b/bin/sh/dotcmd/out/case_break_for.out new file mode 100644 index 000000000000..e116ee2b6a66 --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_for.out @@ -0,0 +1,7 @@ +before case +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_func.out b/bin/sh/dotcmd/out/case_break_func.out new file mode 100644 index 000000000000..906a804d2185 --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_func.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before function +before break +after break +after function +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_subshell.out b/bin/sh/dotcmd/out/case_break_subshell.out new file mode 100644 index 000000000000..073caff318ba --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_subshell.out @@ -0,0 +1,8 @@ +before case +before dotcmd +subshell start +before break +after break, return value: 0 +subshell end +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_until.out b/bin/sh/dotcmd/out/case_break_until.out new file mode 100644 index 000000000000..f47bd43cccba --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_until.out @@ -0,0 +1,7 @@ +before case +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_break_while.out b/bin/sh/dotcmd/out/case_break_while.out new file mode 100644 index 000000000000..e9a73f8112b1 --- /dev/null +++ b/bin/sh/dotcmd/out/case_break_while.out @@ -0,0 +1,7 @@ +before case +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_case.out b/bin/sh/dotcmd/out/case_continue_case.out new file mode 100644 index 000000000000..7919427ae304 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_case.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before case +before continue +after continue, return value: 0 +after case +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_compound.out b/bin/sh/dotcmd/out/case_continue_compound.out new file mode 100644 index 000000000000..9195e0889eb9 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_compound.out @@ -0,0 +1,8 @@ +before case +before dotcmd +compound start +before continue +after continue, return value: 0 +compound end +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_file.out b/bin/sh/dotcmd/out/case_continue_file.out new file mode 100644 index 000000000000..100a5906f0a4 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_file.out @@ -0,0 +1,6 @@ +before case +before dotcmd +before continue +after continue, return value: 0 +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_for.out b/bin/sh/dotcmd/out/case_continue_for.out new file mode 100644 index 000000000000..9a078d0abc1e --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_for.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_func.out b/bin/sh/dotcmd/out/case_continue_func.out new file mode 100644 index 000000000000..6282c89d7437 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_func.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before function +before continue +after continue +after function +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_subshell.out b/bin/sh/dotcmd/out/case_continue_subshell.out new file mode 100644 index 000000000000..b066ab64b7d7 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_subshell.out @@ -0,0 +1,8 @@ +before case +before dotcmd +subshell start +before continue +after continue, return value: 0 +subshell end +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_until.out b/bin/sh/dotcmd/out/case_continue_until.out new file mode 100644 index 000000000000..afc85b6561a1 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_until.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_continue_while.out b/bin/sh/dotcmd/out/case_continue_while.out new file mode 100644 index 000000000000..cb4137d23391 --- /dev/null +++ b/bin/sh/dotcmd/out/case_continue_while.out @@ -0,0 +1,8 @@ +before case +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_case.out b/bin/sh/dotcmd/out/case_return_case.out new file mode 100644 index 000000000000..734369d564e3 --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_case.out @@ -0,0 +1,6 @@ +before case +before dotcmd +before case +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_compound.out b/bin/sh/dotcmd/out/case_return_compound.out new file mode 100644 index 000000000000..2fae84e35df0 --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_compound.out @@ -0,0 +1,6 @@ +before case +before dotcmd +compound start +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_file.out b/bin/sh/dotcmd/out/case_return_file.out new file mode 100644 index 000000000000..f97ecc6dab50 --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_file.out @@ -0,0 +1,5 @@ +before case +before dotcmd +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_for.out b/bin/sh/dotcmd/out/case_return_for.out new file mode 100644 index 000000000000..d863537007be --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_for.out @@ -0,0 +1,6 @@ +before case +before dotcmd +before for +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_func.out b/bin/sh/dotcmd/out/case_return_func.out new file mode 100644 index 000000000000..aed8fa4db71a --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_func.out @@ -0,0 +1,7 @@ +before case +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_subshell.out b/bin/sh/dotcmd/out/case_return_subshell.out new file mode 100644 index 000000000000..364d2458e604 --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_subshell.out @@ -0,0 +1,6 @@ +before case +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_until.out b/bin/sh/dotcmd/out/case_return_until.out new file mode 100644 index 000000000000..daf3811e2e9a --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_until.out @@ -0,0 +1,6 @@ +before case +before dotcmd +before until +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/case_return_while.out b/bin/sh/dotcmd/out/case_return_while.out new file mode 100644 index 000000000000..ef6a6764d515 --- /dev/null +++ b/bin/sh/dotcmd/out/case_return_while.out @@ -0,0 +1,6 @@ +before case +before dotcmd +before while +before return +after dotcmd, return value: 0 +after case diff --git a/bin/sh/dotcmd/out/compound_break_case.out b/bin/sh/dotcmd/out/compound_break_case.out new file mode 100644 index 000000000000..144bcd6d00f4 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_case.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before case +before break +after break, return value: 0 +after case +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_compound.out b/bin/sh/dotcmd/out/compound_break_compound.out new file mode 100644 index 000000000000..3fd7b2f92e2a --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_compound.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +compound start +before break +after break, return value: 0 +compound end +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_file.out b/bin/sh/dotcmd/out/compound_break_file.out new file mode 100644 index 000000000000..5ad5ed396a74 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_file.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +before break +after break, return value: 0 +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_for.out b/bin/sh/dotcmd/out/compound_break_for.out new file mode 100644 index 000000000000..7f03e495bcde --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_for.out @@ -0,0 +1,7 @@ +compound start +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_func.out b/bin/sh/dotcmd/out/compound_break_func.out new file mode 100644 index 000000000000..82e86b3c778e --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_func.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before function +before break +after break +after function +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_subshell.out b/bin/sh/dotcmd/out/compound_break_subshell.out new file mode 100644 index 000000000000..e26e980f7ebf --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_subshell.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +subshell start +before break +after break, return value: 0 +subshell end +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_until.out b/bin/sh/dotcmd/out/compound_break_until.out new file mode 100644 index 000000000000..34dd25adeaa0 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_until.out @@ -0,0 +1,7 @@ +compound start +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_break_while.out b/bin/sh/dotcmd/out/compound_break_while.out new file mode 100644 index 000000000000..7019045bc39f --- /dev/null +++ b/bin/sh/dotcmd/out/compound_break_while.out @@ -0,0 +1,7 @@ +compound start +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_case.out b/bin/sh/dotcmd/out/compound_continue_case.out new file mode 100644 index 000000000000..206548ccff38 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_case.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before case +before continue +after continue, return value: 0 +after case +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_compound.out b/bin/sh/dotcmd/out/compound_continue_compound.out new file mode 100644 index 000000000000..a8c7efc159ec --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_compound.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +compound start +before continue +after continue, return value: 0 +compound end +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_file.out b/bin/sh/dotcmd/out/compound_continue_file.out new file mode 100644 index 000000000000..c619ad560f9d --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_file.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +before continue +after continue, return value: 0 +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_for.out b/bin/sh/dotcmd/out/compound_continue_for.out new file mode 100644 index 000000000000..35b092a42fb3 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_for.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_func.out b/bin/sh/dotcmd/out/compound_continue_func.out new file mode 100644 index 000000000000..198dbd6af513 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_func.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before function +before continue +after continue +after function +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_subshell.out b/bin/sh/dotcmd/out/compound_continue_subshell.out new file mode 100644 index 000000000000..1ecaa96e422f --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_subshell.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +subshell start +before continue +after continue, return value: 0 +subshell end +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_until.out b/bin/sh/dotcmd/out/compound_continue_until.out new file mode 100644 index 000000000000..4a74a8e8e431 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_until.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_continue_while.out b/bin/sh/dotcmd/out/compound_continue_while.out new file mode 100644 index 000000000000..b2d939ed538c --- /dev/null +++ b/bin/sh/dotcmd/out/compound_continue_while.out @@ -0,0 +1,8 @@ +compound start +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_case.out b/bin/sh/dotcmd/out/compound_return_case.out new file mode 100644 index 000000000000..995d5b556f42 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_case.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +before case +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_compound.out b/bin/sh/dotcmd/out/compound_return_compound.out new file mode 100644 index 000000000000..f6e4858e6f5d --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_compound.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +compound start +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_file.out b/bin/sh/dotcmd/out/compound_return_file.out new file mode 100644 index 000000000000..84347b28f74d --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_file.out @@ -0,0 +1,5 @@ +compound start +before dotcmd +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_for.out b/bin/sh/dotcmd/out/compound_return_for.out new file mode 100644 index 000000000000..ec234472aa6d --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_for.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +before for +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_func.out b/bin/sh/dotcmd/out/compound_return_func.out new file mode 100644 index 000000000000..12798d0e0322 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_func.out @@ -0,0 +1,7 @@ +compound start +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_subshell.out b/bin/sh/dotcmd/out/compound_return_subshell.out new file mode 100644 index 000000000000..af0ab785fbb4 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_subshell.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_until.out b/bin/sh/dotcmd/out/compound_return_until.out new file mode 100644 index 000000000000..a108f502d2c6 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_until.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +before until +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/compound_return_while.out b/bin/sh/dotcmd/out/compound_return_while.out new file mode 100644 index 000000000000..ef34c037a9f8 --- /dev/null +++ b/bin/sh/dotcmd/out/compound_return_while.out @@ -0,0 +1,6 @@ +compound start +before dotcmd +before while +before return +after dotcmd, return value: 0 +compound end diff --git a/bin/sh/dotcmd/out/file_break_case.out b/bin/sh/dotcmd/out/file_break_case.out new file mode 100644 index 000000000000..2f34f10c726b --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_case.out @@ -0,0 +1,6 @@ +before dotcmd +before case +before break +after break, return value: 0 +after case +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_compound.out b/bin/sh/dotcmd/out/file_break_compound.out new file mode 100644 index 000000000000..0c7300d6a3ee --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_compound.out @@ -0,0 +1,6 @@ +before dotcmd +compound start +before break +after break, return value: 0 +compound end +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_file.out b/bin/sh/dotcmd/out/file_break_file.out new file mode 100644 index 000000000000..fb4db197ddac --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_file.out @@ -0,0 +1,4 @@ +before dotcmd +before break +after break, return value: 0 +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_for.out b/bin/sh/dotcmd/out/file_break_for.out new file mode 100644 index 000000000000..66f445287d5b --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_for.out @@ -0,0 +1,5 @@ +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_func.out b/bin/sh/dotcmd/out/file_break_func.out new file mode 100644 index 000000000000..c5488abadbc5 --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_func.out @@ -0,0 +1,6 @@ +before dotcmd +before function +before break +after break +after function +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_subshell.out b/bin/sh/dotcmd/out/file_break_subshell.out new file mode 100644 index 000000000000..47e2394084af --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_subshell.out @@ -0,0 +1,6 @@ +before dotcmd +subshell start +before break +after break, return value: 0 +subshell end +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_until.out b/bin/sh/dotcmd/out/file_break_until.out new file mode 100644 index 000000000000..b51ff195bd84 --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_until.out @@ -0,0 +1,5 @@ +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_break_while.out b/bin/sh/dotcmd/out/file_break_while.out new file mode 100644 index 000000000000..0fd3a83ce03d --- /dev/null +++ b/bin/sh/dotcmd/out/file_break_while.out @@ -0,0 +1,5 @@ +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_case.out b/bin/sh/dotcmd/out/file_continue_case.out new file mode 100644 index 000000000000..2cf3be6d3b4e --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_case.out @@ -0,0 +1,6 @@ +before dotcmd +before case +before continue +after continue, return value: 0 +after case +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_compound.out b/bin/sh/dotcmd/out/file_continue_compound.out new file mode 100644 index 000000000000..7bec42019aee --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_compound.out @@ -0,0 +1,6 @@ +before dotcmd +compound start +before continue +after continue, return value: 0 +compound end +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_file.out b/bin/sh/dotcmd/out/file_continue_file.out new file mode 100644 index 000000000000..2f8806c60b6d --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_file.out @@ -0,0 +1,4 @@ +before dotcmd +before continue +after continue, return value: 0 +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_for.out b/bin/sh/dotcmd/out/file_continue_for.out new file mode 100644 index 000000000000..e8da2390bbbf --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_for.out @@ -0,0 +1,6 @@ +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_func.out b/bin/sh/dotcmd/out/file_continue_func.out new file mode 100644 index 000000000000..da683c02a158 --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_func.out @@ -0,0 +1,6 @@ +before dotcmd +before function +before continue +after continue +after function +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_subshell.out b/bin/sh/dotcmd/out/file_continue_subshell.out new file mode 100644 index 000000000000..388558b060e6 --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_subshell.out @@ -0,0 +1,6 @@ +before dotcmd +subshell start +before continue +after continue, return value: 0 +subshell end +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_until.out b/bin/sh/dotcmd/out/file_continue_until.out new file mode 100644 index 000000000000..bb0f28134eee --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_until.out @@ -0,0 +1,6 @@ +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_continue_while.out b/bin/sh/dotcmd/out/file_continue_while.out new file mode 100644 index 000000000000..63338234aa4c --- /dev/null +++ b/bin/sh/dotcmd/out/file_continue_while.out @@ -0,0 +1,6 @@ +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_case.out b/bin/sh/dotcmd/out/file_return_case.out new file mode 100644 index 000000000000..486685242bda --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_case.out @@ -0,0 +1,4 @@ +before dotcmd +before case +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_compound.out b/bin/sh/dotcmd/out/file_return_compound.out new file mode 100644 index 000000000000..6b831451d867 --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_compound.out @@ -0,0 +1,4 @@ +before dotcmd +compound start +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_file.out b/bin/sh/dotcmd/out/file_return_file.out new file mode 100644 index 000000000000..2d6742310a0f --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_file.out @@ -0,0 +1,3 @@ +before dotcmd +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_for.out b/bin/sh/dotcmd/out/file_return_for.out new file mode 100644 index 000000000000..83f8e002950f --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_for.out @@ -0,0 +1,4 @@ +before dotcmd +before for +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_func.out b/bin/sh/dotcmd/out/file_return_func.out new file mode 100644 index 000000000000..a0db2c99cfa8 --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_func.out @@ -0,0 +1,5 @@ +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_subshell.out b/bin/sh/dotcmd/out/file_return_subshell.out new file mode 100644 index 000000000000..83cd0e4ed0b0 --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_subshell.out @@ -0,0 +1,4 @@ +before dotcmd +subshell start +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_until.out b/bin/sh/dotcmd/out/file_return_until.out new file mode 100644 index 000000000000..fdf2449045a1 --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_until.out @@ -0,0 +1,4 @@ +before dotcmd +before until +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/file_return_while.out b/bin/sh/dotcmd/out/file_return_while.out new file mode 100644 index 000000000000..a733aa38912b --- /dev/null +++ b/bin/sh/dotcmd/out/file_return_while.out @@ -0,0 +1,4 @@ +before dotcmd +before while +before return +after dotcmd, return value: 0 diff --git a/bin/sh/dotcmd/out/for_break_case.out b/bin/sh/dotcmd/out/for_break_case.out new file mode 100644 index 000000000000..262db24358d4 --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_case.out @@ -0,0 +1,5 @@ +before for +before dotcmd +before case +before break +after for diff --git a/bin/sh/dotcmd/out/for_break_compound.out b/bin/sh/dotcmd/out/for_break_compound.out new file mode 100644 index 000000000000..418a4de73c0c --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_compound.out @@ -0,0 +1,5 @@ +before for +before dotcmd +compound start +before break +after for diff --git a/bin/sh/dotcmd/out/for_break_file.out b/bin/sh/dotcmd/out/for_break_file.out new file mode 100644 index 000000000000..752c95c9815c --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_file.out @@ -0,0 +1,4 @@ +before for +before dotcmd +before break +after for diff --git a/bin/sh/dotcmd/out/for_break_for.out b/bin/sh/dotcmd/out/for_break_for.out new file mode 100644 index 000000000000..20af6224fc55 --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_for.out @@ -0,0 +1,12 @@ +before for +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_break_func.out b/bin/sh/dotcmd/out/for_break_func.out new file mode 100644 index 000000000000..fe0cab4fa49b --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_func.out @@ -0,0 +1,5 @@ +before for +before dotcmd +before function +before break +after for diff --git a/bin/sh/dotcmd/out/for_break_subshell.out b/bin/sh/dotcmd/out/for_break_subshell.out new file mode 100644 index 000000000000..985aab6270c4 --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_subshell.out @@ -0,0 +1,10 @@ +before for +before dotcmd +subshell start +before break +after dotcmd, return value: 0 +before dotcmd +subshell start +before break +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_break_until.out b/bin/sh/dotcmd/out/for_break_until.out new file mode 100644 index 000000000000..b47c90198f18 --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_until.out @@ -0,0 +1,12 @@ +before for +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_break_while.out b/bin/sh/dotcmd/out/for_break_while.out new file mode 100644 index 000000000000..deb4cebaece8 --- /dev/null +++ b/bin/sh/dotcmd/out/for_break_while.out @@ -0,0 +1,12 @@ +before for +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_continue_case.out b/bin/sh/dotcmd/out/for_continue_case.out new file mode 100644 index 000000000000..e989063290ea --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_case.out @@ -0,0 +1,8 @@ +before for +before dotcmd +before case +before continue +before dotcmd +before case +before continue +after for diff --git a/bin/sh/dotcmd/out/for_continue_compound.out b/bin/sh/dotcmd/out/for_continue_compound.out new file mode 100644 index 000000000000..0fd23b628719 --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_compound.out @@ -0,0 +1,8 @@ +before for +before dotcmd +compound start +before continue +before dotcmd +compound start +before continue +after for diff --git a/bin/sh/dotcmd/out/for_continue_file.out b/bin/sh/dotcmd/out/for_continue_file.out new file mode 100644 index 000000000000..286bb88c1ea1 --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_file.out @@ -0,0 +1,6 @@ +before for +before dotcmd +before continue +before dotcmd +before continue +after for diff --git a/bin/sh/dotcmd/out/for_continue_for.out b/bin/sh/dotcmd/out/for_continue_for.out new file mode 100644 index 000000000000..044d5a35c55e --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_for.out @@ -0,0 +1,14 @@ +before for +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_continue_func.out b/bin/sh/dotcmd/out/for_continue_func.out new file mode 100644 index 000000000000..a0cc6cc18fd8 --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_func.out @@ -0,0 +1,8 @@ +before for +before dotcmd +before function +before continue +before dotcmd +before function +before continue +after for diff --git a/bin/sh/dotcmd/out/for_continue_subshell.out b/bin/sh/dotcmd/out/for_continue_subshell.out new file mode 100644 index 000000000000..f1ae7aab16d0 --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_subshell.out @@ -0,0 +1,10 @@ +before for +before dotcmd +subshell start +before continue +after dotcmd, return value: 0 +before dotcmd +subshell start +before continue +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_continue_until.out b/bin/sh/dotcmd/out/for_continue_until.out new file mode 100644 index 000000000000..b1c4147a9730 --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_until.out @@ -0,0 +1,14 @@ +before for +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_continue_while.out b/bin/sh/dotcmd/out/for_continue_while.out new file mode 100644 index 000000000000..f8e5c5d11830 --- /dev/null +++ b/bin/sh/dotcmd/out/for_continue_while.out @@ -0,0 +1,14 @@ +before for +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_case.out b/bin/sh/dotcmd/out/for_return_case.out new file mode 100644 index 000000000000..24b7145a05c4 --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_case.out @@ -0,0 +1,10 @@ +before for +before dotcmd +before case +before return +after dotcmd, return value: 0 +before dotcmd +before case +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_compound.out b/bin/sh/dotcmd/out/for_return_compound.out new file mode 100644 index 000000000000..30b4dac3988e --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_compound.out @@ -0,0 +1,10 @@ +before for +before dotcmd +compound start +before return +after dotcmd, return value: 0 +before dotcmd +compound start +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_file.out b/bin/sh/dotcmd/out/for_return_file.out new file mode 100644 index 000000000000..88555621c77f --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_file.out @@ -0,0 +1,8 @@ +before for +before dotcmd +before return +after dotcmd, return value: 0 +before dotcmd +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_for.out b/bin/sh/dotcmd/out/for_return_for.out new file mode 100644 index 000000000000..52a72a9fb0c8 --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_for.out @@ -0,0 +1,10 @@ +before for +before dotcmd +before for +before return +after dotcmd, return value: 0 +before dotcmd +before for +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_func.out b/bin/sh/dotcmd/out/for_return_func.out new file mode 100644 index 000000000000..4f0fee21740b --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_func.out @@ -0,0 +1,12 @@ +before for +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_subshell.out b/bin/sh/dotcmd/out/for_return_subshell.out new file mode 100644 index 000000000000..4b8f36c1a331 --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_subshell.out @@ -0,0 +1,10 @@ +before for +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_until.out b/bin/sh/dotcmd/out/for_return_until.out new file mode 100644 index 000000000000..3eaf9df84b8b --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_until.out @@ -0,0 +1,10 @@ +before for +before dotcmd +before until +before return +after dotcmd, return value: 0 +before dotcmd +before until +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/for_return_while.out b/bin/sh/dotcmd/out/for_return_while.out new file mode 100644 index 000000000000..8cbad954cdad --- /dev/null +++ b/bin/sh/dotcmd/out/for_return_while.out @@ -0,0 +1,10 @@ +before for +before dotcmd +before while +before return +after dotcmd, return value: 0 +before dotcmd +before while +before return +after dotcmd, return value: 0 +after for diff --git a/bin/sh/dotcmd/out/func_break_case.out b/bin/sh/dotcmd/out/func_break_case.out new file mode 100644 index 000000000000..7373371e511b --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_case.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before case +before break +after break, return value: 0 +after case +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_compound.out b/bin/sh/dotcmd/out/func_break_compound.out new file mode 100644 index 000000000000..e87b4a2e8e14 --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_compound.out @@ -0,0 +1,8 @@ +before function +before dotcmd +compound start +before break +after break, return value: 0 +compound end +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_file.out b/bin/sh/dotcmd/out/func_break_file.out new file mode 100644 index 000000000000..cf144227aefe --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_file.out @@ -0,0 +1,6 @@ +before function +before dotcmd +before break +after break, return value: 0 +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_for.out b/bin/sh/dotcmd/out/func_break_for.out new file mode 100644 index 000000000000..c3853488a517 --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_for.out @@ -0,0 +1,7 @@ +before function +before dotcmd +before for +before break +after for +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_func.out b/bin/sh/dotcmd/out/func_break_func.out new file mode 100644 index 000000000000..5c1c4c830164 --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_func.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before function +before break +after break +after function +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_subshell.out b/bin/sh/dotcmd/out/func_break_subshell.out new file mode 100644 index 000000000000..affe3e4bdefb --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_subshell.out @@ -0,0 +1,8 @@ +before function +before dotcmd +subshell start +before break +after break, return value: 0 +subshell end +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_until.out b/bin/sh/dotcmd/out/func_break_until.out new file mode 100644 index 000000000000..b0f942a04fbf --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_until.out @@ -0,0 +1,7 @@ +before function +before dotcmd +before until +before break +after until +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_break_while.out b/bin/sh/dotcmd/out/func_break_while.out new file mode 100644 index 000000000000..d687aa766498 --- /dev/null +++ b/bin/sh/dotcmd/out/func_break_while.out @@ -0,0 +1,7 @@ +before function +before dotcmd +before while +before break +after while +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_case.out b/bin/sh/dotcmd/out/func_continue_case.out new file mode 100644 index 000000000000..b1ad4be38bfd --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_case.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before case +before continue +after continue, return value: 0 +after case +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_compound.out b/bin/sh/dotcmd/out/func_continue_compound.out new file mode 100644 index 000000000000..d6a5edd9940f --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_compound.out @@ -0,0 +1,8 @@ +before function +before dotcmd +compound start +before continue +after continue, return value: 0 +compound end +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_file.out b/bin/sh/dotcmd/out/func_continue_file.out new file mode 100644 index 000000000000..f300d6afee79 --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_file.out @@ -0,0 +1,6 @@ +before function +before dotcmd +before continue +after continue, return value: 0 +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_for.out b/bin/sh/dotcmd/out/func_continue_for.out new file mode 100644 index 000000000000..d46095d58d36 --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_for.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before for +before continue +before continue +after for +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_func.out b/bin/sh/dotcmd/out/func_continue_func.out new file mode 100644 index 000000000000..3ff73a2bdaa9 --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_func.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before function +before continue +after continue +after function +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_subshell.out b/bin/sh/dotcmd/out/func_continue_subshell.out new file mode 100644 index 000000000000..fd295aad8542 --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_subshell.out @@ -0,0 +1,8 @@ +before function +before dotcmd +subshell start +before continue +after continue, return value: 0 +subshell end +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_until.out b/bin/sh/dotcmd/out/func_continue_until.out new file mode 100644 index 000000000000..7a6508328e00 --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_until.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before until +before continue +before continue +after until +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_continue_while.out b/bin/sh/dotcmd/out/func_continue_while.out new file mode 100644 index 000000000000..6ecbe8261164 --- /dev/null +++ b/bin/sh/dotcmd/out/func_continue_while.out @@ -0,0 +1,8 @@ +before function +before dotcmd +before while +before continue +before continue +after while +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_case.out b/bin/sh/dotcmd/out/func_return_case.out new file mode 100644 index 000000000000..8f0c0948357a --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_case.out @@ -0,0 +1,6 @@ +before function +before dotcmd +before case +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_compound.out b/bin/sh/dotcmd/out/func_return_compound.out new file mode 100644 index 000000000000..e3d86704f79d --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_compound.out @@ -0,0 +1,6 @@ +before function +before dotcmd +compound start +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_file.out b/bin/sh/dotcmd/out/func_return_file.out new file mode 100644 index 000000000000..95e341525799 --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_file.out @@ -0,0 +1,5 @@ +before function +before dotcmd +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_for.out b/bin/sh/dotcmd/out/func_return_for.out new file mode 100644 index 000000000000..511cc39ca34f --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_for.out @@ -0,0 +1,6 @@ +before function +before dotcmd +before for +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_func.out b/bin/sh/dotcmd/out/func_return_func.out new file mode 100644 index 000000000000..a87d3a780043 --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_func.out @@ -0,0 +1,7 @@ +before function +before dotcmd +before function +before return +after function +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_subshell.out b/bin/sh/dotcmd/out/func_return_subshell.out new file mode 100644 index 000000000000..fdb37b20979e --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_subshell.out @@ -0,0 +1,6 @@ +before function +before dotcmd +subshell start +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_until.out b/bin/sh/dotcmd/out/func_return_until.out new file mode 100644 index 000000000000..08b45be42f4f --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_until.out @@ -0,0 +1,6 @@ +before function +before dotcmd +before until +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/func_return_while.out b/bin/sh/dotcmd/out/func_return_while.out new file mode 100644 index 000000000000..27fbcaf88b22 --- /dev/null +++ b/bin/sh/dotcmd/out/func_return_while.out @@ -0,0 +1,6 @@ +before function +before dotcmd +before while +before return +after dotcmd +after function diff --git a/bin/sh/dotcmd/out/subshell_break_case.out b/bin/sh/dotcmd/out/subshell_break_case.out new file mode 100644 index 000000000000..155daea6606d --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_case.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before case +before break +after break, return value: 0 +after case +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_compound.out b/bin/sh/dotcmd/out/subshell_break_compound.out new file mode 100644 index 000000000000..a643ac080d91 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_compound.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +compound start +before break +after break, return value: 0 +compound end +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_file.out b/bin/sh/dotcmd/out/subshell_break_file.out new file mode 100644 index 000000000000..2556d89acbbe --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_file.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +before break +after break, return value: 0 +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_for.out b/bin/sh/dotcmd/out/subshell_break_for.out new file mode 100644 index 000000000000..27040a992adf --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_for.out @@ -0,0 +1,7 @@ +subshell start +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_func.out b/bin/sh/dotcmd/out/subshell_break_func.out new file mode 100644 index 000000000000..83ec062eed6a --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_func.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before function +before break +after break +after function +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_subshell.out b/bin/sh/dotcmd/out/subshell_break_subshell.out new file mode 100644 index 000000000000..8a53ac59e578 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_subshell.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +subshell start +before break +after break, return value: 0 +subshell end +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_until.out b/bin/sh/dotcmd/out/subshell_break_until.out new file mode 100644 index 000000000000..a31fa5bfa332 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_until.out @@ -0,0 +1,7 @@ +subshell start +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_break_while.out b/bin/sh/dotcmd/out/subshell_break_while.out new file mode 100644 index 000000000000..42eb970ef81d --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_break_while.out @@ -0,0 +1,7 @@ +subshell start +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_case.out b/bin/sh/dotcmd/out/subshell_continue_case.out new file mode 100644 index 000000000000..4d74b7b151e2 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_case.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before case +before continue +after continue, return value: 0 +after case +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_compound.out b/bin/sh/dotcmd/out/subshell_continue_compound.out new file mode 100644 index 000000000000..4328df396efb --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_compound.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +compound start +before continue +after continue, return value: 0 +compound end +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_file.out b/bin/sh/dotcmd/out/subshell_continue_file.out new file mode 100644 index 000000000000..a4a6e4ae0411 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_file.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +before continue +after continue, return value: 0 +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_for.out b/bin/sh/dotcmd/out/subshell_continue_for.out new file mode 100644 index 000000000000..e82988936104 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_for.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_func.out b/bin/sh/dotcmd/out/subshell_continue_func.out new file mode 100644 index 000000000000..e0ead4c87cb9 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_func.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before function +before continue +after continue +after function +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_subshell.out b/bin/sh/dotcmd/out/subshell_continue_subshell.out new file mode 100644 index 000000000000..dfcdfb46a662 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_subshell.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +subshell start +before continue +after continue, return value: 0 +subshell end +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_until.out b/bin/sh/dotcmd/out/subshell_continue_until.out new file mode 100644 index 000000000000..66e8f9f269ae --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_until.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_continue_while.out b/bin/sh/dotcmd/out/subshell_continue_while.out new file mode 100644 index 000000000000..f1c83f43d394 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_continue_while.out @@ -0,0 +1,8 @@ +subshell start +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_case.out b/bin/sh/dotcmd/out/subshell_return_case.out new file mode 100644 index 000000000000..008d9396a260 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_case.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +before case +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_compound.out b/bin/sh/dotcmd/out/subshell_return_compound.out new file mode 100644 index 000000000000..bdab2314d44b --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_compound.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +compound start +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_file.out b/bin/sh/dotcmd/out/subshell_return_file.out new file mode 100644 index 000000000000..43d011dfb970 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_file.out @@ -0,0 +1,5 @@ +subshell start +before dotcmd +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_for.out b/bin/sh/dotcmd/out/subshell_return_for.out new file mode 100644 index 000000000000..7cfed898d338 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_for.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +before for +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_func.out b/bin/sh/dotcmd/out/subshell_return_func.out new file mode 100644 index 000000000000..b695c53484c8 --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_func.out @@ -0,0 +1,7 @@ +subshell start +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_subshell.out b/bin/sh/dotcmd/out/subshell_return_subshell.out new file mode 100644 index 000000000000..c5ccf597e61c --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_subshell.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_until.out b/bin/sh/dotcmd/out/subshell_return_until.out new file mode 100644 index 000000000000..64737ad7341f --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_until.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +before until +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/subshell_return_while.out b/bin/sh/dotcmd/out/subshell_return_while.out new file mode 100644 index 000000000000..de520c4493ef --- /dev/null +++ b/bin/sh/dotcmd/out/subshell_return_while.out @@ -0,0 +1,6 @@ +subshell start +before dotcmd +before while +before return +after dotcmd, return value: 0 +subshell end diff --git a/bin/sh/dotcmd/out/until_break_case.out b/bin/sh/dotcmd/out/until_break_case.out new file mode 100644 index 000000000000..f0483b459129 --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_case.out @@ -0,0 +1,5 @@ +before until +before dotcmd +before case +before break +after until diff --git a/bin/sh/dotcmd/out/until_break_compound.out b/bin/sh/dotcmd/out/until_break_compound.out new file mode 100644 index 000000000000..a5e37ba7ab5d --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_compound.out @@ -0,0 +1,5 @@ +before until +before dotcmd +compound start +before break +after until diff --git a/bin/sh/dotcmd/out/until_break_file.out b/bin/sh/dotcmd/out/until_break_file.out new file mode 100644 index 000000000000..a2fde4dafe28 --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_file.out @@ -0,0 +1,4 @@ +before until +before dotcmd +before break +after until diff --git a/bin/sh/dotcmd/out/until_break_for.out b/bin/sh/dotcmd/out/until_break_for.out new file mode 100644 index 000000000000..8b3faf520a8f --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_for.out @@ -0,0 +1,12 @@ +before until +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_break_func.out b/bin/sh/dotcmd/out/until_break_func.out new file mode 100644 index 000000000000..a83ce2b82c0c --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_func.out @@ -0,0 +1,5 @@ +before until +before dotcmd +before function +before break +after until diff --git a/bin/sh/dotcmd/out/until_break_subshell.out b/bin/sh/dotcmd/out/until_break_subshell.out new file mode 100644 index 000000000000..008d30dfc7d6 --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_subshell.out @@ -0,0 +1,10 @@ +before until +before dotcmd +subshell start +before break +after dotcmd, return value: 0 +before dotcmd +subshell start +before break +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_break_until.out b/bin/sh/dotcmd/out/until_break_until.out new file mode 100644 index 000000000000..05fb94a46af3 --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_until.out @@ -0,0 +1,12 @@ +before until +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_break_while.out b/bin/sh/dotcmd/out/until_break_while.out new file mode 100644 index 000000000000..6ae1f9c4225d --- /dev/null +++ b/bin/sh/dotcmd/out/until_break_while.out @@ -0,0 +1,12 @@ +before until +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_continue_case.out b/bin/sh/dotcmd/out/until_continue_case.out new file mode 100644 index 000000000000..40028fb08139 --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_case.out @@ -0,0 +1,8 @@ +before until +before dotcmd +before case +before continue +before dotcmd +before case +before continue +after until diff --git a/bin/sh/dotcmd/out/until_continue_compound.out b/bin/sh/dotcmd/out/until_continue_compound.out new file mode 100644 index 000000000000..3641e1e3f5c2 --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_compound.out @@ -0,0 +1,8 @@ +before until +before dotcmd +compound start +before continue +before dotcmd +compound start +before continue +after until diff --git a/bin/sh/dotcmd/out/until_continue_file.out b/bin/sh/dotcmd/out/until_continue_file.out new file mode 100644 index 000000000000..c9f5193b740f --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_file.out @@ -0,0 +1,6 @@ +before until +before dotcmd +before continue +before dotcmd +before continue +after until diff --git a/bin/sh/dotcmd/out/until_continue_for.out b/bin/sh/dotcmd/out/until_continue_for.out new file mode 100644 index 000000000000..fd582401d026 --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_for.out @@ -0,0 +1,14 @@ +before until +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_continue_func.out b/bin/sh/dotcmd/out/until_continue_func.out new file mode 100644 index 000000000000..6beb16323068 --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_func.out @@ -0,0 +1,8 @@ +before until +before dotcmd +before function +before continue +before dotcmd +before function +before continue +after until diff --git a/bin/sh/dotcmd/out/until_continue_subshell.out b/bin/sh/dotcmd/out/until_continue_subshell.out new file mode 100644 index 000000000000..534509e7e69d --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_subshell.out @@ -0,0 +1,10 @@ +before until +before dotcmd +subshell start +before continue +after dotcmd, return value: 0 +before dotcmd +subshell start +before continue +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_continue_until.out b/bin/sh/dotcmd/out/until_continue_until.out new file mode 100644 index 000000000000..ddfeb2797a7e --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_until.out @@ -0,0 +1,14 @@ +before until +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_continue_while.out b/bin/sh/dotcmd/out/until_continue_while.out new file mode 100644 index 000000000000..5707821eca00 --- /dev/null +++ b/bin/sh/dotcmd/out/until_continue_while.out @@ -0,0 +1,14 @@ +before until +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_case.out b/bin/sh/dotcmd/out/until_return_case.out new file mode 100644 index 000000000000..70dd420505cd --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_case.out @@ -0,0 +1,10 @@ +before until +before dotcmd +before case +before return +after dotcmd, return value: 0 +before dotcmd +before case +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_compound.out b/bin/sh/dotcmd/out/until_return_compound.out new file mode 100644 index 000000000000..145d2c580f07 --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_compound.out @@ -0,0 +1,10 @@ +before until +before dotcmd +compound start +before return +after dotcmd, return value: 0 +before dotcmd +compound start +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_file.out b/bin/sh/dotcmd/out/until_return_file.out new file mode 100644 index 000000000000..5b0adb198c6d --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_file.out @@ -0,0 +1,8 @@ +before until +before dotcmd +before return +after dotcmd, return value: 0 +before dotcmd +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_for.out b/bin/sh/dotcmd/out/until_return_for.out new file mode 100644 index 000000000000..b113e8c0552a --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_for.out @@ -0,0 +1,10 @@ +before until +before dotcmd +before for +before return +after dotcmd, return value: 0 +before dotcmd +before for +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_func.out b/bin/sh/dotcmd/out/until_return_func.out new file mode 100644 index 000000000000..1ab16ab70360 --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_func.out @@ -0,0 +1,12 @@ +before until +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_subshell.out b/bin/sh/dotcmd/out/until_return_subshell.out new file mode 100644 index 000000000000..d44463108242 --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_subshell.out @@ -0,0 +1,10 @@ +before until +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_until.out b/bin/sh/dotcmd/out/until_return_until.out new file mode 100644 index 000000000000..39980179a781 --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_until.out @@ -0,0 +1,10 @@ +before until +before dotcmd +before until +before return +after dotcmd, return value: 0 +before dotcmd +before until +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/until_return_while.out b/bin/sh/dotcmd/out/until_return_while.out new file mode 100644 index 000000000000..9b140cf7a0a3 --- /dev/null +++ b/bin/sh/dotcmd/out/until_return_while.out @@ -0,0 +1,10 @@ +before until +before dotcmd +before while +before return +after dotcmd, return value: 0 +before dotcmd +before while +before return +after dotcmd, return value: 0 +after until diff --git a/bin/sh/dotcmd/out/while_break_case.out b/bin/sh/dotcmd/out/while_break_case.out new file mode 100644 index 000000000000..1b0731fcaf38 --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_case.out @@ -0,0 +1,5 @@ +before while +before dotcmd +before case +before break +after while diff --git a/bin/sh/dotcmd/out/while_break_compound.out b/bin/sh/dotcmd/out/while_break_compound.out new file mode 100644 index 000000000000..05c23eb4284c --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_compound.out @@ -0,0 +1,5 @@ +before while +before dotcmd +compound start +before break +after while diff --git a/bin/sh/dotcmd/out/while_break_file.out b/bin/sh/dotcmd/out/while_break_file.out new file mode 100644 index 000000000000..cb70ae19221e --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_file.out @@ -0,0 +1,4 @@ +before while +before dotcmd +before break +after while diff --git a/bin/sh/dotcmd/out/while_break_for.out b/bin/sh/dotcmd/out/while_break_for.out new file mode 100644 index 000000000000..b94eac165604 --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_for.out @@ -0,0 +1,12 @@ +before while +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +before dotcmd +before for +before break +after for +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_break_func.out b/bin/sh/dotcmd/out/while_break_func.out new file mode 100644 index 000000000000..7d54c1514a67 --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_func.out @@ -0,0 +1,5 @@ +before while +before dotcmd +before function +before break +after while diff --git a/bin/sh/dotcmd/out/while_break_subshell.out b/bin/sh/dotcmd/out/while_break_subshell.out new file mode 100644 index 000000000000..234cd663c2e0 --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_subshell.out @@ -0,0 +1,10 @@ +before while +before dotcmd +subshell start +before break +after dotcmd, return value: 0 +before dotcmd +subshell start +before break +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_break_until.out b/bin/sh/dotcmd/out/while_break_until.out new file mode 100644 index 000000000000..f3602302673f --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_until.out @@ -0,0 +1,12 @@ +before while +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +before dotcmd +before until +before break +after until +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_break_while.out b/bin/sh/dotcmd/out/while_break_while.out new file mode 100644 index 000000000000..451b0a23671b --- /dev/null +++ b/bin/sh/dotcmd/out/while_break_while.out @@ -0,0 +1,12 @@ +before while +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +before dotcmd +before while +before break +after while +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_continue_case.out b/bin/sh/dotcmd/out/while_continue_case.out new file mode 100644 index 000000000000..d7f412c0d554 --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_case.out @@ -0,0 +1,8 @@ +before while +before dotcmd +before case +before continue +before dotcmd +before case +before continue +after while diff --git a/bin/sh/dotcmd/out/while_continue_compound.out b/bin/sh/dotcmd/out/while_continue_compound.out new file mode 100644 index 000000000000..001904764a68 --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_compound.out @@ -0,0 +1,8 @@ +before while +before dotcmd +compound start +before continue +before dotcmd +compound start +before continue +after while diff --git a/bin/sh/dotcmd/out/while_continue_file.out b/bin/sh/dotcmd/out/while_continue_file.out new file mode 100644 index 000000000000..9070dea4528e --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_file.out @@ -0,0 +1,6 @@ +before while +before dotcmd +before continue +before dotcmd +before continue +after while diff --git a/bin/sh/dotcmd/out/while_continue_for.out b/bin/sh/dotcmd/out/while_continue_for.out new file mode 100644 index 000000000000..98696ee40190 --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_for.out @@ -0,0 +1,14 @@ +before while +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +before dotcmd +before for +before continue +before continue +after for +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_continue_func.out b/bin/sh/dotcmd/out/while_continue_func.out new file mode 100644 index 000000000000..77efc2c9c87a --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_func.out @@ -0,0 +1,8 @@ +before while +before dotcmd +before function +before continue +before dotcmd +before function +before continue +after while diff --git a/bin/sh/dotcmd/out/while_continue_subshell.out b/bin/sh/dotcmd/out/while_continue_subshell.out new file mode 100644 index 000000000000..b4106a1e2d83 --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_subshell.out @@ -0,0 +1,10 @@ +before while +before dotcmd +subshell start +before continue +after dotcmd, return value: 0 +before dotcmd +subshell start +before continue +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_continue_until.out b/bin/sh/dotcmd/out/while_continue_until.out new file mode 100644 index 000000000000..7f893a015a6a --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_until.out @@ -0,0 +1,14 @@ +before while +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +before dotcmd +before until +before continue +before continue +after until +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_continue_while.out b/bin/sh/dotcmd/out/while_continue_while.out new file mode 100644 index 000000000000..317be17fadc4 --- /dev/null +++ b/bin/sh/dotcmd/out/while_continue_while.out @@ -0,0 +1,14 @@ +before while +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +before dotcmd +before while +before continue +before continue +after while +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_case.out b/bin/sh/dotcmd/out/while_return_case.out new file mode 100644 index 000000000000..abb6a4afcfab --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_case.out @@ -0,0 +1,10 @@ +before while +before dotcmd +before case +before return +after dotcmd, return value: 0 +before dotcmd +before case +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_compound.out b/bin/sh/dotcmd/out/while_return_compound.out new file mode 100644 index 000000000000..b37418b3d34e --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_compound.out @@ -0,0 +1,10 @@ +before while +before dotcmd +compound start +before return +after dotcmd, return value: 0 +before dotcmd +compound start +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_file.out b/bin/sh/dotcmd/out/while_return_file.out new file mode 100644 index 000000000000..1c4791ef7639 --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_file.out @@ -0,0 +1,8 @@ +before while +before dotcmd +before return +after dotcmd, return value: 0 +before dotcmd +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_for.out b/bin/sh/dotcmd/out/while_return_for.out new file mode 100644 index 000000000000..0569d6fe6707 --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_for.out @@ -0,0 +1,10 @@ +before while +before dotcmd +before for +before return +after dotcmd, return value: 0 +before dotcmd +before for +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_func.out b/bin/sh/dotcmd/out/while_return_func.out new file mode 100644 index 000000000000..cb5a30853a10 --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_func.out @@ -0,0 +1,12 @@ +before while +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +before dotcmd +before function +before return +after function +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_subshell.out b/bin/sh/dotcmd/out/while_return_subshell.out new file mode 100644 index 000000000000..161a227239bc --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_subshell.out @@ -0,0 +1,10 @@ +before while +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +before dotcmd +subshell start +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_until.out b/bin/sh/dotcmd/out/while_return_until.out new file mode 100644 index 000000000000..d84a5f71dca8 --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_until.out @@ -0,0 +1,10 @@ +before while +before dotcmd +before until +before return +after dotcmd, return value: 0 +before dotcmd +before until +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/out/while_return_while.out b/bin/sh/dotcmd/out/while_return_while.out new file mode 100644 index 000000000000..4eeaaa9b5244 --- /dev/null +++ b/bin/sh/dotcmd/out/while_return_while.out @@ -0,0 +1,10 @@ +before while +before dotcmd +before while +before return +after dotcmd, return value: 0 +before dotcmd +before while +before return +after dotcmd, return value: 0 +after while diff --git a/bin/sh/dotcmd/scoped_command b/bin/sh/dotcmd/scoped_command new file mode 100755 index 000000000000..fda4e53a302a --- /dev/null +++ b/bin/sh/dotcmd/scoped_command @@ -0,0 +1,129 @@ +#!/bin/sh +# +# $NetBSD: scoped_command,v 1.1 2014/05/31 14:29:06 christos Exp $ +# +# Copyright (c) 2014 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Jarmo Jaakkola. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +set -e + +# USAGE: +# scoped_command scope cmd msg var_suffix +# +# Write to stdout a piece of Bourne Shell script with _cmd_ in specific +# _scope_. The execution of _cmd_ is bracketed by prints of "before _msg_" +# and "after _msg_, return value ${?}". If the generated script uses +# variables, __var_suffix_ is appended to their names to allow nesting of +# scripts generated this way. +# +# _scope_ should be one of: case, compound, file, for, func, subshell, +# until, while. +# _cmd_ is the command line to execute. Remember proper quoting! +# _msg_ is text that will be used inside single quotes. +# _var_suffix_ is a syntactically valid identifier name. + +# don't rely on command lists (';') +cmd="echo 'before ${3}' +${2} +echo 'after ${3}, return value:' ${?}" + +echo "#!/bin/sh" + +[ 'func' = "${1}" ] && cat <<EOF +func() +{ + echo 'before ${3}' + \${1} + echo 'after ${3}' +} + +echo 'before function' +func "${2}" "${3}" # don't rely on 'shift' +echo 'after function' +EOF + +[ 'case' = "${1}" ] && cat <<EOF +echo 'before case' +case 'a' in + a) ${cmd};; +esac +echo 'after case' +EOF + +[ 'file' = "${1}" ] && cat <<EOF +${cmd} +EOF + +[ 'while' = "${1}" ] && cat <<EOF +echo 'before while' +cond_${4}='true true false' +while \${cond_${4}} +do + cond_${4}="\${cond_${4}#* }" + ${cmd} +done +echo 'after while' +EOF + +[ 'until' = "${1}" ] && cat <<EOF +echo 'before until' +cond_${4}='false false true' +until \${cond_${4}} +do + cond_${4}="\${cond_${4}#* }" + ${cmd} +done +echo 'after until' +EOF + +[ 'for' = "${1}" ] && cat <<EOF +echo 'before for' +for i_${4} in 1 2 +do + ${cmd} +done +echo 'after for' +EOF + +[ 'subshell' = "${1}" ] && cat <<EOF +( + echo 'subshell start' + ${cmd} + echo 'subshell end' +) +EOF + +[ 'compound' = "${1}" ] && cat <<EOF +{ + echo 'compound start' + ${cmd}; + echo 'compound end' +} +EOF + +exit 0 diff --git a/bin/sh/dotcmd/t_dotcmd.sh b/bin/sh/dotcmd/t_dotcmd.sh new file mode 100755 index 000000000000..b365b1de4676 --- /dev/null +++ b/bin/sh/dotcmd/t_dotcmd.sh @@ -0,0 +1,76 @@ +# $NetBSD: t_dotcmd.sh,v 1.1 2014/05/31 14:29:06 christos Exp $ +# +# Copyright (c) 2014 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Jarmo Jaakkola. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# Test loop and function flow control statements in various scopes in a file +# sourced by a dotcmd in various scopes. Basically, dotcmd is like #include +# in C/C++ so, for example, if the dotcmd is in a loop's body, a break in +# the sourced file can be used to break out of that loop. + +cmds='return break continue' +scopes='case compound file for func subshell until while' + +case_ids='' + +for dot_scope in ${scopes} +do + for cmd in ${cmds} + do + for cmd_scope in ${scopes} + do + case_id="${dot_scope}_${cmd}_${cmd_scope}" + case_ids="${case_ids} ${case_id}" + atf_test_case "${case_id}" + eval " +${case_id}_head() +{ + atf_set 'descr' \\ + 'dotcmd in ${dot_scope}, file contains ${cmd} in ${cmd_scope}' +} + +${case_id}_body() +{ + srcdir=\$(atf_get_srcdir) + # for dotcmd to find the sourced files + PATH=\"\${PATH}:\${srcdir}\" + atf_check -o file:\"\${srcdir}/out/${case_id}.out\" \\ + \"\${srcdir}/${case_id}\" +} +" # end eval + done + done +done + +atf_init_test_cases() +{ + for case_id in ${case_ids} + do + atf_add_test_case "${case_id}" + done +} diff --git a/bin/sh/t_compexit.sh b/bin/sh/t_compexit.sh new file mode 100755 index 000000000000..019b740065b0 --- /dev/null +++ b/bin/sh/t_compexit.sh @@ -0,0 +1,63 @@ +# $NetBSD: t_compexit.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# +# Copyright (c) 2007 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# The standard +# http://www.opengroup.org/onlinepubs/007904975/utilities/set.html +# says: +# +# -e +# +# When this option is on, if a simple command fails for any of the +# reasons listed in Consequences of Shell Errors or returns an exit +# status value >0, and is not part of the compound list following a +# while, until, or if keyword, and is not a part of an AND or OR list, +# and is not a pipeline preceded by the ! reserved word, then the shell +# shall immediately exit. + +crud() { + set -e + for x in a + do + BAR="foo" + false && echo true + echo mumble + done +} + +atf_test_case set_e +set_e_head() { + atf_set "descr" "Tests that 'set -e' turns on error detection" \ + "and that it behaves as defined by the standard" +} +set_e_body() { + foo=`crud` + atf_check_equal 'x$foo' 'xmumble' +} + +atf_init_test_cases() { + atf_add_test_case set_e +} diff --git a/bin/sh/t_evaltested.sh b/bin/sh/t_evaltested.sh new file mode 100755 index 000000000000..e40f8bd4b3be --- /dev/null +++ b/bin/sh/t_evaltested.sh @@ -0,0 +1,60 @@ +# $NetBSD: t_evaltested.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# +# Copyright (c) 2011 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +atf_test_case evaltested + +evaltested_head() { + atf_set "descr" "Tests that eval in a tested context does not exit" +} + +evaltested_body() { + set -e +cat > helper.sh << EOF +set -e +if eval false +then + echo "'eval false' returned true" + exit 1 +fi +echo "passed" +exit 0 +EOF + output="$(/bin/sh helper.sh)" + [ $? = 0 ] && return + + if [ -n "$output" ] + then + atf_fail "$output" + else + atf_fail "'eval false' exited from a tested context" + fi + +} + +atf_init_test_cases() { + atf_add_test_case evaltested +} diff --git a/bin/sh/t_exit.sh b/bin/sh/t_exit.sh new file mode 100755 index 000000000000..62c5869c009c --- /dev/null +++ b/bin/sh/t_exit.sh @@ -0,0 +1,105 @@ +# $NetBSD: t_exit.sh,v 1.3 2012/04/13 06:12:32 jruoho Exp $ +# +# Copyright (c) 2007 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +crud() { + test yes = no + + cat <<EOF +$? +EOF +} + +atf_test_case background +background_head() { + atf_set "descr" "Tests that sh(1) sets '$?' properly when running " \ + "a command in the background (PR bin/46327)" +} +background_body() { + atf_check -s exit:0 -o ignore -e ignore -x "true; true & echo $?" + atf_check -s exit:0 -o ignore -e ignore -x "false; true & echo $?" +} + +atf_test_case function +function_head() { + atf_set "descr" "Tests that \$? is correctly updated inside" \ + "a function" +} +function_body() { + foo=`crud` + atf_check_equal 'x$foo' 'x1' +} + +atf_test_case readout +readout_head() { + atf_set "descr" "Tests that \$? is correctly updated in a" \ + "compound expression" +} +readout_body() { + atf_check_equal '$( true && ! true | false; echo $? )' '0' +} + +atf_test_case trap_subshell +trap_subshell_head() { + atf_set "descr" "Tests that the trap statement in a subshell" \ + "works when the subshell exits" +} +trap_subshell_body() { + atf_check -s eq:0 -o inline:'exiting\n' -x \ + '( trap "echo exiting" EXIT; /usr/bin/true )' +} + +atf_test_case trap_zero__implicit_exit +trap_zero__implicit_exit_body() { + # PR bin/6764: sh works but ksh does not" + echo '( trap "echo exiting" 0 )' >helper.sh + atf_check -s eq:0 -o match:exiting -e empty /bin/sh helper.sh + atf_check -s eq:0 -o match:exiting -e empty /bin/ksh helper.sh +} + +atf_test_case trap_zero__explicit_exit +trap_zero__explicit_exit_body() { + echo '( trap "echo exiting" 0; exit )' >helper.sh + atf_check -s eq:0 -o match:exiting -e empty /bin/sh helper.sh + atf_check -s eq:0 -o match:exiting -e empty /bin/ksh helper.sh +} + +atf_test_case trap_zero__explicit_return +trap_zero__explicit_return_body() { + echo '( trap "echo exiting" 0; return )' >helper.sh + atf_check -s eq:0 -o match:exiting -e empty /bin/sh helper.sh + atf_check -s eq:0 -o match:exiting -e empty /bin/ksh helper.sh +} + +atf_init_test_cases() { + atf_add_test_case background + atf_add_test_case function + atf_add_test_case readout + atf_add_test_case trap_subshell + atf_add_test_case trap_zero__implicit_exit + atf_add_test_case trap_zero__explicit_exit + atf_add_test_case trap_zero__explicit_return +} diff --git a/bin/sh/t_expand.sh b/bin/sh/t_expand.sh new file mode 100755 index 000000000000..eeaad5f7db71 --- /dev/null +++ b/bin/sh/t_expand.sh @@ -0,0 +1,142 @@ +# $NetBSD: t_expand.sh,v 1.2 2013/10/06 21:05:50 ast Exp $ +# +# Copyright (c) 2007, 2009 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# This file tests the functions in expand.c. +# + +delim_argv() { + str= + while [ $# -gt 0 ]; do + if [ -z "${str}" ]; then + str=">$1<" + else + str="${str} >$1<" + fi + shift + done + echo ${str} +} + +atf_test_case dollar_at +dollar_at_head() { + atf_set "descr" "Somewhere between 2.0.2 and 3.0 the expansion" \ + "of the \$@ variable had been broken. Check for" \ + "this behavior." +} +dollar_at_body() { + # This one should work everywhere. + got=`echo "" "" | sed 's,$,EOL,'` + atf_check_equal ' EOL' '$got' + + # This code triggered the bug. + set -- "" "" + got=`echo "$@" | sed 's,$,EOL,'` + atf_check_equal ' EOL' '$got' + + set -- - + shift + n_arg() { echo $#; } + n_args=`n_arg "$@"` + atf_check_equal '0' '$n_args' +} + +atf_test_case dollar_at_with_text +dollar_at_with_text_head() { + atf_set "descr" "Test \$@ expansion when it is surrounded by text" \ + "within the quotes. PR bin/33956." +} +dollar_at_with_text_body() { + set -- + atf_check_equal '' "$(delim_argv "$@")" + atf_check_equal '>foobar<' "$(delim_argv "foo$@bar")" + atf_check_equal '>foo bar<' "$(delim_argv "foo $@ bar")" + + set -- a b c + atf_check_equal '>a< >b< >c<' "$(delim_argv "$@")" + atf_check_equal '>fooa< >b< >cbar<' "$(delim_argv "foo$@bar")" + atf_check_equal '>foo a< >b< >c bar<' "$(delim_argv "foo $@ bar")" +} + +atf_test_case strip +strip_head() { + atf_set "descr" "Checks that the %% operator works and strips" \ + "the contents of a variable from the given point" \ + "to the end" +} +strip_body() { + line='#define bindir "/usr/bin" /* comment */' + stripped='#define bindir "/usr/bin" ' + atf_expect_fail "PR bin/43469" + atf_check_equal '$stripped' '${line%%/\**}' +} + +atf_test_case varpattern_backslashes +varpattern_backslashes_head() { + atf_set "descr" "Tests that protecting wildcards with backslashes" \ + "works in variable patterns." +} +varpattern_backslashes_body() { + line='/foo/bar/*/baz' + stripped='/foo/bar/' + atf_check_equal $stripped ${line%%\**} +} + +atf_test_case arithmetic +arithmetic_head() { + atf_set "descr" "POSIX requires shell arithmetic to use signed" \ + "long or a wider type. We use intmax_t, so at" \ + "least 64 bits should be available. Make sure" \ + "this is true." +} +arithmetic_body() { + atf_check_equal '3' '$((1 + 2))' + atf_check_equal '2147483647' '$((0x7fffffff))' + atf_check_equal '9223372036854775807' '$(((1 << 63) - 1))' +} + +atf_test_case iteration_on_null_parameter +iteration_on_null_parameter_head() { + atf_set "descr" "Check iteration of \$@ in for loop when set to null;" \ + "the error \"sh: @: parameter not set\" is incorrect." \ + "PR bin/48202." +} +iteration_on_null_parameter_body() { + s1=`/bin/sh -uc 'N=; set -- ${N}; for X; do echo "[$X]"; done' 2>&1` + s2=`/bin/sh -uc 'N=; set -- ${N:-}; for X; do echo "[$X]"; done' 2>&1` + atf_check_equal '' '$s1' + atf_check_equal '[]' '$s2' +} + +atf_init_test_cases() { + atf_add_test_case dollar_at + atf_add_test_case dollar_at_with_text + atf_add_test_case strip + atf_add_test_case varpattern_backslashes + atf_add_test_case arithmetic + atf_add_test_case iteration_on_null_parameter +} diff --git a/bin/sh/t_fsplit.sh b/bin/sh/t_fsplit.sh new file mode 100755 index 000000000000..2c3dbae23dc8 --- /dev/null +++ b/bin/sh/t_fsplit.sh @@ -0,0 +1,186 @@ +# $NetBSD: t_fsplit.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# +# Copyright (c) 2007 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# The standard +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html +# explains (section 2.6) that Field splitting should be performed on the +# result of variable expansions. +# In particular this means that in ${x-word}, 'word' must be expanded as if +# the "${x-" and "}" were absent from the input line. +# +# So: sh -c 'set ${x-a b c}; echo $#' should give 3. +# + +nl=' +' + +check() +{ + result="$(eval $1)" + # Remove newlines + oifs="$IFS" + IFS="$nl" + result="$(echo $result)" + IFS="$oifs" + if [ "$2" != "$result" ] + then + atf_fail "expected [$2], found [$result]" + fi +} + +atf_test_case for +for_head() { + atf_set "descr" "Checks field splitting in for loops" +} +for_body() { + unset x + + # Since I managed to break this, leave the test in + check 'for f in $x; do echo x${f}y; done' '' +} + +atf_test_case default_val +default_val_head() { + atf_set "descr" "Checks field splitting in variable default values" +} +default_val_body() { + unset x + + # Check that IFS is applied to text from ${x-...} unless it is inside + # any set of "..." + check 'set ${x-a b c}; echo $#' 3 + check 'for i in ${x-a b c}; do echo "z${i}z"; done' 'zaz zbz zcz' + check 'for i in ${x-"a b" c}; do echo "z${i}z"; done' 'za bz zcz' + check 'for i in ${x-"a ${x-b c}" d}; do echo "z${i}z"; done' 'za b cz zdz' + check 'for i in ${x-"a ${x-"b c"}" d}; do echo "z${i}z"; done' 'za b cz zdz' + check 'for i in ${x-a ${x-"b c"} d}; do echo "z${i}z"; done' 'zaz zb cz zdz' + check 'for i in ${x-a ${x-b c} d}; do echo "z${i}z"; done' 'zaz zbz zcz zdz' +} + +atf_test_case ifs_alpha +ifs_alpha_head() { + atf_set "descr" "Checks that field splitting works with alphabetic" \ + "characters" +} +ifs_alpha_body() { + unset x + + # repeat with an alphabetic in IFS + check 'IFS=q; set ${x-aqbqc}; echo $#' 3 + check 'IFS=q; for i in ${x-aqbqc}; do echo "z${i}z"; done' 'zaz zbz zcz' + check 'IFS=q; for i in ${x-"aqb"qc}; do echo "z${i}z"; done' 'zaqbz zcz' + check 'IFS=q; for i in ${x-"aq${x-bqc}"qd}; do echo "z${i}z"; done' 'zaqbqcz zdz' + check 'IFS=q; for i in ${x-"aq${x-"bqc"}"qd}; do echo "z${i}z"; done' 'zaqbqcz zdz' + check 'IFS=q; for i in ${x-aq${x-"bqc"}qd}; do echo "z${i}z"; done' 'zaz zbqcz zdz' +} + +atf_test_case quote +quote_head() { + atf_set "descr" "Checks that field splitting works with multi-word" \ + "fields" +} +quote_body() { + unset x + + # Some quote propagation checks + check 'set "${x-a b c}"; echo $#' 1 + check 'set "${x-"a b" c}"; echo $1' 'a b c' + check 'for i in "${x-a b c}"; do echo "z${i}z"; done' 'za b cz' +} + +atf_test_case dollar_at +dollar_at_head() { + atf_set "descr" "Checks that field splitting works when expanding" \ + "\$@" +} +dollar_at_body() { + unset x + + # Check we get "$@" right + check 'set ""; for i; do echo "z${i}z"; done' 'zz' + check 'set ""; for i in "$@"; do echo "z${i}z"; done' 'zz' + check 'set "" ""; for i; do echo "z${i}z"; done' 'zz zz' + check 'set "" ""; for i in "$@"; do echo "z${i}z"; done' 'zz zz' + check 'set "" ""; for i in $@; do echo "z${i}z"; done' '' + check 'set "a b" c; for i; do echo "z${i}z"; done' 'za bz zcz' + check 'set "a b" c; for i in "$@"; do echo "z${i}z"; done' 'za bz zcz' + check 'set "a b" c; for i in $@; do echo "z${i}z"; done' 'zaz zbz zcz' + check 'set " a b " c; for i in "$@"; do echo "z${i}z"; done' 'z a b z zcz' + check 'set --; for i in x"$@"x; do echo "z${i}z"; done' 'zxxz' + check 'set a; for i in x"$@"x; do echo "z${i}z"; done' 'zxaxz' + check 'set a b; for i in x"$@"x; do echo "z${i}z"; done' 'zxaz zbxz' +} + +atf_test_case ifs +ifs_head() { + atf_set "descr" "Checks that IFS correctly configures field" \ + "splitting behavior" +} +ifs_body() { + unset x + + # Some IFS tests + check 't="-- "; IFS=" "; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '0' + check 't=" x"; IFS=" x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '1' + check 't=" x "; IFS=" x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '1' + check 't=axb; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 a:b' + check 't="a x b"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 a : b' + check 't="a xx b"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '3 a :: b' + check 't="a xx b"; IFS="x "; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '3 a::b' + # A recent 'clarification' means that a single trailing IFS non-whitespace + # doesn't generate an empty parameter + check 't="xax"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 :a' + check 't="xax "; IFS="x "; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 :a' + # Verify that IFS isn't being applied where it shouldn't be. + check 'IFS="x"; set axb; IFS=":"; r="$*"; IFS=; echo $# $r' '1 axb' +} + +atf_test_case var_length +var_length_head() { + atf_set "descr" "Checks that field splitting works when expanding" \ + "a variable's length" +} +var_length_body() { + unset x + + # Check that we apply IFS to ${#var} + long=12345678123456781234567812345678 + long=$long$long$long$long + check 'echo ${#long}; IFS=2; echo ${#long}; set 1 ${#long};echo $#' '128 1 8 3' + check 'IFS=2; set ${x-${#long}}; IFS=" "; echo $* $#' '1 8 2' + check 'IFS=2; set ${x-"${#long}"}; IFS=" "; echo $* $#' '128 1' +} + +atf_init_test_cases() { + atf_add_test_case for + atf_add_test_case default_val + atf_add_test_case ifs_alpha + atf_add_test_case quote + atf_add_test_case dollar_at + atf_add_test_case ifs + atf_add_test_case var_length +} diff --git a/bin/sh/t_here.sh b/bin/sh/t_here.sh new file mode 100755 index 000000000000..250c686aa39a --- /dev/null +++ b/bin/sh/t_here.sh @@ -0,0 +1,73 @@ +# $NetBSD: t_here.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# +# Copyright (c) 2007 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +nl=' +' + +check() +{ + SVIFS="$IFS" + result="$(eval $1)" + # Remove newlines + oifs="$IFS" + IFS="$nl" + result="$(echo $result)" + IFS="$oifs" + if [ "$2" != "$result" ] + then + atf_fail "expected [$2], found [$result]" + fi + IFS="$SVIFS" +} + +atf_test_case all +all_head() { + atf_set "descr" "Basic tests for here documents" +} +all_body() { + y=x + + IFS= + check 'x=`cat <<EOF'$nl'text'${nl}EOF$nl'`; echo $x' 'text' + check 'x=`cat <<\EOF'$nl'text'${nl}EOF$nl'`; echo $x' 'text' + + check 'x=`cat <<EOF'$nl'te${y}t'${nl}EOF$nl'`; echo $x' 'text' + check 'x=`cat <<\EOF'$nl'te${y}t'${nl}EOF$nl'`; echo $x' 'te${y}t' + check 'x=`cat <<"EOF"'$nl'te${y}t'${nl}EOF$nl'`; echo $x' 'te${y}t' + check 'x=`cat <<'"'EOF'"$nl'te${y}t'${nl}EOF$nl'`; echo $x' 'te${y}t' + + check 'x=`cat <<EOF'$nl'te'"'"'xt'${nl}EOF$nl'`; echo $x' 'te'"'"'xt' + check 'x=`cat <<\EOF'$nl'te'"'"'xt'${nl}EOF$nl'`; echo $x' 'te'"'"'xt' + check 'x=`cat <<"EOF"'$nl'te'"'"'xt'${nl}EOF$nl'`; echo $x' 'te'"'"'xt' + + check 'x=`cat <<EOF'$nl'te'"'"'${y}t'${nl}EOF$nl'`; echo $x' 'te'"'"'xt' + check 'x=`cat <<EOF'$nl'te'"''"'${y}t'${nl}EOF$nl'`; echo $x' 'te'"''"'xt' +} + +atf_init_test_cases() { + atf_add_test_case all +} diff --git a/bin/sh/t_set_e.sh b/bin/sh/t_set_e.sh new file mode 100755 index 000000000000..8dfe6e411746 --- /dev/null +++ b/bin/sh/t_set_e.sh @@ -0,0 +1,289 @@ +# $NetBSD: t_set_e.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# +# Copyright (c) 2007 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# references: +# http://www.opengroup.org/onlinepubs/009695399/utilities/set.html +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html + +# the implementation of "sh" to test +: ${TEST_SH:="sh"} + +failwith() +{ + case "$SH_FAILS" in + "") SH_FAILS=`echo "$1"`;; + *) SH_FAILS="$SH_FAILS"`echo; echo "$1"`;; + esac +} + +check1() +{ + #echo "$TEST_SH -c $1" + result=`$TEST_SH -c "$1" 2>/dev/null | tr '\n' ' ' | sed 's/ *$//'` + if [ "$result" != "$2" ]; then + MSG=`printf "%-56s %-8s %s" "$3" "$result" "$2"` + failwith "$MSG" + failcount=`expr $failcount + 1` + fi + count=`expr $count + 1` +} + +# direct check: try the given expression. +dcheck() +{ + check1 "$1" "$2" "$1" +} + +# eval check: indirect through eval. +# as of this writing, this changes the behavior pretty drastically and +# is thus important to test. (PR bin/29861) +echeck() +{ + check1 'eval '"'($1)'" "$2" "eval '($1)'" +} + +atf_test_case all +all_head() { + atf_set "descr" "Tests that 'set -e' works correctly" +} +all_body() { + count=0 + failcount=0 + + # make sure exiting from a subshell behaves as expected + dcheck '(set -e; exit 1; echo ERR$?); echo OK$?' 'OK1' + echeck '(set -e; exit 1; echo ERR$?); echo OK$?' 'OK1' + + # first, check basic functioning. + # The ERR shouldn't print; the result of the () should be 1. + # Henceforth we'll assume that we don't need to check $?. + dcheck '(set -e; false; echo ERR$?); echo -n OK$?' 'OK1' + echeck '(set -e; false; echo ERR$?); echo -n OK$?' 'OK1' + + # these cases should be equivalent to the preceding. + dcheck '(set -e; /nonexistent; echo ERR); echo OK' 'OK' + echeck '(set -e; /nonexistent; echo ERR); echo OK' 'OK' + dcheck '(set -e; nonexistent-program-on-path; echo ERR); echo OK' 'OK' + echeck '(set -e; nonexistent-program-on-path; echo ERR); echo OK' 'OK' + dcheck 'f() { false; }; (set -e; f; echo ERR); echo OK' 'OK' + echeck 'f() { false; }; (set -e; f; echo ERR); echo OK' 'OK' + dcheck 'f() { return 1; }; (set -e; f; echo ERR); echo OK' 'OK' + echeck 'f() { return 1; }; (set -e; f; echo ERR); echo OK' 'OK' + + # but! with set -e, the false should cause an *immediate* exit. + # The return form should not, as such, but there's no way to + # distinguish it. + dcheck 'f() { false; echo ERR; }; (set -e; f); echo OK' 'OK' + echeck 'f() { false; echo ERR; }; (set -e; f); echo OK' 'OK' + + # set is not scoped, so these should not exit at all. + dcheck 'f() { set +e; false; echo OK; }; (set -e; f); echo OK' 'OK OK' + echeck 'f() { set +e; false; echo OK; }; (set -e; f); echo OK' 'OK OK' + + # according to the standard, only failing *simple* commands + # cause an exit under -e. () is not a simple command. + # Correct (per POSIX): + #dcheck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK OK' + #echeck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK OK' + # Wrong current behavior: + dcheck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK' + echeck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK' + + # make sure an inner nested shell does exit though. + dcheck '(set -e; (false; echo ERR)); echo OK' 'OK' + + # The left hand side of an || or && is explicitly tested and + # thus should not cause an exit. Furthermore, because a || or + # && expression is not a simple command, there should be no + # exit even if the overall result is false. + dcheck '(set -e; false || true; echo OK); echo OK' 'OK OK' + echeck '(set -e; false || true; echo OK); echo OK' 'OK OK' + dcheck '(set -e; false && true; echo OK); echo OK' 'OK OK' + echeck '(set -e; false && true; echo OK); echo OK' 'OK OK' + + # However, the right hand side is not tested, so a failure + # there *should* cause an exit, regardless of whether it + # appears inside a non-simple command. + # + # Note that in at least one place the standard does not + # distinguish between the left and right hand sides of + # logical operators. It is possible that for strict + # compliance these need to not exit; however, if so that + # should probably be limited to when some strict-posix setting + # is in effect and tested accordingly. + # + dcheck '(set -e; false || false; echo ERR); echo OK' 'OK' + dcheck '(set -e; true && false; echo ERR); echo OK' 'OK' + echeck '(set -e; false || false; echo ERR); echo OK' 'OK' + echeck '(set -e; true && false; echo ERR); echo OK' 'OK' + + # correct: + #dcheck '(set -e; false && false; echo ERR); echo OK' 'OK' + #echeck '(set -e; false && false; echo ERR); echo OK' 'OK' + + # wrong current behavior: + dcheck '(set -e; false && false; echo ERR); echo OK' 'ERR OK' + echeck '(set -e; false && false; echo ERR); echo OK' 'ERR OK' + + # A failure that is not reached because of short-circuit + # evaluation should not cause an exit, however. + dcheck '(set -e; true || false; echo OK); echo OK' 'OK OK' + echeck '(set -e; true || false; echo OK); echo OK' 'OK OK' + + # For completeness, test the other two combinations. + dcheck '(set -e; true || true; echo OK); echo OK' 'OK OK' + dcheck '(set -e; true && true; echo OK); echo OK' 'OK OK' + echeck '(set -e; true || true; echo OK); echo OK' 'OK OK' + echeck '(set -e; true && true; echo OK); echo OK' 'OK OK' + + # likewise, none of these should exit. + dcheck '(set -e; while false; do :; done; echo OK); echo OK' 'OK OK' + dcheck '(set -e; if false; then :; fi; echo OK); echo OK' 'OK OK' + # problematic :-) + #dcheck '(set -e; until false; do :; done; echo OK); echo OK' 'OK OK' + dcheck '(set -e; until [ "$t" = 1 ]; do t=1; done; echo OK); echo OK' \ + 'OK OK' + echeck '(set -e; while false; do :; done; echo OK); echo OK' 'OK OK' + echeck '(set -e; if false; then :; fi; echo OK); echo OK' 'OK OK' + echeck '(set -e; until [ "$t" = 1 ]; do t=1; done; echo OK); echo OK' \ + 'OK OK' + + # the bang operator tests its argument and thus the argument + # should not cause an exit. it is also not a simple command (I + # believe) so it also shouldn't exit even if it yields a false + # result. + dcheck '(set -e; ! false; echo OK); echo OK' 'OK OK' + dcheck '(set -e; ! true; echo OK); echo OK' 'OK OK' + echeck '(set -e; ! false; echo OK); echo OK' 'OK OK' + echeck '(set -e; ! true; echo OK); echo OK' 'OK OK' + + # combined case with () and &&; the inner expression is false + # but does not itself exit, and the () should not cause an + # exit even when failing. + # correct: + #dcheck '(set -e; (false && true); echo OK); echo OK' 'OK OK' + #echeck '(set -e; (false && true); echo OK); echo OK' 'OK OK' + # wrong current behavior: + dcheck '(set -e; (false && true); echo OK); echo OK' 'OK' + echeck '(set -e; (false && true); echo OK); echo OK' 'OK' + + # pipelines. only the right-hand end is significant. + dcheck '(set -e; false | true; echo OK); echo OK' 'OK OK' + echeck '(set -e; false | true; echo OK); echo OK' 'OK OK' + dcheck '(set -e; true | false; echo ERR); echo OK' 'OK' + echeck '(set -e; true | false; echo ERR); echo OK' 'OK' + + dcheck '(set -e; while true | false; do :; done; echo OK); echo OK' \ + 'OK OK' + dcheck '(set -e; if true | false; then :; fi; echo OK); echo OK' \ + 'OK OK' + + + # According to dsl@ in PR bin/32282, () is not defined as a + # subshell, only as a grouping operator [and a scope, I guess] + # so the nested false ought to cause the whole shell to exit, + # not just the subshell. dholland@ would like to see C&V, + # because that seems like a bad idea. (Among other things, it + # would break all the above test logic, which relies on being + # able to isolate set -e behavior inside ().) However, I'm + # going to put these tests here to make sure the issue gets + # dealt with sometime. + # + # XXX: the second set has been disabled in the name of making + # all tests "pass". + + # 1. error if the whole shell exits (current behavior) + dcheck 'echo OK; (set -e; false); echo OK' 'OK OK' + echeck 'echo OK; (set -e; false); echo OK' 'OK OK' + # 2. error if the whole shell does not exit (dsl's suggested behavior) + #dcheck 'echo OK; (set -e; false); echo ERR' 'OK' + #echeck 'echo OK; (set -e; false); echo ERR' 'OK' + + # The current behavior of the shell is that it exits out as + # far as -e is set and then stops. This is probably a + # consequence of it handling () wrong, but it's a somewhat + # curious compromise position between 1. and 2. above. + dcheck '(set -e; (false; echo ERR); echo ERR); echo OK' 'OK' + echeck '(set -e; (false; echo ERR); echo ERR); echo OK' 'OK' + + # backquote expansion (PR bin/17514) + + # correct + #dcheck '(set -e; echo ERR `false`; echo ERR); echo OK' 'OK' + #dcheck '(set -e; echo ERR $(false); echo ERR); echo OK' 'OK' + #dcheck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'OK' + #dcheck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'OK' + # wrong current behavior + dcheck '(set -e; echo ERR `false`; echo ERR); echo OK' 'ERR ERR OK' + dcheck '(set -e; echo ERR $(false); echo ERR); echo OK' 'ERR ERR OK' + dcheck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'ERR ERR OK' + dcheck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'ERR ERR OK' + + dcheck '(set -e; x=`false`; echo ERR); echo OK' 'OK' + dcheck '(set -e; x=$(false); echo ERR); echo OK' 'OK' + dcheck '(set -e; x=`exit 3`; echo ERR); echo OK' 'OK' + dcheck '(set -e; x=$(exit 3); echo ERR); echo OK' 'OK' + + # correct + #echeck '(set -e; echo ERR `false`; echo ERR); echo OK' 'OK' + #echeck '(set -e; echo ERR $(false); echo ERR); echo OK' 'OK' + #echeck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'OK' + #echeck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'OK' + + # wrong current behavior + echeck '(set -e; echo ERR `false`; echo ERR); echo OK' 'ERR ERR OK' + echeck '(set -e; echo ERR $(false); echo ERR); echo OK' 'ERR ERR OK' + echeck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'ERR ERR OK' + echeck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'ERR ERR OK' + + echeck '(set -e; x=`false`; echo ERR); echo OK' 'OK' + echeck '(set -e; x=$(false); echo ERR); echo OK' 'OK' + echeck '(set -e; x=`exit 3`; echo ERR); echo OK' 'OK' + echeck '(set -e; x=$(exit 3); echo ERR); echo OK' 'OK' + + # shift (PR bin/37493) + # correct + #dcheck '(set -e; shift || true; echo OK); echo OK' 'OK OK' + #echeck '(set -e; shift || true; echo OK); echo OK' 'OK OK' + # wrong current behavior + dcheck '(set -e; shift || true; echo OK); echo OK' 'OK' + echeck '(set -e; shift || true; echo OK); echo OK' 'OK' + + # Done. + + if [ "x$SH_FAILS" != x ]; then + printf '%-56s %-8s %s\n' "Expression" "Result" "Should be" + echo "$SH_FAILS" + atf_fail "$failcount of $count failed cases" + else + atf_pass + fi +} + +atf_init_test_cases() { + atf_add_test_case all +} diff --git a/bin/sh/t_ulimit.sh b/bin/sh/t_ulimit.sh new file mode 100755 index 000000000000..3e7c0a68e70f --- /dev/null +++ b/bin/sh/t_ulimit.sh @@ -0,0 +1,46 @@ +# $NetBSD: t_ulimit.sh,v 1.1 2012/06/11 18:32:59 njoly Exp $ +# +# Copyright (c) 2012 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# ulimit builtin test. + +atf_test_case limits +limits_head() { + atf_set "descr" "Checks for limits flags" +} +limits_body() { + atf_check -s eq:0 -o ignore -e empty \ + /bin/sh -c "ulimit -a" + for l in $(ulimit -a | sed 's,^.*(,,;s, .*$,,'); + do + atf_check -s eq:0 -o ignore -e empty \ + /bin/sh -c "ulimit $l" + done +} + +atf_init_test_cases() { + atf_add_test_case limits +} diff --git a/bin/sh/t_varquote.sh b/bin/sh/t_varquote.sh new file mode 100755 index 000000000000..17687779637a --- /dev/null +++ b/bin/sh/t_varquote.sh @@ -0,0 +1,81 @@ +# $NetBSD: t_varquote.sh,v 1.2 2012/03/25 18:50:19 christos Exp $ +# +# Copyright (c) 2007 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# Variable quoting test. + +check() { + if [ "$1" != "$2" ] + then + atf_fail "expected [$2], found [$1]" 1>&2 + fi +} + +atf_test_case all +all_head() { + atf_set "descr" "Basic checks for variable quoting" +} +all_body() { + foo='${a:-foo}' + check "$foo" '${a:-foo}' + + foo="${a:-foo}" + check "$foo" "foo" + + foo=${a:-"'{}'"} + check "$foo" "'{}'" + + foo=${a:-${b:-"'{}'"}} + check "$foo" "'{}'" + + foo="${a:-"'{}'"}" + check "$foo" "'{}'" + + foo="${a:-${b:-"${c:-${d:-"x}"}}y}"}}z}" + # " z*" + # ${a:- } + # ${b:- } + # " y*" + # ${c:- } + # ${d:- } + # "x*" + check "$foo" "x}y}z}" +} + +atf_test_case nested_quotes_multiword +nested_quotes_multiword_head() { + atf_set "descr" "Tests that having nested quoting in a multi-word" \ + "string works (PR bin/43597)" +} +nested_quotes_multiword_body() { + atf_check -s eq:0 -o match:"first-word second-word" -e empty \ + /bin/sh -c 'echo "${foo:="first-word"} second-word"' +} + +atf_init_test_cases() { + atf_add_test_case all + atf_add_test_case nested_quotes_multiword +} diff --git a/bin/sh/t_wait.sh b/bin/sh/t_wait.sh new file mode 100755 index 000000000000..99b47df7ad27 --- /dev/null +++ b/bin/sh/t_wait.sh @@ -0,0 +1,59 @@ +# $NetBSD: t_wait.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# +# Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +atf_test_case individual +individual_head() { + atf_set "descr" "Tests that waiting for individual jobs works" +} +individual_body() { + # atf-sh confuses wait for some reason; work it around by creating + # a helper script that executes /bin/sh directly. + cat >helper.sh <<EOF +sleep 3 & +sleep 1 & + +wait %1 +if [ \$? -ne 0 ]; then + echo "Waiting of first job failed" + exit 1 +fi + +wait %2 +if [ \$? -ne 0 ]; then + echo "Waiting of second job failed" + exit 1 +fi + +exit 0 +EOF + output=$(/bin/sh helper.sh) + [ $? -eq 0 ] || atf_fail "${output}" +} + +atf_init_test_cases() { + atf_add_test_case individual +} |
