Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Mambo OS state #545

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions common/OpTestSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
92 changes: 92 additions & 0 deletions testcases/OpTestMamboBuildRoot.py
Original file line number Diff line number Diff line change
@@ -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))