From 03526772fa767a1a370faed1047088744e32091a Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Sun, 13 Sep 2009 18:05:58 +0200 Subject: [PATCH] Fixes testsuite: - Fix get_hosts_avahi() if avahi-browse not available - Removed test "Tab should complete hostnames" from finger since it's returning (for the moment) undetectable ip-addresses from known_hosts files. Furthermore the next test "Tab should complete partial hostname" is testing the same. --- test/lib/completions/finger.exp | 13 ------------- test/lib/library.exp | 11 ++++++++--- 2 files changed, 8 insertions(+), 16 deletions(-) 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()