Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 821
blobca912897a4007797ae9bc578e820eb30f1fbffbc
1 #!/bin/sh
2 # PCP QA Test No. 821
3 # Exercise Linux PMDA memory metrics.
5 # Copyright (c) 2016 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 [ $PCP_PLATFORM = linux ] || _notrun "Linux-specific memory metric testing"
18 config="$PCP_PMDAS_DIR/linux/bandwidth.conf"
20 _cleanup()
22 cd $here
23 if [ -f "$config.$seq" ]
24 then
25 _restore_config "$config"
26 $sudo rm -f "$config.$seq"
28 rm -rf $tmp $tmp.*
31 status=1 # failure is the default!
32 $sudo rm -rf $tmp $tmp.* $seq.full
33 trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
35 # real QA test starts here
36 root=$tmp.root
37 export LINUX_HERTZ=100
38 export LINUX_PAGESIZE=4096
39 export LINUX_STATSPATH=$root
40 pmda=$PCP_PMDAS_DIR/linux/pmda_linux.so,linux_init
41 local="-L -K clear -K add,60,$pmda"
43 mem_metrics=`pminfo $local mem | LC_COLLATE=POSIX sort`
44 slab_metrics=`pminfo $local mem.slabinfo | LC_COLLATE=POSIX sort`
46 if [ -f "$config" ]
47 then
48 _save_config "$config"
49 $sudo rm -f "$config" # ensure deterministic output, see qa/826
52 for tgz in $here/linux/meminfo-*.tgz
54 rm -fr $root
55 mkdir $root || _fail "root in use when processing $tgz"
56 cd $root
57 tar xzf $tgz
58 base=`basename $tgz`
60 echo "== Checking all mem metric values - $base"
61 pminfo $local -f $mem_metrics
62 echo && echo "== done" && echo
64 echo "== Checking slabinfo metric values - $base"
65 # requires root privileges to access these
66 $sudo pminfo $local -f $slab_metrics
67 echo && echo "== done" && echo
69 cd $here
70 done
72 # success, all done
73 status=0
75 exit