Skip to content

Commit

Permalink
Add RT related cases for CKI testing
Browse files Browse the repository at this point in the history
Signed-off-by: Qiao Zhao <[email protected]>
  • Loading branch information
linuxqiao authored and veruu committed Apr 2, 2019
1 parent db17ba8 commit 617789f
Show file tree
Hide file tree
Showing 12 changed files with 611 additions and 0 deletions.
50 changes: 50 additions & 0 deletions rt-tests/include/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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 := rt-tests/include
export TESTVERSION := 1.0

.PHONY: build run clean

FILES := $(METADATA) runtest.sh Makefile

build:
chmod a+x ./runtest.sh

run: $(FILES) build
./runtest.sh

clean:
rm -f $(METADATA)

# Include common Makefile
include /usr/share/rhts/lib/rhts-make.include

$(METADATA):
touch $(METADATA)
@echo "Owner: Qiao Zhao <[email protected]>" >$(METADATA)
@echo "Name: $(TEST)" >>$(METADATA)
@echo "Path: $(TEST_DIR)" >>$(METADATA)
@echo "TestVersion: $(TESTVERSION)" >>$(METADATA)
@echo "License: GPLv3" >>$(METADATA)
@echo "Description: Make sure rt env setup." >>$(METADATA)
@echo "Architectures: x86_64" >>$(METADATA)
@echo "TestTime: 10m" >>$(METADATA)

rhts-lint $(METADATA)
30 changes: 30 additions & 0 deletions rt-tests/include/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Source rhts environment
. /usr/bin/rhts_environment.sh

function rt_package_install()
{
packages="rt-tests rt-setup rteval rteval-loads tuned-profiles-realtime tuna"
echo "install needed package $packages " | tee -a $OUTPUTFILE
for i in $packages; do
if $(rpm -q --quiet $i); then
continue
else
dnf install -y $i
fi
done
}

function rt_env_setup()
{
kernel_name=$(uname -r)
if [[ $kernel_name =~ "rt" ]]; then
echo "running the $kernel_name" | tee -a $OUTPUTFILE
rt_package_install
else
echo "non rt kernel, please use rt kernel" | tee -a $OUTPUTFILE
rhts-report-result $TEST "SKIP" $OUTPUTFILE
exit
fi
}
52 changes: 52 additions & 0 deletions rt-tests/rt_migrate_test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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 := rt-tests/rt_migrate_test
export TESTVERSION := 1.0

.PHONY: build run clean

FILES := $(METADATA) runtest.sh Makefile

build:
chmod +x ./runtest.sh

run: $(FILES) build
./runtest.sh

clean:
rm -f $(METADATA)

# Include a global make rules file
include /usr/share/rhts/lib/rhts-make.include

$(METADATA): Makefile
touch $(METADATA)
@echo "Owner: Steven Rostedt <[email protected]>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Description: Test to verify CPUs should be running the highest\
possible priority task that it can run." >> $(METADATA)
@echo "Architectures: x86_64" >>$(METADATA)
@echo "TestTime: 1h" >> $(METADATA)
@echo "repoRequires: rt-tests/include" >> $(METADATA)

rhts-lint $(METADATA)
75 changes: 75 additions & 0 deletions rt-tests/rt_migrate_test/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# Source rt common functions
. ../include/runtest.sh

function RprtRslt ()
{
test_item=$1
result=$2

# File the results in the database
if [ $result = "PASS" ]; then
report_result $test_item $result 0
else
report_result $test_item $result 1
fi
}

function RunTest ()
{
# Default result to Fail
export result_r="FAIL"

PROCS=$1

echo Test Start Time: `date` >> $OUTPUTFILE

rt-migrate-test $PROCS 2>&1 >> $OUTPUTFILE
grep -q " Failed!" $OUTPUTFILE
if [ $? -eq 0 ]; then
echo "rt-migrate-test balance Failed: " | tee -a $OUTPUTFILE
result_r="FAIL"
else
echo "rt_migrate balance Passed: " | tee -a $OUTPUTFILE
result_r="PASS"
fi

echo Test End Time: `date` >> $OUTPUTFILE
RprtRslt Balancing $result_r
}

function RunStress ()
{
# Default result to Fail
export result_r="FAIL"

PROCS=$1

echo Test Start Time: `date` >> $OUTPUTFILE

rt-migrate-test $PROCS -l 1000 2>&1 >> $OUTPUTFILE
grep -q " Failed!" $OUTPUTFILE
if [ $? -eq 0 ]; then
echo "rt_migrate stress Failed: " | tee -a $OUTPUTFILE
result_r="FAIL"
else
echo "rt_migrate stress Passed: " | tee -a $OUTPUTFILE
result_r="PASS"
fi

echo Test End Time: `date` >> $OUTPUTFILE
RprtRslt Stress $result_r
}

# ---------- Start Test -------------
rt_env_setup

# set default variables
NUMBERPROCS=$(/bin/cat /proc/cpuinfo | /bin/grep processor | wc -l)
SYSCPUS=$(expr `/bin/cat /proc/cpuinfo | /bin/grep processor | wc -l` + 1)

echo "Number of Procs: $NUMBERPROCS / Running test with Procs: $SYSCPUS" | tee -a $OUTPUTFILE
RunTest $SYSCPUS
RunStress $SYSCPUS
exit 0
51 changes: 51 additions & 0 deletions rt-tests/rteval/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 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 := rt-tests/rteval
export TESTVERSION := 1.0

.PHONY: build run clean

FILES := $(METADATA) runtest.sh Makefile PURPOSE

build:
chmod a+x ./runtest.sh

run: $(FILES) build
./runtest.sh

clean:
rm -f *~ $(METADATA) *.rpm

# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include

$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Clark Williams <[email protected]>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Description: PRE Verification for Real Time" >> $(METADATA)
@echo "Architectures: x86_64" >>$(METADATA)
@echo "TestTime: 1h" >> $(METADATA)
@echo "repoRequires: rt-tests/include" >> $(METADATA)

rhts-lint $(METADATA)
46 changes: 46 additions & 0 deletions rt-tests/rteval/PURPOSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
The rteval script is a utility for measuring various aspects of
realtime behaviour on a system under load. The script unpacks the
hackbench and kernel source, builds hackbench and then goes into a
loop, running hackbench and compiling a kernel tree. During that loop
the cyclictest program is run to measure event response time. After
the run time completes, a statistical analysis of the event response
times is done and printed to the screen.

This script takes the following parameters:

* RTREPORTSRV
Default: rtserver.farm.hsv.redhat.com
Defines which XML-RPC server rteval will use for reporting

* NOXMLRPC
Default: (not set)
If this is set to "1" and only "1", XML-RPC reporting will be disabled

* RTEVAL_EXTRA_PARAMS
Default: (not set)
The given string will be passed straight through to the rteval command line

* KILLTIMEOVERRIDE
Default: (not set / testinfo.desc defines it to 43200 seconds == 12h)
This can decide how long rteval will run. However, it is not a straight
forward value. The Beaker watchdog uses this value to decide when to
kill off a running task. So this script will deduct a number of seconds
and use that as rteval run time. To ensure that rteval can be run both
for a short time and a long time, the deducted time differs depending on
the KILLTIMEOVERRIDE value. The default run-time for rteval is 8 hours if
this value is not provided.

If KILLTIMEOVERRIDE value is > 1800 seconds (30 minutes) it will deduct
30 minutes for rteval reporting. So if you pass the value 1801, rteval
will run for 1 second, and 30 minutes will be reserved for reporting.
If you pass 3600 (1 hour), rteval will run for 30 minutes and 30 minutes
is reserved for reporting.

If KILLTIMEOVERRIDE value is >= 601 and <= 1800 (between 10 min 1 sec and
30 minutes), it will deduct 10 minutes for rteval reporting. So if you
pass the value 601, rteval will run for 1 second. If you pass 1800,
rteval will run for 20 minutes.

If KILLTIMEOVERRIDE value is less than 601, only 3 minutes will be
deducted for rteval reporting.

79 changes: 79 additions & 0 deletions rt-tests/rteval/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# Source rt common functions
. ../include/runtest.sh

function RprtRslt ()
{
result=$1

# File the results in the database
if [ $result = "PASS" ]; then
report_result $TEST $result 0
else
if [ $result = "WARN" ]; then
report_result $TEST $result 2
else
report_result $TEST $result 1
fi
fi
}

NOXMLRPC=${NOXMLRPC:-1}
DURATION=${DURATION:-900}

function RunTest ()
{
# Default result to Fail
export result_r="FAIL"

echo Test Start Time: `date` | tee -a $OUTPUTFILE

RTREPORTSRV=${RTREPORTSRV:-rtserver.farm.hsv.redhat.com}

if [ "$NOXMLRPC" != "1" ]; then
XMLRPCARGS="--xmlrpc-submit=$RTREPORTSRV"
echo "-- INFO -- XML-RPC report server: $RTREPORTSRV"
else
echo "-- INFO -- No XML-RPC reporting will be done (NOXMLRPC parameter used)"
XMLRPCARGS=""
fi

echo "-- INFO -- Default run time: $DURATION seconds"

echo "-- INFO -- Mounting debugfs to/sys/kernel/debug "
mount -t debugfs none /sys/kernel/debug

echo "-- INFO -- Using command line: rteval $XMLRPCARGS --duration=$DURATION"

# Lets rock'n'roll
rteval $XMLRPCARGS --duration=$DURATION | tee -a $OUTPUTFILE
retcode="$?"

for rep in $(find -type f -name "rteval-????????-*.tar.bz2"); do
echo "-- INFO -- Attaching report: $rep"
rhts_submit_log -l $rep
done

if [ ${retcode} -eq 0 ] ; then
echo "rteval Passed: " | tee -a $OUTPUTFILE
result_r="PASS"
else
if [ ${retcode} -eq 2 ] ; then
echo "rteval Passed: " | tee -a $OUTPUTFILE
echo "xmlrpc Failed: " | tee -a $OUTPUTFILE
result_r="WARN"
else
echo "rteval Failed: " | tee -a $OUTPUTFILE
result_r="FAIL"
fi
fi

echo Test End Time: `date` | tee -a $OUTPUTFILE
RprtRslt $result_r
}

# ---------- Start Test -------------
rt_env_setup
RunTest
exit 0
Loading

0 comments on commit 617789f

Please sign in to comment.