(testsuite) Centralized tcl function `get_hosts'
This commit is contained in:
parent
49f739a515
commit
c769eeaf8c
@ -63,7 +63,7 @@ sync_after_int
|
|||||||
|
|
||||||
|
|
||||||
set test "Tab should complete partial hostname"
|
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
|
sync_after_int
|
||||||
|
@ -213,6 +213,18 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
|
|||||||
}; # assert_exec()
|
}; # 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.
|
# Expect items.
|
||||||
# Break items into chunks because `expect' seems to have a limited buffer size
|
# Break items into chunks because `expect' seems to have a limited buffer size
|
||||||
# @param list $items
|
# @param list $items
|
||||||
|
@ -8,16 +8,6 @@ proc teardown {} {
|
|||||||
}; # 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
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user