Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / common.avahi
blobfba3e943815580b3330f3968cedc3ea04f5ba579
2 # Common shell routines for testing Avahi service discovery
3 # Copyright (c) 2013-2014 Red Hat.
6 # get standard environment, filters and checks
7 . ./common.product
8 . ./common.filter
9 . ./common.check
11 avahi_notrun_checks()
13     _get_libpcp_config
14     $service_discovery || _notrun "No support for service discovery"
16     # Is avahi-browse installed?
17     which avahi-browse >/dev/null 2>&1 || _notrun avahi-browse is not installed
19     # Is the avahi-daemon installed and running?  (maybe /sbin or /usr/sbin)
20     avahi-daemon --check 2>/dev/null || _notrun avahi-daemon is not available
23 avahi_cleanup()
25     cd $here
26     $sudo $signal -a "$service" >/dev/null 2>&1
27     rm -f $tmp.*
30 avahi_service()
32     $sudo "$PCP_RC_DIR/$service" restart >>$here/$seq.full 2>&1
35 avahi_verify()
37     msg="$@"
39     [ "X$msg" = "X" ] && msg="Verify $service avahi service advertising"
40     echo $msg | tee -a $here/$seq.full
42     # strip any domain part ... e.g. if hostname is vm08.localdomain,
43     # avahi reports this as vm08.local
44     #
45     hostname=`hostname | sed -e 's/\..*//'`
46     echo "hostname=$hostname" >>$here/$seq.full
47     avahi-browse -rt -d local "_$service._tcp" 2>&1 | \
48         tee -a $here/$seq.full | \
49         grep -m1 "hostname = .$hostname.local]" | \
50         sed -e "s/$hostname/HOSTNAME/g"