Skip to content

Commit 82112ce

Browse files
committed
Fix system dump test case by enabling the dump policy.
Currently our testcase directly triggers the system dump even the dump policy for it is disabled, which results in our testcase won't trigger any system dump and just simply system IPL's without dumping system files(OPAL, printk, hbrt log) So this patch fixes this issue by enabling the system dump policy before triggering any system dump. And also this adds conditions to retrieve individual files after dump is generated and make sure the three files(OPAL, hbrt log and printk log) collected properly. For more details: Internal BZ155562 Signed-off-by: Pridhiviraj Paidipeddi <[email protected]>
1 parent 2f7924d commit 82112ce

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

common/OpTestFSP.py

+25
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,20 @@ def wait_for_ipling(self, timeout=10):
299299
time.sleep(5)
300300
return BMC_CONST.FW_SUCCESS
301301

302+
def wait_for_dump_to_start(self):
303+
count = 0
304+
# Dump maximum can start in one minute(So lets wait for 3 mins)
305+
while count < 3:
306+
if self.get_sys_status() == "dumping":
307+
return True
308+
count += 1
309+
time.sleep(60)
310+
else:
311+
print "Current system status: %s" % self.get_sys_status()
312+
print "Current progress code: %s" % self.get_progress_code()
313+
raise OpTestError("System dump not started even after 3 minutes")
314+
315+
302316
##
303317
# @brief Wait for system to reach runtime
304318
# @returns 0 on success or throws exception
@@ -318,6 +332,15 @@ def wait_for_runtime(self, timeout=10):
318332
time.sleep(5)
319333
return BMC_CONST.FW_SUCCESS
320334

335+
def enable_system_dump(self):
336+
print "Enabling the system dump policy"
337+
self.fspc.run_command("sysdump -sp enableSys")
338+
res = self.fspc.run_command("sysdump -vp")
339+
if "System dumps Enabled Enabled" in res:
340+
print "System dump policy enabled successfully"
341+
return True
342+
raise OpTestError("Failed to enable system dump policy")
343+
321344
##
322345
# @brief Trigger system dump from fsp
323346
# @returns True on success or raises exception
@@ -340,6 +363,8 @@ def trigger_system_dump(self):
340363
# @returns True on success or throws exception
341364
#
342365
def wait_for_systemdump_to_finish(self):
366+
self.wait_for_dump_to_start()
367+
# If dump starts then wait for finish it
343368
count = 0
344369
while count < 30:
345370
res = self.fspc.run_command("sysdump -qall")

testcases/OpTestDumps.py

+30-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
# Different dumps for fsp platforms
2626
# fipsdump
2727
# system dump
28+
# host_dump_boottime --> Trigger dump when kernel boots(either Petitboot or OS kernel)
29+
# host_dump_runtime --> Trigger dump when system is in OS or already booted to OS
30+
# nmi_dump --> Trigger system dump by sending NMI interrupts to processors
31+
#
2832

2933
import time
3034
import subprocess
@@ -57,7 +61,7 @@ def tearDown(self):
5761
def trigger_dump(self):
5862
if self.test == "nmi_dump":
5963
self.cv_IPMI.ipmi_power_diag()
60-
elif self.test == "host_dump":
64+
elif "host_dump" in self.test:
6165
self.cv_FSP.trigger_system_dump()
6266
else:
6367
raise Exception("Unknown test type")
@@ -138,15 +142,20 @@ def runTest(self):
138142
self.skipTest("FSP Platform OPAL specific dump tests")
139143
self.cv_HOST.host_check_command("opal-dump-parse")
140144
self.cv_HOST.host_run_command("rm -rf /var/log/dump/SYSDUMP*")
145+
self.cv_HOST.host_run_command("rm -rf /var/log/dump/Opal-log*")
146+
self.cv_HOST.host_run_command("rm -rf /var/log/dump/HostBoot-Runtime-log*")
147+
self.cv_HOST.host_run_command("rm -rf /var/log/dump/printk*")
141148
self.cv_FSP.fsp_get_console()
142149
if not self.cv_FSP.mount_exists():
143150
raise OpTestError("Please mount NFS and retry the test")
144151

145152
self.set_up()
146153
print self.cv_FSP.fsp_run_command("smgr mfgState")
154+
self.cv_FSP.enable_system_dump()
147155
self.cv_FSP.clear_fsp_errors()
148-
self.cv_FSP.power_off_sys()
149-
self.cv_FSP.power_on_sys()
156+
if "host_dump_boottime" in self.test:
157+
self.cv_FSP.power_off_sys()
158+
self.cv_FSP.power_on_sys()
150159
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
151160
self.trigger_dump()
152161
self.cv_FSP.wait_for_systemdump_to_finish()
@@ -164,6 +173,14 @@ def runTest(self):
164173
self.assertIn("Opal", '\n'.join(res), "sysdump test failed in dumping Opal-log section")
165174
self.assertIn("HostBoot-Runtime-log", '\n'.join(res), "sysdump test failed in dumping HBRT section")
166175
self.assertIn("printk", '\n'.join(res), "sysdump test failed in dumping printk section")
176+
self.cv_HOST.host_run_command("cd /var/log/dump/")
177+
self.cv_HOST.host_run_command("opal-dump-parse -s 1 /var/log/dump/SYSDUMP*")
178+
self.cv_HOST.host_run_command("cat Opal-log*")
179+
self.cv_HOST.host_run_command("opal-dump-parse -s 2 /var/log/dump/SYSDUMP*")
180+
self.cv_HOST.host_run_command("cat HostBoot-Runtime-log*")
181+
self.cv_HOST.host_run_command("opal-dump-parse -s 128 /var/log/dump/SYSDUMP*")
182+
self.cv_HOST.host_run_command("cat printk*")
183+
167184

168185
class FIPS_DUMP(OpTestDumps, unittest.TestCase):
169186

@@ -201,10 +218,16 @@ def runTest(self):
201218
dumpname, size = self.fipsdump_initiate_from_host()
202219
self.verify_fipsdump(dumpname, size)
203220

204-
class HOST_DUMP(SYSTEM_DUMP):
221+
class HOST_DUMP_BOOTTIME(SYSTEM_DUMP):
222+
223+
def set_up(self):
224+
self.test = "host_dump_boottime"
225+
226+
class HOST_DUMP_RUNTIME(SYSTEM_DUMP):
205227

206228
def set_up(self):
207-
self.test = "host_dump"
229+
self.test = "host_dump_runtime"
230+
208231

209232
class NMI_DIAG_DUMP(SYSTEM_DUMP):
210233

@@ -214,6 +237,7 @@ def set_up(self):
214237
def suite():
215238
s = unittest.TestSuite()
216239
s.addTest(FIPS_DUMP())
217-
s.addTest(HOST_DUMP())
240+
s.addTest(HOST_DUMP_RUNTIME())
218241
s.addTest(NMI_DIAG_DUMP())
242+
s.addTest(HOST_DUMP_BOOTTIME())
219243
return s

0 commit comments

Comments
 (0)