|
| 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