qa: ensure 886 determinism with local interrupts/softirqs names
[pcp.git] / qa / 886
bloba91972efef91482aff8e406404a44b246e4efee5
1 #!/bin/sh
2 # PCP QA Test No. 886
3 # Verify /proc/interrupts parsing for various architectures.
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 interrupts test, only works with Linux"
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
21 _cleanup()
23 cd $here
24 [ -f $PCP_VAR_DIR/config/pmda/$domain.26.$seq ] && \
25 _restore_config $PCP_VAR_DIR/config/pmda/$domain.26
26 [ -f $PCP_VAR_DIR/config/pmda/$domain.27.$seq ] && \
27 _restore_config $PCP_VAR_DIR/config/pmda/$domain.27
28 rm -rf $tmp.*
31 trap "_cleanup; exit \$status" 0 1 2 3 15
33 proc_stat()
35 path=$1
36 ncpu=$2
38 echo cpu 0 0 0 0 0 0 0 0 0 > $path
39 cpu=0
40 while [ $cpu -lt $ncpu ]
42 echo cpu$cpu 0 0 0 0 0 0 0 0 0 >> $path
43 cpu=`expr $cpu + 1`
44 done
47 # real QA test starts here
48 root=$tmp.root
49 export LINUX_STATSPATH=$root
50 pmda=$PCP_PMDAS_DIR/linux/pmda_linux.so,linux_init
51 interrupts=`echo $here/linux/interrupts-* | LC_COLLATE=POSIX sort`
52 softirqs=`echo $here/linux/softirqs-* | LC_COLLATE=POSIX sort`
54 # override the default contents of PMDA cache files
55 # (do not want localhost versions to be used here).
57 domain=60
58 [ -f $PCP_VAR_DIR/config/pmda/$domain.26 ] && \
59 _save_config $PCP_VAR_DIR/config/pmda/$domain.26
60 $sudo rm -f $PCP_VAR_DIR/config/pmda/$domain.26
61 [ -f $PCP_VAR_DIR/config/pmda/$domain.27 ] && \
62 _save_config $PCP_VAR_DIR/config/pmda/$domain.27
63 $sudo rm -f $PCP_VAR_DIR/config/pmda/$domain.27
65 for file in $interrupts
67 rm -fr $root
68 mkdir -p $root/proc || _fail "root in use when processing $file"
70 cp $file $root/proc/interrupts
71 base=`basename $file`
72 ncpu=`echo $base | sed -e 's/.*-\([0-9][0-9]*\)cpu-.*/\1/'`
73 proc_stat $root/proc/stat $ncpu
74 export LINUX_NCPUS=$ncpu
76 echo "== Checking interrupts metrics from $base ($ncpu CPU)"
77 pminfo -f -L -K clear -K add,$domain,$pmda kernel.percpu.interrupts
78 echo && echo "== done" && echo
79 echo "== Checking interrupts helptext from $base ($ncpu CPU)"
80 pminfo -tT -L -K clear -K add,$domain,$pmda kernel.percpu.interrupts
81 echo && echo "== done" && echo
82 cd $here
83 done
85 for file in $softirqs
87 rm -fr $root
88 mkdir -p $root/proc || _fail "root in use when processing $file"
90 cp $file $root/proc/softirqs
91 base=`basename $file`
92 ncpu=`echo $base | sed -e 's/.*-\([0-9][0-9]*\)cpu-.*/\1/'`
93 proc_stat $root/proc/stat $ncpu
94 export LINUX_NCPUS=$ncpu
96 echo "== Checking softirqs metrics from $base ($ncpu CPU)"
97 pminfo -f -L -K clear -K add,$domain,$pmda kernel.percpu.softirqs
98 echo && echo "== done" && echo
99 cd $here
100 done
102 # success, all done
103 status=0
104 exit