Skip to content

Commit 673cf1f

Browse files
pridhivirajstewartsmith
authored andcommitted
Opal Error log and LPD Testcases.
Modified the testcases to check the sysfs and DT node entries to start the test with. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent 2f22f44 commit 673cf1f

6 files changed

Lines changed: 412 additions & 1 deletion

File tree

common/OpTestHost.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,3 +1236,15 @@ def host_enable_kdump_service(self, os_level):
12361236
self.host_run_command("systemctl start kdump.service")
12371237
self.host_run_command("service status kdump.service")
12381238

1239+
def host_check_sysfs_path_availability(self, path):
1240+
res = self.host_run_command("ls %s" % path)
1241+
if "No such file or directory" in res:
1242+
return False
1243+
return True
1244+
1245+
def host_check_dt_node_exist(self, node_path):
1246+
path = "/proc/device-tree/" + node_path
1247+
res = self.host_run_command("ls %s" % path)
1248+
if "No such file or directory" in res:
1249+
return False
1250+
return True

common/OpTestSystem.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def skiboot_log_on_console(self):
103103
def has_host_accessible_eeprom(self):
104104
return True
105105

106+
def has_host_led_support(self):
107+
return False
108+
106109
def host(self):
107110
return self.cv_HOST
108111

@@ -1262,6 +1265,10 @@ def skiboot_log_on_console(self):
12621265
def has_host_accessible_eeprom(self):
12631266
return False
12641267

1268+
def has_host_led_support(self):
1269+
return True
1270+
1271+
12651272
class OpTestOpenBMCSystem(OpTestSystem):
12661273
def __init__(self,
12671274
i_ffdcDir=None,

op-test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ from testcases import OpTestDumps
6161
from testcases import HostLogin
6262
from testcases import OpalMsglog
6363
from testcases import OpTestFlash
64+
from testcases import OpalErrorLog
65+
from testcases import LightPathDiagnostics
6466
import testcases
6567

6668
args, remaining_args = OpTestConfiguration.conf.parse_args(sys.argv)
@@ -149,6 +151,9 @@ class FullSuite():
149151
self.s.addTest(OpTestInbandUsbInterface.full_suite())
150152
self.s.addTest(OpTestI2Cdriver.FullI2C())
151153
self.s.addTest(OpTestSensors.OpTestSensors())
154+
self.s.addTest(LightPathDiagnostics.suite())
155+
self.s.addTest(OpalErrorLog.BasicTest())
156+
self.s.addTest(OpalErrorLog.FullTest())
152157
self.s.addTest(OpTestSwitchEndianSyscall.OpTestSwitchEndianSyscall())
153158
self.s.addTest(OpTestMCColdResetEffects.OpTestMCColdResetEffects())
154159
def suite(self):
@@ -238,6 +243,9 @@ class FspOpalSuite():
238243
def __init__(self):
239244
self.s = unittest.TestSuite()
240245
self.s.addTest(OpTestDumps.suite())
246+
self.s.addTest(OpalErrorLog.BasicTest())
247+
self.s.addTest(OpalErrorLog.FullTest())
248+
self.s.addTest(LightPathDiagnostics.extended_suite())
241249
def suite(self):
242250
return self.s
243251

testcases/LightPathDiagnostics.py

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
#!/usr/bin/python
2+
# IBM_PROLOG_BEGIN_TAG
3+
# This is an automatically generated prolog.
4+
#
5+
# $Source: op-test-framework/testcases/LightPathDiagnostics.py $
6+
#
7+
# OpenPOWER Automated Test Project
8+
#
9+
# Contributors Listed Below - COPYRIGHT 2015
10+
# [+] International Business Machines Corp.
11+
#
12+
#
13+
# Licensed under the Apache License, Version 2.0 (the "License");
14+
# you may not use this file except in compliance with the License.
15+
# You may obtain a copy of the License at
16+
#
17+
# http://www.apache.org/licenses/LICENSE-2.0
18+
#
19+
# Unless required by applicable law or agreed to in writing, software
20+
# distributed under the License is distributed on an "AS IS" BASIS,
21+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
22+
# implied. See the License for the specific language governing
23+
# permissions and limitations under the License.
24+
#
25+
# IBM_PROLOG_END_TAG
26+
27+
# @package LightPathDiagnostics
28+
# Currently runs only in FSP platforms
29+
#
30+
31+
import time
32+
import subprocess
33+
import re
34+
35+
from common.OpTestIPMI import OpTestIPMI
36+
from common.OpTestConstants import OpTestConstants as BMC_CONST
37+
from common.OpTestError import OpTestError
38+
39+
import unittest
40+
import OpTestConfiguration
41+
from common.OpTestSystem import OpSystemState
42+
43+
class LightPathDiagnostics(unittest.TestCase):
44+
def setUp(self):
45+
conf = OpTestConfiguration.conf
46+
self.cv_SYSTEM = conf.system()
47+
self.cv_FSP = self.cv_SYSTEM.bmc
48+
self.cv_HOST = conf.host()
49+
self.bmc_type = conf.args.bmc_type
50+
self.cv_SYSTEM.goto_state(OpSystemState.OS)
51+
52+
def tearDown(self):
53+
#self.cv_HOST.host_gather_opal_msg_log()
54+
#self.cv_HOST.host_gather_kernel_log()
55+
pass
56+
57+
def lpd_init(self):
58+
# Check if system has LED support
59+
if not self.cv_SYSTEM.has_host_led_support():
60+
self.skipTest("System has no LED support")
61+
62+
self.assertTrue(self.cv_HOST.host_check_dt_node_exist("ibm,opal/leds"),
63+
"ibm,opal/leds DT Node doesn't exist")
64+
65+
# If it has support, check for led's presence
66+
res = self.cv_HOST.host_run_command("ls /sys/class/leds/ | wc -l")
67+
self.assertNotEqual(int(res.strip()), 0,
68+
"No LED's found in sysfs /sys/class/leds/")
69+
70+
self.cv_FSP.fsp_get_console()
71+
if not self.cv_FSP.mount_exists():
72+
raise OpTestError("Please mount NFS and retry the test")
73+
74+
def get_location_codes(self):
75+
res = self.cv_HOST.host_run_command("usysident")
76+
res = res.splitlines()
77+
loc_codes = []
78+
for loc in res:
79+
loc_codes.append(loc.split("\t")[0])
80+
return loc_codes
81+
82+
def get_sysattn_indicator_loc(self):
83+
res = self.cv_HOST.host_run_command("usysattn")
84+
res = res.splitlines()
85+
loc_codes = []
86+
for loc in res:
87+
loc_codes.append(loc.split("\t")[0])
88+
return loc_codes[0]
89+
90+
class UsysIdentifyTest(LightPathDiagnostics):
91+
92+
##
93+
# @brief This function tests usysident identification of LED's
94+
#
95+
def runTest(self):
96+
self.lpd_init()
97+
loc_codes = self.get_location_codes()
98+
print "Executing indicator identify tests"
99+
# Using -l option(Location code) Identifying a single device
100+
for loc in loc_codes:
101+
print "Turn on identification indicator %s from Host OS" % loc
102+
self.cv_HOST.host_run_command("usysident -l %s -s identify" % (loc))
103+
tries = 20
104+
for i in range(1, tries+1):
105+
response = self.cv_HOST.host_run_command("usysident -l %s" % (loc))
106+
if "on" in response:
107+
break
108+
time.sleep(1)
109+
self.assertIn("on", response,
110+
"Turn ON of identification indicator %s is failed" % loc)
111+
print "Current identification state of %s is ON" % loc
112+
113+
self.cv_HOST.host_run_command("usysident")
114+
115+
# Setting to normal state of device(Turn off Device)
116+
for loc in loc_codes:
117+
print "Turn off identification indicator %s from Host OS" % loc
118+
self.cv_HOST.host_run_command("usysident -l %s -s normal" % (loc))
119+
tries = 20
120+
for i in range(1, tries+1):
121+
response = self.cv_HOST.host_run_command("usysident -l %s" % (loc))
122+
if "off" in response:
123+
break
124+
time.sleep(1)
125+
self.assertIn("off", response,
126+
"Turn OFF of identification indicator %s is failed" % loc)
127+
print "Current identification state of %s is OFF" % loc
128+
129+
class UsysAttnFSPTest(LightPathDiagnostics):
130+
131+
##
132+
# @brief This function tests system attention indicator LED
133+
#
134+
def runTest(self):
135+
self.lpd_init()
136+
loc_code = self.get_sysattn_indicator_loc()
137+
print "Executing system attention indicator tests"
138+
response = self.cv_FSP.fsp_run_command("ledscommandline -V")
139+
print response
140+
# Setting system attention indicator from FSP
141+
print "Setting system attention indicator from FSP"
142+
response = self.cv_FSP.fsp_run_command("ledscommandline -a -s")
143+
print response
144+
response = self.cv_FSP.fsp_run_command("ledscommandline -a -q")
145+
print response
146+
tries = 10
147+
for i in range(1, tries+1):
148+
cmd = "usysattn -l %s" % loc_code
149+
response = self.cv_HOST.host_run_command(cmd)
150+
if "on" in response:
151+
break
152+
time.sleep(1)
153+
self.assertIn("on", response,
154+
"Turn ON of system attention indicator is failed")
155+
print "Current system attention indicator state is ON"
156+
157+
# Clearing(resetting) system attention indicator from FSP
158+
print "Clearing system attention indicator from FSP"
159+
response = self.cv_FSP.fsp_run_command("ledscommandline -a -r")
160+
print response
161+
response = self.cv_FSP.fsp_run_command("ledscommandline -a -q")
162+
print response
163+
tries = 10
164+
for i in range(1, tries+1):
165+
cmd = "usysattn -l %s" % loc_code
166+
response = self.cv_HOST.host_run_command(cmd)
167+
if "off" in response:
168+
break
169+
time.sleep(1)
170+
self.assertIn("off", response,
171+
"Turn OFF of system attention indicator is failed")
172+
print "Current system attention indicator state is OFF"
173+
174+
class UsysAttnHostTest(LightPathDiagnostics):
175+
176+
##
177+
# @brief This function tests system attention indicator LED
178+
#
179+
def runTest(self):
180+
self.lpd_init()
181+
loc_code = self.get_sysattn_indicator_loc()
182+
print "Executing system attention indicator tests"
183+
# Setting system attention indicator from HOST
184+
print "Setting system attention indicator from Host"
185+
cmd = "echo 1 > /sys/class/leds/%s:attention/brightness" % loc_code
186+
self.cv_HOST.host_run_command(cmd)
187+
tries = 10
188+
for i in range(1, tries+1):
189+
cmd = "usysattn -l %s" % loc_code
190+
response = self.cv_HOST.host_run_command(cmd)
191+
if "on" in response:
192+
break
193+
time.sleep(1)
194+
self.assertIn("on", response,
195+
"Turn ON of system attention indicator is failed")
196+
print "Current system attention indicator state is ON"
197+
198+
# Clearing(resetting) system attention indicator
199+
print "Clearing system attention indicator from Host"
200+
cmd = "echo 0 > /sys/class/leds/%s:attention/brightness" % loc_code
201+
self.cv_HOST.host_run_command(cmd)
202+
tries = 10
203+
for i in range(1, tries+1):
204+
cmd = "usysattn -l %s" % loc_code
205+
response = self.cv_HOST.host_run_command(cmd)
206+
if "off" in response:
207+
break
208+
time.sleep(1)
209+
self.assertIn("off", response,
210+
"Turn OFF of system attention indicator is failed")
211+
print "Current system attention indicator state is OFF"
212+
213+
class UsysFaultTest(LightPathDiagnostics):
214+
215+
##
216+
# @brief This function tests usysfault identification of LED's
217+
#
218+
def runTest(self):
219+
self.lpd_init()
220+
loc_codes = self.get_location_codes()
221+
print "Executing fault indicator tests for all fault locators"
222+
for indicator in loc_codes:
223+
print "***************Test for %s locator*************" % indicator
224+
# Setting a fault indicator from HOST os
225+
print "Setting fault indicator %s from Host OS" % indicator
226+
cmd = "echo 1 > /sys/class/leds/%s:fault/brightness" % indicator
227+
self.cv_HOST.host_run_command(cmd)
228+
tries = 10
229+
for i in range(1, tries+1):
230+
cmd = "usysattn -l %s" % indicator
231+
response = self.cv_HOST.host_run_command(cmd)
232+
if "on" in response:
233+
break
234+
time.sleep(1)
235+
self.assertIn("on", response,
236+
"Turn ON of fault indicator %s is failed" % indicator)
237+
print "Current fault indicator state of %s is ON" % indicator
238+
239+
# Clearing fault indicator from Host OS
240+
print "Clearing fault indicator %s from Host OS" % indicator
241+
cmd = "usysattn -l %s -s normal" % indicator
242+
self.cv_HOST.host_run_command(cmd)
243+
tries = 10
244+
for i in range(1, tries+1):
245+
cmd = "usysattn -l %s" % indicator
246+
response = self.cv_HOST.host_run_command(cmd)
247+
if "off" in response:
248+
break
249+
time.sleep(1)
250+
self.assertIn("off", response,
251+
"Turn OFF of fault indicator %s is failed" % indicator)
252+
print "Current fault indicator state of %s is OFF" % indicator
253+
254+
def suite():
255+
s = unittest.TestSuite()
256+
s.addTest(UsysIdentifyTest())
257+
s.addTest(UsysAttnHostTest())
258+
s.addTest(UsysFaultTest())
259+
return s
260+
261+
def extended_suite():
262+
s = unittest.TestSuite()
263+
s.addTest(UsysIdentifyTest())
264+
s.addTest(UsysAttnFSPTest())
265+
s.addTest(UsysAttnHostTest())
266+
s.addTest(UsysFaultTest())
267+
return s
268+

testcases/OpTestDumps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def runTest(self):
146146
self.cv_FSP.trigger_system_dump()
147147
self.cv_FSP.wait_for_systemdump_to_finish()
148148
self.cv_FSP.wait_for_runtime()
149+
'''
149150
console = self.cv_SYSTEM.sys_get_ipmi_console().get_console()
150151
console.sendline()
151152
console.expect("login:", timeout=600)
@@ -160,7 +161,7 @@ def runTest(self):
160161
self.assertIn("HostBoot-Runtime-log", res, "sysdump test failed in dumping HBRT section")
161162
self.assertIn("printk", res, "sysdump test failed in dumping printk section")
162163
print "sysdump test completed successfully"
163-
164+
'''
164165

165166
class FIPS_DUMP(OpTestDumps):
166167

0 commit comments

Comments
 (0)