|
16 | 16 |
|
17 | 17 | from avocado import Test |
18 | 18 | from avocado.utils import process |
| 19 | +from avocado.utils import distro |
19 | 20 | from avocado.utils.software_manager import SoftwareManager |
20 | 21 |
|
21 | 22 |
|
22 | 23 | class lparstat(Test): |
23 | 24 |
|
| 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 | + |
24 | 33 | def setUp(self): |
25 | 34 | 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) |
29 | 43 |
|
30 | 44 | 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']) |
32 | 50 | for list_item in lists: |
33 | 51 | cmd = "lparstat %s" % list_item |
34 | 52 | if process.system(cmd, ignore_status=True, sudo=True): |
35 | 53 | self.log.info("%s command failed" % cmd) |
36 | 54 | self.fail("lparstat: %s command failed to execute" % cmd) |
37 | 55 |
|
38 | 56 | def test_nlist(self): |
39 | | - # Negative tests |
| 57 | + """ |
| 58 | + Negative tests |
| 59 | + """ |
40 | 60 | lists = self.params.get('nlist', default=['--nonexistingoption']) |
41 | 61 | for list_item in lists: |
42 | 62 | cmd = "lparstat %s" % list_item |
|
0 commit comments