(testsuite) Expand PATH with 'sbin' directories
This allows for testing completions of system administrator commands, which are installed via the same PATH expansion in `bash_completion.have()'
This commit is contained in:
parent
da990d18d9
commit
827ad88ebb
@ -167,6 +167,8 @@ complete -b builtin
|
|||||||
have()
|
have()
|
||||||
{
|
{
|
||||||
unset -v have
|
unset -v have
|
||||||
|
# Completions for system administrator commands are installed as well in
|
||||||
|
# case completion is attempted via `sudo command ...'.
|
||||||
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
|
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
|
||||||
have="yes"
|
have="yes"
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@ export INPUTRC=$TESTDIR/config/inputrc
|
|||||||
[ "$CRON" ] || export TERM=dummy
|
[ "$CRON" ] || export TERM=dummy
|
||||||
# Ensure enough columns so expect doesn't have to care about line breaks
|
# Ensure enough columns so expect doesn't have to care about line breaks
|
||||||
stty columns 150
|
stty columns 150
|
||||||
|
# Also test completions of system administrator commands, which are
|
||||||
|
# installed via the same PATH expansion in `bash_completion.have()'
|
||||||
|
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
|
||||||
|
|
||||||
# Make sure default settings are in effect
|
# Make sure default settings are in effect
|
||||||
unset -v \
|
unset -v \
|
||||||
|
@ -481,10 +481,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} {
|
|||||||
# @param string $file (optional) File to source/run. Default is
|
# @param string $file (optional) File to source/run. Default is
|
||||||
# "lib/completions/$cmd.exp".
|
# "lib/completions/$cmd.exp".
|
||||||
proc assert_source_completions {command {file ""}} {
|
proc assert_source_completions {command {file ""}} {
|
||||||
if {
|
if {[is_bash_completion_installed_for $command]} {
|
||||||
[is_bash_completion_installed_for $command] &&
|
|
||||||
[assert_bash_type $command]
|
|
||||||
} {
|
|
||||||
if {[string length $file] == 0} {
|
if {[string length $file] == 0} {
|
||||||
set file "lib/completions/$command.exp"
|
set file "lib/completions/$command.exp"
|
||||||
}
|
}
|
||||||
@ -492,7 +489,7 @@ proc assert_source_completions {command {file ""}} {
|
|||||||
} else {
|
} else {
|
||||||
untested $command
|
untested $command
|
||||||
}
|
}
|
||||||
}; # assert_source_completions()
|
}
|
||||||
|
|
||||||
|
|
||||||
# Sort list.
|
# Sort list.
|
||||||
@ -502,7 +499,7 @@ proc assert_source_completions {command {file ""}} {
|
|||||||
# @return list Sort list
|
# @return list Sort list
|
||||||
proc bash_sort {items} {
|
proc bash_sort {items} {
|
||||||
return [split [exec sort << [join $items "\n"]] "\n"]
|
return [split [exec sort << [join $items "\n"]] "\n"]
|
||||||
}; # bash_sort()
|
}
|
||||||
|
|
||||||
|
|
||||||
# Get 'known' hostnames. Looks also in ssh's 'known_hosts' files.
|
# Get 'known' hostnames. Looks also in ssh's 'known_hosts' files.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user