diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp index 136f1c6e..4ad21cf0 100644 --- a/test/lib/completions/finger.exp +++ b/test/lib/completions/finger.exp @@ -30,19 +30,6 @@ assert_complete_partial [exec bash -c "compgen -A user"] "finger" sync_after_int -set test "Tab should complete hostnames" -# Build string list of hostnames -set hosts {} -foreach h [get_hosts] { - # Prefix hosts with username 'test@' - lappend hosts "test@$h" -}; # foreach -assert_complete_partial $hosts finger test@ $test - - -sync_after_int - - set test "Tab should complete partial hostname" # Build string list of hostnames, starting with the character of the first # host. diff --git a/test/lib/library.exp b/test/lib/library.exp index 436c70cb..ba225fc3 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -311,10 +311,15 @@ proc get_hosts {} { # Get hostnames according to avahi # @return list Hostnames proc get_hosts_avahi {} { - set hosts [exec bash -c { + # Retrieving hosts is successful? + if { [catch {exec bash -c { type avahi-browse >&/dev/null && [ -n "$(pidof avahi-daemon)" ] - avahi-browse -cpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u - }] + && avahi-browse -cpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u + }} hosts] } { + # No, retrieving hosts yields error; + # Reset hosts + set hosts {} + }; # if return $hosts }; # get_hosts_avahi()