summaryrefslogtreecommitdiffstats
path: root/tools/regression/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-01-03 15:01:38 +0000
committerjilles <jilles@FreeBSD.org>2010-01-03 15:01:38 +0000
commite314ef3281624dea0d944acf3c131dcd34fdc9ea (patch)
tree72fdcb06149110f26ca91fd340731d63fcd4eedc /tools/regression/bin
parentc9785476fdd9a5a73497c839d02721d23836edf1 (diff)
downloadFreeBSD-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/bin')
-rw-r--r--tools/regression/bin/sh/builtins/builtin1.031
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))
OpenPOWER on IntegriCloud