numatop: gating test

Resolves: bz2025375

Signed-off-by: Ping Fang <pifang@redhat.com>
This commit is contained in:
Ping Fang 2021-11-26 10:50:03 +08:00
parent 40d161b7e3
commit e839efbbd6
6 changed files with 278 additions and 0 deletions

64
tests/sanity/Makefile Normal file
View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/numatop/Sanity/smoke-test
# Description: It generates some NUMA load and checks whether numatop sees it.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/numatop/Sanity/smoke-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE mgen.tar.gz README
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Michael Petlan <mpetlan@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: It generates some NUMA load and checks whether numatop sees it." >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: numatop" >> $(METADATA)
@echo "Requires: numatop ncurses-devel numactl-devel git make check-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Architectures: x86_64" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL8" >> $(METADATA)
rhts-lint $(METADATA)

9
tests/sanity/PURPOSE Normal file
View File

@ -0,0 +1,9 @@
PURPOSE of /tools/numatop/Sanity/smoke-test
Description: It generates some NUMA load and checks whether numatop sees it.
Author: Michael Petlan <mpetlan@redhat.com>
The mgen tool has been taken from numatop source package. It should
generate some NUMA load, which should be captured by numatop then.
The test needs at least two NUMA nodes in order to be able to check
the RMAs and LMAs (Local and Remote Memory Accesses).

42
tests/sanity/README Normal file
View File

@ -0,0 +1,42 @@
On some larger systems, memory has non-uniform access times. It is organized
in so-called NUMA-nodes. A NUMA node is a part of memory which is accessible
faster for some particular subset of processors.
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 24
On-line CPU(s) list: 0-23
Thread(s) per core: 2
Core(s) per socket: 6
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 45
Stepping: 7
CPU MHz: 1200.000
BogoMIPS: 4588.34
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 15360K
NUMA node0 CPU(s): 0-5,12-17
NUMA node1 CPU(s): 6-11,18-23
This machine has two NUMA nodes and 24 processors (they are called CPUs, but
that is not very precise). Half of them belongs to NUMA node0 and the second
half to node1.
When a processor accesses data that lies in its NUMA node, it is faster than
accessing data from some other node. The local access is called LMA and the
remote one is called RMA.
The NUMATOP tool watches what happens around the NUMA nodes and it sees both
LMAs and RMAs. If the machine has only one NUMA node, only LMAs can be seen.
The test tries to trigger LMAs and check whether NUMATOP registers it. If we
have more than one NUMA node, we test RMAs as well.

BIN
tests/sanity/mgen.tar.gz Normal file

Binary file not shown.

146
tests/sanity/runtest.sh Executable file
View File

@ -0,0 +1,146 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/numatop/Sanity/smoke-test
# Description: It generates some NUMA load and checks whether numatop sees it.
# Author: Michael Petlan <mpetlan@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="numatop"
CLONE_ATTEMPTS_COUNT=25
rlJournalStart
rlPhaseStartSetup
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp mgen.tar.gz $TmpDir/"
rlRun "pushd $TmpDir"
NUMATOP_PACKAGE=`rpm -q numatop`
if [ $? -eq 0 ]; then
rlLog "WE USE RHEL PACKAGE: $NUMATOP_PACKAGE"
else
rlLogWarn "NO RHEL PACKAGE FOR NUMATOP AVAILABLE!"
fi
# we need to build mgen for test
for (( i=0; i<$CLONE_ATTEMPTS_COUNT; i++ )); do
echo "Trying to clone the repo....... take $i..."
git clone https://github.com/01org/numatop.git
if [ $? -eq 0 ]; then
echo "I have been able to clone the repo."
REPO_CLONED=1
break
fi
sleep 8
done
if [ $REPO_CLONED -ne "1" ]; then
rlFail "I have not been able to clone the repo in $ATTEMPTS_COUNT takes....."
else
rlPass "The REPO has been cloned!"
fi
rlRun "cd numatop"
rlRun "mkdir m4"
rlRun "sh autogen.sh"
rlRun "./configure"
rlRun "make"
rlAssertExists "numatop"
#rlRun "cp numatop /usr/local/bin/"
rlRun "cp mgen /usr/local/bin/"
rlRun "which numatop"
rlRun "cd .."
# log something about the CPU
lscpu | while read line; do rlLog "$line"; done
# log kernel version
rlLog "`uname -r`"
NUMA_NODES=`lscpu -e=node | grep -v NODE | sort -u | wc -l`
CPU_FROM_NODE0=`lscpu -e=node,cpu | egrep '^0' | awk '{print $2}' | head -n 1`
CPU_FROM_NODE1=`lscpu -e=node,cpu | sed '1d' | egrep '^[^0]' | awk '{print $2}' | head -n 1`
rlPhaseEnd
rlPhaseStartTest "check machine"
#rlRun "timeout 10 numatop"
numatop > /dev/null &
NUMATOP_PID=$!
sleep 5
kill $NUMATOP_PID
if [ $? -ne 0 ]; then
rlPass "This machine does not support numatop"
exit 0
fi
rlPhaseEnd
rlPhaseStartTest "LMA test"
mgen -a $CPU_FROM_NODE0 -c $CPU_FROM_NODE0 -t 60 > /dev/null &
MGEN_PID=$!
sleep 5
rlLog "Running mgen with PID = $MGEN_PID"
numatop -l 0 -d lma.log > /dev/null < /dev/null 2> /dev/null &
NUMATOP_PID=$!
rlLog "Running numatop with PID = $NUMATOP_PID"
sleep 30
rlRun "kill $NUMATOP_PID"
sleep 5
rlRun "kill $MGEN_PID"
LMA_RESULT=`cat lma.log | grep mgen | tail -n 1 | awk '{print $4;}'`
IS_ENOUGH=`echo "$LMA_RESULT > 5000" | bc -l`
if [ $IS_ENOUGH -eq 1 ]; then
rlPass "Measured value for LMA looks sane [ $LMA_RESULT ]"
else
rlFail "Measured value for LMA looks bogus [ $LMA_RESULT ]"
fi
rlPhaseEnd
if [ $NUMA_NODES -ge 2 ]; then
rlPhaseStartTest "RMA test"
mgen -a $CPU_FROM_NODE0 -c $CPU_FROM_NODE1 -t 60 >/dev/null &
MGEN_PID=$!
sleep 5
rlLog "Running mgen with PID = $MGEN_PID"
numatop -l 0 -d rma.log > /dev/null < /dev/null 2> /dev/null &
NUMATOP_PID=$!
rlLog "Running numatop with PID = $NUMATOP_PID"
sleep 30
rlRun "kill $NUMATOP_PID"
sleep 5
rlRun "kill $MGEN_PID"
RMA_RESULT=`cat rma.log | grep mgen | tail -n 1 | awk '{print $3;}'`
IS_ENOUGH=`echo "$RMA_RESULT > 5000" | bc -l`
if [ $IS_ENOUGH -eq 1 ]; then
rlPass "Measured value for RMA looks sane [ $RMA_RESULT ]"
else
rlFail "Measured value for RMA looks bogus [ $RMA_RESULT ]"
fi
rlPhaseEnd
fi
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

17
tests/tests.yml Normal file
View File

@ -0,0 +1,17 @@
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-beakerlib
tests:
- sanity
required_packages:
- ncurses-devel
- check-devel
- numactl-devel
- make
- gcc
- autoconf
- libtool
- automake