pmrep: fix archive end time reporting
[pcp.git] / qa / 885
blobb3bef1abba7ab0c5e53e511c81d881e947875bbc
1 #!/bin/sh
2 # PCP QA Test No. 885
3 # Verify /proc/cpuinfo parsing for various architectures.
5 # Copyright (c) 2014 Red Hat. 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 [ $PCP_PLATFORM = linux ] || _notrun "Linux cpuinfo test, only works with Linux"
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
20 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 proc_stat()
24 path=$1
25 ncpu=$2
27 echo cpu 0 0 0 0 0 0 0 0 0 > $path
28 cpu=0
29 while [ $cpu -lt $ncpu ]
31 echo cpu$cpu 0 0 0 0 0 0 0 0 0 >> $path
32 cpu=`expr $cpu + 1`
33 done
36 # real QA test starts here
37 root=$tmp.root
38 export LINUX_STATSPATH=$root
39 pmda=$PCP_PMDAS_DIR/linux/pmda_linux.so,linux_init
40 files=`echo $here/linux/cpuinfo-* | LC_COLLATE=POSIX sort`
41 metrics=`pminfo hinv.cpu | grep -v hinv.cpu.online`
43 for file in $files
45 rm -fr $root
46 mkdir -p $root/proc || _fail "root in use when processing $file"
48 cp $file $root/proc/cpuinfo
49 base=`basename $file`
50 ncpu=`echo $base | sed -e 's/.*-\([0-9][0-9]*\)cpu-.*/\1/'`
51 proc_stat $root/proc/stat $ncpu
53 echo "== Checking CPU hardware metrics from $base ($ncpu CPU)"
54 pminfo -f -L -K clear -K add,60,$pmda $metrics
55 echo && echo "== done" && echo
56 cd $here
57 done
59 # success, all done
60 status=0
61 exit