Skip to content

Commit 8bc8c61

Browse files
committed
Testcase for getting Kernel Log errors/warnings.
We have testcase for retrieving errors in OPAL log. This patch will get the critical/error/warning messages from kerenl log. Now we can use this test in all other tests wherever it requires to monitor the kernel errors. Signed-off-by: Pridhiviraj Paidipeddi <[email protected]>
1 parent 9a3b2be commit 8bc8c61

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

op-test

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ from testcases import OpTestMCColdResetEffects
6060
from testcases import OpTestDumps
6161
from testcases import HostLogin
6262
from testcases import OpalMsglog
63+
from testcases import KernelLog
6364
from testcases import OpTestFlash
6465
from testcases import OpalErrorLog
6566
from testcases import LightPathDiagnostics
@@ -101,6 +102,7 @@ class SkirootSuite():
101102
self.s.addTest(OpTestHeartbeat.HeartbeatSkiroot())
102103
self.s.addTest(OpTestNVRAM.SkirootNVRAM())
103104
self.s.addTest(OpalMsglog.Skiroot())
105+
self.s.addTest(KernelLog.Skiroot())
104106
self.s.addTest(DPO.DPOSkiroot())
105107
# self.s.addTest(OpTestEnergyScale.runtime_suite())
106108
def suite(self):
@@ -126,6 +128,7 @@ class HostSuite():
126128
self.s.addTest(OpTestSensors.OpTestSensors())
127129
self.s.addTest(OpalErrorLog.BasicTest())
128130
self.s.addTest(OpalMsglog.Host())
131+
self.s.addTest(KernelLog.Host())
129132
self.s.addTest(OpTestPrdDaemon.OpTestPrdDaemon())
130133
def suite(self):
131134
return self.s

testcases/KernelLog.py

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/python
2+
# OpenPOWER Automated Test Project
3+
#
4+
# Contributors Listed Below - COPYRIGHT 2017
5+
# [+] International Business Machines Corp.
6+
#
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17+
# implied. See the License for the specific language governing
18+
# permissions and limitations under the License.
19+
#
20+
21+
import unittest
22+
23+
import OpTestConfiguration
24+
from common.OpTestSystem import OpSystemState
25+
from common.OpTestConstants import OpTestConstants as BMC_CONST
26+
27+
class KernelLog():
28+
def setUp(self):
29+
conf = OpTestConfiguration.conf
30+
self.cv_HOST = conf.host()
31+
self.cv_IPMI = conf.ipmi()
32+
self.cv_SYSTEM = conf.system()
33+
34+
def runTest(self):
35+
self.setup_test()
36+
if "skiroot" in self.test:
37+
cmd = "dmesg -r|grep '<[4321]>'"
38+
elif "host" in self.test:
39+
cmd = "dmesg -T --level=alert,crit,err,warn"
40+
else:
41+
raise Exception("Unknow test type")
42+
43+
log_entries = self.c.run_command(cmd)
44+
msg = '\n'.join(filter(None, log_entries))
45+
self.assertTrue( len(log_entries) == 0, "Warnings/Errors in Kernel log:\n%s" % msg)
46+
47+
class Skiroot(KernelLog, unittest.TestCase):
48+
def setup_test(self):
49+
self.test = "skiroot"
50+
self.cv_SYSTEM.goto_state(OpSystemState.PETITBOOT_SHELL)
51+
self.c = self.cv_SYSTEM.sys_get_ipmi_console()
52+
self.cv_SYSTEM.host_console_unique_prompt()
53+
54+
class Host(KernelLog, unittest.TestCase):
55+
def setup_test(self):
56+
self.test = "host"
57+
self.cv_SYSTEM.goto_state(OpSystemState.OS)
58+
self.c = self.cv_SYSTEM.host().get_ssh_connection()

0 commit comments

Comments
 (0)