Skip to content

Commit

Permalink
Addes test case to capture ebizzy workload in perf top tool
Browse files Browse the repository at this point in the history
To run this test, we need to follow this flow
start_ebizzy_workload -> run workload test -> stop_ebizzy_workload.

Signed-off-by: Krishan Gopal Saraswat <[email protected]>
  • Loading branch information
Krishan-Saraswat committed Apr 15, 2024
1 parent 9def34a commit 47cde62
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion perf/perf_top.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
import time
import platform
import pexpect
import tempfile
from avocado import Test
from avocado.utils import distro, dmesg
from avocado.utils import distro, dmesg, process, genio
from avocado.utils.software_manager.manager import SoftwareManager


Expand Down Expand Up @@ -62,6 +63,9 @@ def setUp(self):
# Clear the dmesg by that we can capture delta at the end of the test
dmesg.clear_dmesg()

# Creating a temprory file
self.temp_file = tempfile.NamedTemporaryFile().name

def test_top(self):
if self.option in ["-k", "--vmlinux", "--kallsyms"]:
if self.distro_name in ['rhel', 'fedora', 'centos']:
Expand All @@ -82,3 +86,18 @@ def test_top(self):
self.fail("Unknown option %s" % self.option)
dmesg.collect_errors_dmesg(['WARNING: CPU:', 'Oops', 'Segfault',
'soft lockup', 'Unable to handle'])

def test_workload_output(self):
process.getoutput("perf top -a > %s " % self.temp_file, timeout=10)
perf_top_output = genio.read_file(self.temp_file).splitlines()
flag = False
for lines in perf_top_output:
if "ebizzy" in lines:
flag = True
break
if flag is False:
self.fail("ebizzy workload not captured in perf top")

def tearDown(self):
if os.path.isfile(self.temp_file):
process.system('rm -f %s' % self.temp_file)

0 comments on commit 47cde62

Please sign in to comment.