Skip to content

Commit 9cdbeb9

Browse files
Merge pull request #2275 from sacsant/lparstat
ras/lparstat: Fix package dependency
2 parents b1b8dae + 8e3b1e6 commit 9cdbeb9

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

ras/lparstat.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,47 @@
1616

1717
from avocado import Test
1818
from avocado.utils import process
19+
from avocado.utils import distro
1920
from avocado.utils.software_manager import SoftwareManager
2021

2122

2223
class lparstat(Test):
2324

25+
"""
26+
Test case to validate lparstat functionality. lparstat is
27+
a tool to display logical partition related information and
28+
statistics
29+
30+
:avocado: tags=ras,ppc64le
31+
"""
32+
2433
def setUp(self):
2534
sm = SoftwareManager()
26-
if not sm.check_installed("powerpc-utils-core") and \
27-
not sm.install("powerpc-utils-core"):
28-
self.cancel("Fail to install required 'powerpc-utils-core' package")
35+
detected_distro = distro.detect()
36+
if 'SuSE' in detected_distro.name:
37+
package = "powerpc-utils"
38+
elif 'rhel' in detected_distro.name:
39+
package = "powerpc-utils-core"
40+
41+
if not sm.check_installed(package) and not sm.install(package):
42+
self.cancel("Failed to install %s" % package)
2943

3044
def test_list(self):
31-
lists = self.params.get('list', default=['-i', '-x', '-E', '-l', '1 2'])
45+
"""
46+
Test supported command line options
47+
"""
48+
lists = self.params.get('list',
49+
default=['-i', '-x', '-E', '-l', '1 2'])
3250
for list_item in lists:
3351
cmd = "lparstat %s" % list_item
3452
if process.system(cmd, ignore_status=True, sudo=True):
3553
self.log.info("%s command failed" % cmd)
3654
self.fail("lparstat: %s command failed to execute" % cmd)
3755

3856
def test_nlist(self):
39-
# Negative tests
57+
"""
58+
Negative tests
59+
"""
4060
lists = self.params.get('nlist', default=['--nonexistingoption'])
4161
for list_item in lists:
4262
cmd = "lparstat %s" % list_item

0 commit comments

Comments
 (0)