summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-12-31 16:13:33 +0000
committerjilles <jilles@FreeBSD.org>2009-12-31 16:13:33 +0000
commit8e6aa134e5ad932e4809cecaf9117c734ef3a9c7 (patch)
tree5b0ca429ee15b88be553192b86c73d26bc2db531 /tools
parent1aa8466f894833794eb1be74ffcc4095cca42764 (diff)
downloadFreeBSD-src-8e6aa134e5ad932e4809cecaf9117c734ef3a9c7.zip
FreeBSD-src-8e6aa134e5ad932e4809cecaf9117c734ef3a9c7.tar.gz
sh: Allow command -pv and command -pV (lookup using _PATH_STDPATH).
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/builtins/command6.015
-rw-r--r--tools/regression/bin/sh/builtins/command6.0.stdout8
-rw-r--r--tools/regression/bin/sh/builtins/command7.029
3 files changed, 52 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/command6.0 b/tools/regression/bin/sh/builtins/command6.0
new file mode 100644
index 0000000..2ba836e
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/command6.0
@@ -0,0 +1,15 @@
+# $FreeBSD$
+PATH=/var/empty
+command -pV ls
+command -pV true
+command -pV /bin/ls
+
+fun() {
+}
+command -pV fun
+command -pV break
+command -pV if
+command -pV {
+
+alias foo=bar
+command -pV foo
diff --git a/tools/regression/bin/sh/builtins/command6.0.stdout b/tools/regression/bin/sh/builtins/command6.0.stdout
new file mode 100644
index 0000000..4cb2b11
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/command6.0.stdout
@@ -0,0 +1,8 @@
+ls is /bin/ls
+true is a shell builtin
+/bin/ls is /bin/ls
+fun is a shell function
+break is a special shell builtin
+if is a shell keyword
+{ is a shell keyword
+foo is an alias for bar
diff --git a/tools/regression/bin/sh/builtins/command7.0 b/tools/regression/bin/sh/builtins/command7.0
new file mode 100644
index 0000000..897a14c
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/command7.0
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+failures=0
+
+check() {
+ if ! eval "[ $* ]"; then
+ echo "Failed: $*"
+ : $((failures += 1))
+ fi
+}
+
+check '"$(PATH=/libexec command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
+check '"$(PATH=/libexec command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
+check '"$(PATH=/libexec command -pv ld-elf.so.1)" = ""'
+check '"$(PATH=/libexec command -pv ld-elf.so.1; :)" = ""'
+
+PATH=/libexec:$PATH
+
+check '"$(command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
+check '"$(command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"'
+check '"$(command -pv ld-elf.so.1)" = ""'
+check '"$(command -pv ld-elf.so.1; :)" = ""'
+
+PATH=/libexec
+
+check '"$(command -v ls)" = ""'
+check '"$(command -pv ls)" = "/bin/ls"'
+
+exit $((failures > 0))
OpenPOWER on IntegriCloud