qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 734
blob20b1cd9dcebbcdabd279e70d600b5a850e971d1e
1 #!/bin/sh
2 # PCP QA Test No. 734
3 # Exercise bug in pmGetContextHostName with pmcd.hostname metric.
5 # Copyright (c) 2014 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=1 # failure is the default!
17 $sudo rm -rf $tmp.* $seq.full
18 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
20 # prefer an old host without pmcd.hostname, however the test is still
21 # useful even with more recent remotes (exercises different paths).
22 oldhost=`./getpmcdhosts -L -n 1 -v 'pcp<3.8.4' 2>$seq.full`
23 [ -z "$oldhost" ] && oldhost=`./getpmcdhosts -L -n 1`
24 [ -z "$oldhost" ] && _notrun "No remote hosts available"
25 short_oldhost=`echo $oldhost | sed -e 's/\..*//'`
26 # match pmstat(1) truncation
27 short_oldhost=`printf "%-7.7s" "$short_oldhost" | sed -e 's/ *$//'`
29 # real QA test starts here
30 set -- `pmprobe -h localhost -v pmcd.hostname`
31 eval newhost=$3
32 short_newhost=`echo $newhost | sed -e 's/\..*//'`
33 # match pmstat(1) truncation
34 short_newhost=`printf "%-7.7s" "$short_newhost" | sed -e 's/ *$//'`
36 echo "using oldhost $oldhost ($short_oldhost)" >> $seq.full
37 echo "using newhost $newhost ($short_newhost)" >> $seq.full
39 pmstat -t 0.2 -s 2 -h localhost -h $oldhost > $tmp.out
40 grep -q $short_newhost $tmp.out && echo "Correct local hostname in pmstat output"
41 grep -q $short_oldhost $tmp.out && echo "Correct remote hostname in pmstat output"
42 cat $tmp.out >> $seq.full
44 # success, all done
45 status=0
46 exit