diff options
author | jilles <jilles@FreeBSD.org> | 2010-01-03 15:01:38 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-01-03 15:01:38 +0000 |
commit | e314ef3281624dea0d944acf3c131dcd34fdc9ea (patch) | |
tree | 72fdcb06149110f26ca91fd340731d63fcd4eedc /tools/regression | |
parent | c9785476fdd9a5a73497c839d02721d23836edf1 (diff) | |
download | FreeBSD-src-e314ef3281624dea0d944acf3c131dcd34fdc9ea.zip FreeBSD-src-e314ef3281624dea0d944acf3c131dcd34fdc9ea.tar.gz |
sh: Send the "not found" message for builtin <cmd> to redirected fd 2.
Diffstat (limited to 'tools/regression')
-rw-r--r-- | tools/regression/bin/sh/builtins/builtin1.0 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/builtin1.0 b/tools/regression/bin/sh/builtins/builtin1.0 new file mode 100644 index 0000000..b608385 --- /dev/null +++ b/tools/regression/bin/sh/builtins/builtin1.0 @@ -0,0 +1,31 @@ +# $FreeBSD$ + +failures=0 + +check() { + if ! eval "[ $* ]"; then + echo "Failed: $*" + : $((failures += 1)) + fi +} + +builtin : || echo "Bad return code at $LINENO" +builtin true || echo "Bad return code at $LINENO" +builtin ls 2>/dev/null && echo "Bad return code at $LINENO" +check '"$(builtin pwd)" = "$(pwd)"' +check '-z "$(builtin :)"' +check '-z "$(builtin true)"' +check '-z "$( (builtin nosuchtool) 2>/dev/null)"' +check '-z "$(builtin nosuchtool 2>/dev/null)"' +check '-z "$(builtin nosuchtool 2>/dev/null; :)"' +check '-z "$( (builtin ls) 2>/dev/null)"' +check '-z "$(builtin ls 2>/dev/null)"' +check '-z "$(builtin ls 2>/dev/null; :)"' +check '-n "$( (builtin nosuchtool) 2>&1)"' +check '-n "$(builtin nosuchtool 2>&1)"' +check '-n "$(builtin nosuchtool 2>&1; :)"' +check '-n "$( (builtin ls) 2>&1)"' +check '-n "$(builtin ls 2>&1)"' +check '-n "$(builtin ls 2>&1; :)"' + +exit $((failures > 0)) |