build: Makepkgs support for vector deb building
[pcp.git] / qa / 943
blobc3d5bc3473c9c320195a9f8c86d7c3b7c8cf36a8
1 #!/bin/sh
2 # PCP QA Test No. 943
3 # Exercise pmdaproc access permission checking.
5 # Copyright (c) 2013 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 _get_libpcp_config
17 $unix_domain_sockets || _notrun "No unix domain socket support available"
18 $authentication || _notrun "No authentication support available"
19 pminfo proc.nprocs >/dev/null 2>&1 || _notrun "proc PMDA not installed"
21 status=1 # failure is the default!
22 $sudo rm -rf $tmp.* $seq.full
23 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
25 _filter_counts()
27 # special case these ones ...
28 # proc.psinfo.cgroups -61 No data available
29 # proc.psinfo.cgroups -12350 Metric not supported by this version of monitored application
30 # proc.psinfo.cpusallowed -12350 Metric not supported by this version of monitored application
31 # proc.psinfo.ngid -12350 Metric not supported by this version of monitored application
32 # then map any number of values to COUNT
34 sed -e '/proc.psinfo.cgroups/s/-61 No data available/1/' \
35 -e '/proc.psinfo.cgroups/s/-12350 .* application/1/' \
36 -e '/proc.psinfo.cpusallowed/s/-12350 .* application/1/' \
37 -e '/proc.psinfo.ngid/s/-12350 .* application/1/' \
38 | $PCP_AWK_PROG '$2 > 0 { $2 = "COUNT" } { print }' \
39 | LC_COLLATE=POSIX sort
42 # lists of metrics
43 unprivileged="proc.nprocs proc.runq"
44 privileged="proc.psinfo proc.memory proc.id proc.fd"
46 # notes:
47 # proc.schedstat not present in older nor newer kernels (farewell!)
48 # proc.io file permissions sometimes prevent reading after seteuid?
49 # debug: pminfo -L -K add,3,proc/pmda_proc.so,proc_init proc.io -f
51 # real QA test starts here
52 echo "== Check unprivileged metric access"
53 pmprobe -h localhost $unprivileged | _filter_counts
55 echo "== Check protected per-process metric fetches (expect errors)"
56 pmprobe -h localhost $privileged | _filter_counts
58 echo "== Check authentic per-process metric fetches (expect values)"
59 pmprobe -h unix: $privileged | _filter_counts
61 # success, all done
62 status=0
63 exit