(testsuite) Centralized tcl function `get_hosts'

This commit is contained in:
Freddy Vulto 2009-06-19 14:56:36 +02:00
parent 49f739a515
commit c769eeaf8c
3 changed files with 13 additions and 11 deletions

View File

@ -63,7 +63,7 @@ sync_after_int
set test "Tab should complete partial hostname"
assert_complete_partial [exec bash -c "compgen -A hostname"] "ssh"
assert_complete_partial [get_hosts] "ssh"
sync_after_int

View File

@ -213,6 +213,18 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
}; # assert_exec()
# Get known hostnames
# @return list Hostnames
proc get_hosts {} {
set hosts [exec bash -c "compgen -A hostname"]
lappend hosts [exec bash -c {
type avahi-browse >&/dev/null &&
avahi-browse -kcpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u
}]
return $hosts
}; # get_hosts()
# Expect items.
# Break items into chunks because `expect' seems to have a limited buffer size
# @param list $items

View File

@ -8,16 +8,6 @@ proc teardown {} {
}; # teardown()
proc get_hosts {} {
set hosts [exec bash -c "compgen -A hostname"]
lappend hosts [exec bash -c {
type avahi-browse >&/dev/null &&
avahi-browse -kcpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u
}]
return $hosts
}; # get_hosts()
setup