From 115fb3bc6770974043a55e585cf655efcbeeae2f Mon Sep 17 00:00:00 2001 From: Disha Goel Date: Thu, 14 Sep 2023 18:56:22 +0530 Subject: [PATCH] fix LTP aio-stress test remove libaio package as not needed anymore fix below compilation error by building and compiling LTP first and then run aio-stress test "ERROR: Command 'gcc -Wall -o aio-stress /root/avocado/data/cache/by_location/1045d5a4350b89433ad0cb55a0f87cb8ba4fc0b2/aio-stress.c -laio -lpthread' failed." Signed-off-by: Disha Goel --- perf/aiostress.py | 37 +++++++++++---------------- perf/aiostress.py.data/aiostress.yaml | 2 +- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/perf/aiostress.py b/perf/aiostress.py index 4e759fa76..04714f57f 100755 --- a/perf/aiostress.py +++ b/perf/aiostress.py @@ -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 @@ -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') diff --git a/perf/aiostress.py.data/aiostress.yaml b/perf/aiostress.py.data/aiostress.yaml index 9c9854c6f..638a371d7 100644 --- a/perf/aiostress.py.data/aiostress.yaml +++ b/perf/aiostress.py.data/aiostress.yaml @@ -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'