Skip to content

Commit

Permalink
Merge pull request #2707 from disgoel/aiostress
Browse files Browse the repository at this point in the history
fix LTP aio-stress test
  • Loading branch information
PraveenPenguin authored Sep 16, 2023
2 parents a0dcb1b + 115fb3b commit 07464d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
37 changes: 15 additions & 22 deletions perf/aiostress.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import os

from avocado import Test
from avocado.utils import process, distro
from avocado.utils import process, archive, build
from avocado.utils.software_manager.manager import SoftwareManager


Expand All @@ -41,32 +41,25 @@ def setUp(self):
testcases/kernel/io/ltp-aiodio/aio-stress.c
"""
smm = SoftwareManager()
packages = []
dist_name = distro.detect().name.lower()
if dist_name == 'ubuntu':
packages.extend(['libaio1', 'libaio-dev'])
elif dist_name in ['centos', 'fedora', 'rhel']:
packages.extend(['libaio', 'libaio-devel'])
elif dist_name == 'suse':
packages.extend(['libaio1', 'libaio-devel'])

packages = ['make', 'gcc']
for package in packages:
if not smm.check_installed(package) and not smm.install(package):
self.cancel('%s is needed for the test to be run' % package)
url = self.params.get('url', default='https//github.com/linux-test-project/'
'ltp/blob/master/testcases/kernel/io/'
'ltp-aiodio/aio-stress.c')
aiostress = self.fetch_asset(url, expire='10d')
os.chdir(self.workdir)
# This requires libaio.h in order to build
# -laio -lpthread is provided at end as a workaround for Ubuntu
process.run('gcc -Wall -o aio-stress %s -laio -lpthread' % aiostress)

url = self.params.get(
'url', default='https://github.com/linux-test-project/ltp/archive/master.zip')
tarball = self.fetch_asset(url, expire='7d')
archive.extract(tarball, self.workdir)
ltp_dir = os.path.join(self.workdir, "ltp-master")
os.chdir(ltp_dir)
build.make(ltp_dir, extra_args='autotools')
process.system('./configure')
ltp_aio = os.path.join(ltp_dir, "testcases/kernel/io/ltp-aiodio/")
os.chdir(ltp_aio)
build.make(ltp_aio)

def test(self):
"""
Run aiostress
"""
os.chdir(self.workdir)
# aio-stress needs a filename (foo) to run tests on.
cmd = ('./aio-stress foo')
process.run(cmd)
process.system('./aio-stress')
2 changes: 1 addition & 1 deletion perf/aiostress.py.data/aiostress.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
url : 'https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/io/ltp-aiodio/aio-stress.c'
url : 'https://github.com/linux-test-project/ltp/archive/master.zip'

0 comments on commit 07464d2

Please sign in to comment.