From e2e8cb0e1ff9f5bd86415bdbc11e472c1254084a Mon Sep 17 00:00:00 2001 From: Satheesh Rajendran Date: Thu, 5 Sep 2019 21:38:28 +0530 Subject: [PATCH 1/2] Enable OS State for Mambo Environment Let's enable OS State if asked by user for Mambo simulator environment, so that we can run OS tests, have verified using buildroot environment and works fine. Signed-off-by: Satheesh Rajendran --- common/OpTestSystem.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/OpTestSystem.py b/common/OpTestSystem.py index 1b8e35a7a..777fd965f 100644 --- a/common/OpTestSystem.py +++ b/common/OpTestSystem.py @@ -361,11 +361,11 @@ def goto_state(self, state): # if user overrides from command line and machine not at desired state can lead to exceptions self.block_setup_term = 1 # block in case the system is not on/up self.target_state = state # used in WaitForIt - if (isinstance(self.console, OpTestQemu.QemuConsole) - or isinstance(self.console, OpTestMambo.MamboConsole)) \ - and (state == OpSystemState.OS): + if isinstance(self.console, OpTestQemu.QemuConsole) and state == OpSystemState.OS: raise unittest.SkipTest( - "OpTestSystem running QEMU/Mambo so skipping OpSystemState.OS test") + "OpTestSystem running QEMU so skipping OpSystemState.OS test") + if isinstance(self.console, OpTestMambo.MamboConsole) and state == OpSystemState.OS: + self.state = OpSystemState.OS if isinstance(self.console, OpTestHMC.HMCConsole) \ and state in [OpSystemState.IPLing, OpSystemState.PETITBOOT, OpSystemState.PETITBOOT_SHELL]: raise unittest.SkipTest( From aac3bf466322cdef59ee7c970db2afc995995239 Mon Sep 17 00:00:00 2001 From: Satheesh Rajendran Date: Thu, 5 Sep 2019 21:47:18 +0530 Subject: [PATCH 2/2] Add test to demonstrate Mambo with Buildroot Let's add test to demonstrate OS state Mambo boottest with Buildroot environment. Refer this blog for more details, https://sathnaga86.com/2019/11/19/guide-to-run-test-on-power9-from-laptop-using-simulator.html Signed-off-by: Satheesh Rajendran --- testcases/OpTestMamboBuildRoot.py | 92 +++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 testcases/OpTestMamboBuildRoot.py diff --git a/testcases/OpTestMamboBuildRoot.py b/testcases/OpTestMamboBuildRoot.py new file mode 100644 index 000000000..40a43deb5 --- /dev/null +++ b/testcases/OpTestMamboBuildRoot.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +# OpenPOWER Automated Test Project +# +# Contributors Listed Below - COPYRIGHT 2017 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# POWER9 Functional Simulator User Guide +# http://public.dhe.ibm.com/software/server/powerfuncsim/p9/docs/P9funcsim_ug_v1.0_pub.pdf +# +# POWER9 Functional Simulator Command Reference Guide +# http://public.dhe.ibm.com/software/server/powerfuncsim/p9/docs/P9funcsim_cr_v1.0_pub.pdf + +''' +Test for Mambo Sim with BuildRoot Env +Usage: +Sample config looks like: +$ cat mambo.cfg +[op-test] +bmc_type=mambo +mambo_binary=./mambo/p9/systemsim-p9-release/run/p9/run_cmdline +flash_skiboot=./mambo/p9/skiboot/skiboot.lid +flash_kernel=./mambo/linux/vmlinux +flash_initramfs=./mambo/mamboinit.img +host_user=root +host_password= + +$ ./op-test -c mambo.cfg --run testcases.OpTestMamboBuildRoot.OpTestMamboBuildRoot + +Note: +for mambo/power-simulator binary/package can be obtained from +ftp://public.dhe.ibm.com/software/server/powerfuncsim/ +mamboinit.img is a image obtained from compiling https://github.com/open-power/buildroot +skiboot.lid is obtained by compiling https://github.com/open-power/skiboot +checkout readme of respective respositories for how to compile. +''' + +import unittest + +import OpTestConfiguration +from common.OpTestSystem import OpSystemState +import common.OpTestMambo as OpTestMambo + +import OpTestLogger +log = OpTestLogger.optest_logger_glob.get_logger(__name__) + + +class OpTestMamboBuildRoot(unittest.TestCase): + ''' + Mambo Build Root test + ''' + + def setUp(self): + conf = OpTestConfiguration.conf + self.ipmi = conf.ipmi() + self.system = conf.system() + self.host = conf.host() + self.system.goto_state(OpSystemState.OS) + self.prompt = self.system.util.build_prompt() + self.c = self.system.console + self.pty = self.c.get_console() + if not isinstance(self.c, OpTestMambo.MamboConsole): + raise unittest.SkipTest( + "Must be running Mambo to perform this test") + + def runTest(self): + # need to first perform run_command initially + # which sets up the pexpect prompt for subsequent run_command(s) + + # mambo echos twice so turn off + # this stays persistent even after switching context + # from target OS to mambo and back + self.c.run_command('stty -echo') + + uname_output = self.c.run_command('uname -a') + log.debug("uname = {}".format(uname_output)) + cpuinfo_output = self.c.run_command('cat /proc/cpuinfo') + log.debug("cpuinfo = {}".format(cpuinfo_output)) + int_output = self.c.run_command('cat /proc/interrupts') + log.debug("interrupts = {}".format(int_output))