qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 723
blob5b2dd82dc1ea424b941f0716605a7a1a3b001835
1 #!/bin/sh
2 # PCP QA Test No. 723
3 # Exercise Linux kernel proc.psinfo.label metric
5 # Copyright (c) 2013 Red Hat. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
10 # get standard environment, filters and checks
11 . ./common.product
12 . ./common.filter
13 . ./common.check
15 pid=$$
17 test $PCP_VER -ge 30805 || _notrun "No support for new proc label metric"
18 test $PCP_PLATFORM = linux || _notrun "Test unsupported on $PCP_PLATFORM"
19 test -f /proc/$pid/attr/current || _notrun "No kernel support for labels"
20 # for some kernels, /proc/$pid/attr/current exists, but attempts to
21 # access the "file" produce and Invalid argument error
23 cat /proc/$$/attr/current >/dev/null 2>&1 || _notrun "Incomplete kernel support for labels"
26 status=1 # failure is the default!
27 $sudo rm -rf $tmp.* $seq.full
28 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
30 # real QA test starts here
31 $sudo rm -f $seq.full
32 #debug# ls -l /proc/$pid/attr/current
33 syslabel=`cat /proc/$pid/attr/current`
34 echo "SYS Label for process $pid is: $syslabel" >> $seq.full
36 pminfo -f proc.psinfo.labels > $tmp.labels
37 pcplabel=`grep "^ inst \[$pid or " $tmp.labels \
38 | $PCP_AWK_PROG '{ print $NF }' \
39 | sed -e 's/^"//' -e 's/"$//'`
40 echo "PCP Label for process $pid is: $pcplabel" >> $seq.full
41 echo "Extracted from list:" >> $seq.full
42 cat $tmp.labels >> $seq.full
44 if [ "$pcplabel" = "$syslabel" ]
45 then
46 echo "Security label for current process checks out"
47 status=0
48 else
49 echo "Mismatch on security labels:"
50 echo "PCP Label: $pcplabel"
51 echo "SYS Label: $syslabel"
52 status=1
55 exit