From 8e6aa134e5ad932e4809cecaf9117c734ef3a9c7 Mon Sep 17 00:00:00 2001 From: jilles Date: Thu, 31 Dec 2009 16:13:33 +0000 Subject: sh: Allow command -pv and command -pV (lookup using _PATH_STDPATH). --- tools/regression/bin/sh/builtins/command6.0 | 15 +++++++++++ tools/regression/bin/sh/builtins/command6.0.stdout | 8 ++++++ tools/regression/bin/sh/builtins/command7.0 | 29 ++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 tools/regression/bin/sh/builtins/command6.0 create mode 100644 tools/regression/bin/sh/builtins/command6.0.stdout create mode 100644 tools/regression/bin/sh/builtins/command7.0 (limited to 'tools') 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)) -- cgit v1.1