-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2782 from Krishan-Saraswat/ebizzy_workload
Added ebizzy workload to run with YAML parameters
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 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 LICENSE for more details. | ||
# | ||
# Copyright: 2024 IBM | ||
# Author: Krishan Gopal Saraswat <[email protected]> | ||
|
||
|
||
import os | ||
|
||
from avocado import Test | ||
from avocado.utils import distro, process, archive, build | ||
from avocado.utils.software_manager.manager import SoftwareManager | ||
|
||
|
||
class ebizzy(Test): | ||
|
||
""" | ||
ebizzy workload | ||
""" | ||
|
||
def setUp(self): | ||
''' | ||
Build ebizzy | ||
Source: | ||
https://sourceforge.net/projects/ebizzy/files/ebizzy/0.3 | ||
/ebizzy-0.3.tar.gz | ||
''' | ||
if 'ppc' not in distro.detect().arch: | ||
self.cancel("Processor is not powerpc") | ||
sm = SoftwareManager() | ||
deps = ['tar', 'make'] | ||
for package in deps: | ||
if not sm.check_installed(package) and not sm.install(package): | ||
self.cancel("%s is needed for the test to be run" % package) | ||
url = 'https://sourceforge.net/projects/ebizzy/files/ebizzy/0.3/ebizzy-0.3.tar.gz' | ||
tarball = self.fetch_asset(self.params.get("ebizy_url", default=url)) | ||
archive.extract(tarball, self.workdir) | ||
version = os.path.basename(tarball.split('.tar.')[0]) | ||
self.sourcedir = os.path.join(self.workdir, version) | ||
os.chdir(self.sourcedir) | ||
process.run("./configure") | ||
build.make(self.sourcedir, extra_args='LDFLAGS=-static') | ||
# Get the arguments for ebizzy workload from YAML file | ||
self.args = self.params.get('ebizzy_args', default='-S 20') | ||
|
||
def test_start_ebizzy_workload(self): | ||
# Run ebizzy workload for time duration taken from YAML file | ||
process.run("nohup ./ebizzy {0} &".format(self.args)) | ||
|
||
def test_stop_ebizzy_workload(self): | ||
ps = process.system_output("ps -e", ignore_status=True).decode().splitlines() | ||
pid = 0 | ||
for w_load in ps: | ||
if "ebizzy" in w_load: | ||
pid = int(w_load.split(" ")[0]) | ||
break | ||
if pid: | ||
os.kill(pid, 9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ebizy_url : 'https://sourceforge.net/projects/ebizzy/files/ebizzy/0.3/ebizzy-0.3.tar.gz' | ||
ebizzy_args : '-S 30' |