Merge branch 'master' of https://github.com/kmcdonell/pcp into kenj-merge
[pcp.git] / qa / 740
blob65f561323d3f3afa039aa9dda9e38a51575d6989
1 #!/bin/sh
2 # PCP QA Test No. 740
3 # Exercise transfer of pid, uid, gid from client to PMDA
4 # when using Unix domain sockets.
6 # Copyright (c) 2013 Red Hat.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 _get_libpcp_config
18 $unix_domain_sockets || _notrun "No unix domain socket support available"
20 status=1 # failure is the default!
21 $sudo rm -rf $tmp.* $seq.full
22 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
24 rm -f $seq.out
25 case $PCP_PLATFORM
27 darwin)
28 ln $seq.out.darwin $seq.out || exit 1
31 ln $seq.out.default $seq.out || exit 1
33 esac
35 _filter()
37 grep -i attribute | \
38 sed \
39 -e "s/processid=$pid/processid=PID/" \
40 -e "s/groupid=$gid/groupid=GID/" \
41 -e "s/userid=$uid/userid=UID/" \
42 -e '/ctx=[0-9][0-9]*/s//ctx=N/' \
43 -e '/pmdasample([0-9][0-9]*)/s//pmdasample(PID)/' \
44 -e 's/^\[[A-Z].. [A-Z].. *[0-9][0-9]* ..:..:..]/[DATETIME]/'
47 # real QA test starts here
48 _service pmcd start >/dev/null 2>&1
49 _wait_for_pmcd
51 # store to enable verbose attribute diagnostics
52 authdbg=`pmdbg -l | grep DBG_TRACE_AUTH | awk '{ print $2 }'`
53 pmstore sample.control $authdbg
55 # unix domain fetch (with attribute transfer)
56 pminfo -h unix: sample.long.one &
57 pid=$!
58 uid=`id -u`
59 gid=`id -g`
60 wait $!
62 # let pmdasample complete setup
63 pmsleep 0.15
65 cat $PCP_LOG_DIR/pmcd/sample.log \
66 | tee -a $here/$seq.full \
67 | _filter
68 pmstore sample.control 0
70 # success, all done
71 status=0
72 exit