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. 1788
# Exercise Linux kernel hugepage sysfs metrics.
#
# Copyright (c) 2024-2025 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 memory metric testing"
_cleanup()
{
cd $here
$sudo rm -f $PCP_VAR_DIR/config/pmda/60.{43,44}
[ -f $PCP_VAR_DIR/config/pmda/60.43.$seq ] && _restore_config $PCP_VAR_DIR/config/pmda/60.43
[ -f $PCP_VAR_DIR/config/pmda/60.44.$seq ] && _restore_config $PCP_VAR_DIR/config/pmda/60.44
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
# deterministic output - move aside any existing indom caches
[ -f $PCP_VAR_DIR/config/pmda/60.43 ] && _save_config $PCP_VAR_DIR/config/pmda/60.43
[ -f $PCP_VAR_DIR/config/pmda/60.44 ] && _save_config $PCP_VAR_DIR/config/pmda/60.44
_filter_instances()
{
$here/src/sortinst | sed -e 's/inst \[./inst [N/g'
}
# real QA test starts here
root=$tmp.root
LINUX_STATSPATH=$root; export LINUX_STATSPATH
pmda=$PCP_PMDAS_DIR/linux/pmda_linux.so,linux_init
local="-L -K clear -K add,60,$pmda"
metrics=`pminfo $local mem.hugepages mem.numa.hugepages | LC_COLLATE=POSIX sort`
for tgz in $here/linux/sysfs-hugepages-*.tgz
do
rm -fr $root
mkdir $root || _fail "root in use when processing $tgz"
cd $root
tar xzf $tgz
base=`basename $tgz`
echo "== Checking hugepages metric values - $base"
pminfo $local -f $metrics | _filter_instances
echo && echo "== done" && echo
cd $here
done
# success, all done
status=0
exit
|