Skip to content

Commit

Permalink
Merge pull request #2796 from Krishan-Saraswat/perf_top
Browse files Browse the repository at this point in the history
Addes test case to capture ebizzy workload in perf top tool
  • Loading branch information
PraveenPenguin authored Apr 15, 2024
2 parents 9def34a + 08b6719 commit 9328bcb
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion perf/perf_top.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import time
import platform
import pexpect
import tempfile
import os
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 +64,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 +87,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 9328bcb

Please sign in to comment.