Drop unused condition check
[pcp.git] / qa / 651
blobbbeac21a198d2557e8c796cc5cb0ec8d2ee9bc89
1 #! /bin/sh
2 # PCP QA Test No. 651
3 # basic pmproxy functionality
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
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 [ -x $PCP_BINADM_DIR/pmproxy ] || \
17 _notrun "need $PCP_BINADM_DIR/pmproxy"
19 rm -f $seq.full
21 hostname=`_get_fqdn`
22 [ "$hostname" = "localhost" -o "$hostname" = "localhost.localdomain" ] && \
23 _notrun "need sensible setup, not simply hostname => localhost"
25 echo "hostname=$hostname" >>$seq.full
27 # for newer versions, we default to local sockets with different
28 # access controls. dodge that, and test the usual pmproxy path.
29 target="-h $hostname"
31 _filter()
33 sed \
34 -e "s/$hostname/MYHOST/" \
35 -e "s/`hostname`/MYHOST/" \
36 -e "s/localhost/MYHOST/" \
37 -e "s/local:/MYHOST/" \
38 -e '/hinv.ncpu/s/ 1 [0-9][0-9]*/ 1 <n>/'
41 signal=$PCP_BINADM_DIR/pmsignal
42 username=`id -u -n`
43 status=0 # success is the default!
44 $sudo rm -rf $tmp.*
45 trap "_cleanup; exit \$status" 0 1 2 3 15
47 _cleanup()
49 rm -f $tmp.*
50 $sudo $signal -a pmproxy
53 # real QA test starts here
54 $sudo $signal -a pmproxy
55 sleep 1
57 export PMCD_HOST=localhost
58 export PMPROXY_HOST=$hostname
59 proxyargs=""
60 id pcp >/dev/null 2>&1 && proxyargs="$proxyargs -U $username"
62 echo "== pmproxy not running =="
63 pmprobe $target -v sample.long.hundred 2>&1 | _filter
65 echo
66 echo "== simplest default case =="
67 $PCP_BINADM_DIR/pmproxy $proxyargs
68 sleep 1
69 pmprobe $target -v sample.long.hundred 2>&1 | _filter
71 echo
72 echo "== simple explicit host case =="
73 pmprobe -v -h localhost hinv.ncpu 2>&1 | _filter
75 echo
76 echo "== non-standard PMPROXY_PORT, expect failure =="
77 export PMPROXY_PORT=94322
78 pmprobe $target -v sample.long.hundred 2>&1 | _filter
80 echo
81 echo "== non-standard PMPROXY_PORT, expect success =="
82 $sudo $PCP_BINADM_DIR/pmsignal -a pmproxy
83 $PCP_BINADM_DIR/pmproxy $proxyargs
84 sleep 1
85 pmprobe $target -v sample.long.hundred 2>&1 | _filter
87 echo
88 echo "== restricted interface for connections, expect failure =="
89 unset PMPROXY_PORT
90 $sudo $PCP_BINADM_DIR/pmsignal -a pmproxy
91 $PCP_BINADM_DIR/pmproxy -i 127.0.0.1 $proxyargs
92 sleep 1
93 pmprobe $target -v sample.long.hundred 2>&1 | _filter
95 echo
96 echo "== restricted interface for connections, expect success =="
97 export PMPROXY_HOST=localhost
98 pmprobe $target -v sample.long.hundred 2>&1 | _filter
100 # success, all done
101 exit