Fix unit test _known_hosts_real
Test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE" now includes hosts reported by avahi.
This commit is contained in:
parent
1ed4fa2f62
commit
9af88e6bd4
@ -274,13 +274,10 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
|
||||
# @return list Hostnames
|
||||
proc get_hosts {} {
|
||||
set hosts [exec bash -c "compgen -A hostname"]
|
||||
# NOTE: Circumenventing `avahi_host' and appending directly to `hosts'
|
||||
# NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts'
|
||||
# causes an empty element to be inserted in `hosts'.
|
||||
# -- FVu, Fri Jul 17 23:11:46 CEST 2009
|
||||
set avahi_hosts [exec bash -c {
|
||||
type avahi-browse >&/dev/null && [ -n "$(pidof avahi-daemon)" ]
|
||||
avahi-browse -cpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u
|
||||
}]
|
||||
set avahi_hosts [get_hosts_avahi]
|
||||
if {[llength $avahi_hosts] > 0} {
|
||||
lappend hosts $avahi_hosts
|
||||
}; # if
|
||||
@ -288,6 +285,17 @@ proc get_hosts {} {
|
||||
}; # get_hosts()
|
||||
|
||||
|
||||
# Get hostnames according to avahi
|
||||
# @return list Hostnames
|
||||
proc get_hosts_avahi {} {
|
||||
set hosts [exec bash -c {
|
||||
type avahi-browse >&/dev/null && [ -n "$(pidof avahi-daemon)" ]
|
||||
avahi-browse -cpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u
|
||||
}]
|
||||
return $hosts
|
||||
}; # get_hosts_avahi()
|
||||
|
||||
|
||||
# Get signals
|
||||
# This function is written in analogy to the bash function `_signals()' in
|
||||
# `bash_completion'.
|
||||
|
@ -82,7 +82,7 @@ sync_after_int
|
||||
|
||||
set test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE"
|
||||
assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE="
|
||||
set hosts {}
|
||||
set hosts [get_hosts_avahi]
|
||||
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
||||
# Hosts `doo' and `ike' are defined in ./fixtures/_known_hosts_real/known_hosts
|
||||
lappend hosts doo gee hus ike jar
|
||||
|
Loading…
x
Reference in New Issue
Block a user