1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/sh
# PCP QA Test No. 1393
# Test sparse and non-contiguous numa-nodes and CPUs
# RHBZ#1730492 - Some numa nodes have no instances.
#
# Copyright (c) 2019 Red Hat. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
[ $PCP_PLATFORM = linux ] || _notrun "Linux-specific PMDA testing"
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_sort_instname()
{
tee $tmp.sort | sed -n 2p
awk '/inst / {print " ", $4, $6}' $tmp.sort | sed -e 's/\]//' | LC_COLLATE=POSIX sort
}
# real QA test starts here
mkdir -p $tmp
tar -C $tmp -xf linux/sysfs-numa-001.tgz
pmda=$PCP_PMDAS_DIR/linux/pmda_linux.$DSO_SUFFIX,linux_init
LINUX_STATSPATH="$tmp"; export LINUX_STATSPATH
metrics="hinv.map.cpu_node hinv.node.online \
kernel.percpu.cpu.idle kernel.percpu.cpu.user kernel.pernode.cpu.idle \
kernel.pernode.cpu.user mem.numa.alloc.local_node mem.numa.util.total \
mem.numa.util.free mem.numa.util.used"
echo == check basic numa metrics 4 nodes, 8 CPUs
pminfo -L -K clear -K add,60,$pmda -f hinv.nnode hinv.ncpu
for m in $metrics; do pminfo -L -K clear -K add,60,$pmda -f $m| _sort_instname; done
echo;echo ==;echo == delete node2, leaving node0, node1 and node3;echo ==
rm -rf $LINUX_STATSPATH/sys/devices/system/node/node2
rm -rf $LINUX_STATSPATH/sys/devices/system/memory/memory*/node2
echo '0,1,3' >$LINUX_STATSPATH/sys/devices/system/node/online
echo '0,1,3' >$LINUX_STATSPATH/sys/devices/system/node/possible
rm -rf $LINUX_STATSPATH/sys/devices/system/cpu/cpu{4,5}
sed -i '/^cpu[45]$/d' $LINUX_STATSPATH/proc/stat
echo '0,1,2,3,6,7' >$LINUX_STATSPATH/sys/devices/system/cpu/online
echo '0,1,2,3,6,7' >$LINUX_STATSPATH/sys/devices/system/cpu/present
pminfo -L -K clear -K add,60,$pmda -f hinv.nnode hinv.ncpu
for m in $metrics; do pminfo -L -K clear -K add,60,$pmda -f $m| _sort_instname; done
# success, all done
status=0
exit
|