|
| 1 | +#!/usr/bin/env python3 |
| 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 | +# POWER9 Functional Simulator User Guide |
| 21 | +# http://public.dhe.ibm.com/software/server/powerfuncsim/p9/docs/P9funcsim_ug_v1.0_pub.pdf |
| 22 | +# |
| 23 | +# POWER9 Functional Simulator Command Reference Guide |
| 24 | +# http://public.dhe.ibm.com/software/server/powerfuncsim/p9/docs/P9funcsim_cr_v1.0_pub.pdf |
| 25 | + |
| 26 | +''' |
| 27 | +Test for Mambo Sim with BuildRoot Env |
| 28 | +Usage: |
| 29 | +Sample config looks like: |
| 30 | +$ cat mambo.cfg |
| 31 | +[op-test] |
| 32 | +bmc_type=mambo |
| 33 | +mambo_binary=./mambo/p9/systemsim-p9-release/run/p9/run_cmdline |
| 34 | +flash_skiboot=./mambo/p9/skiboot/skiboot.lid |
| 35 | +flash_kernel=./mambo/linux/vmlinux |
| 36 | +flash_initramfs=./mambo/mamboinit.img |
| 37 | +host_user=root |
| 38 | +host_password= |
| 39 | +
|
| 40 | +$ ./op-test -c mambo.cfg --run testcases.OpTestMamboBuildRoot.OpTestMamboBuildRoot |
| 41 | +
|
| 42 | +Note: |
| 43 | +for mambo/power-simulator binary/package can be obtained from |
| 44 | +ftp://public.dhe.ibm.com/software/server/powerfuncsim/ |
| 45 | +mamboinit.img is a image obtained from compiling https://github.com/open-power/buildroot |
| 46 | +skiboot.lid is obtained by compiling https://github.com/open-power/skiboot |
| 47 | +checkout readme of respective respositories for how to compile. |
| 48 | +''' |
| 49 | + |
| 50 | +import unittest |
| 51 | + |
| 52 | +import OpTestConfiguration |
| 53 | +from common.OpTestSystem import OpSystemState |
| 54 | +import common.OpTestMambo as OpTestMambo |
| 55 | + |
| 56 | +import OpTestLogger |
| 57 | +log = OpTestLogger.optest_logger_glob.get_logger(__name__) |
| 58 | + |
| 59 | + |
| 60 | +class OpTestMamboBuildRoot(unittest.TestCase): |
| 61 | + ''' |
| 62 | + Mambo Build Root test |
| 63 | + ''' |
| 64 | + |
| 65 | + def setUp(self): |
| 66 | + conf = OpTestConfiguration.conf |
| 67 | + self.ipmi = conf.ipmi() |
| 68 | + self.system = conf.system() |
| 69 | + self.host = conf.host() |
| 70 | + self.system.goto_state(OpSystemState.OS) |
| 71 | + self.prompt = self.system.util.build_prompt() |
| 72 | + self.c = self.system.console |
| 73 | + self.pty = self.c.get_console() |
| 74 | + if not isinstance(self.c, OpTestMambo.MamboConsole): |
| 75 | + raise unittest.SkipTest( |
| 76 | + "Must be running Mambo to perform this test") |
| 77 | + |
| 78 | + def runTest(self): |
| 79 | + # need to first perform run_command initially |
| 80 | + # which sets up the pexpect prompt for subsequent run_command(s) |
| 81 | + |
| 82 | + # mambo echos twice so turn off |
| 83 | + # this stays persistent even after switching context |
| 84 | + # from target OS to mambo and back |
| 85 | + self.c.run_command('stty -echo') |
| 86 | + |
| 87 | + uname_output = self.c.run_command('uname -a') |
| 88 | + log.debug("uname = {}".format(uname_output)) |
| 89 | + cpuinfo_output = self.c.run_command('cat /proc/cpuinfo') |
| 90 | + log.debug("cpuinfo = {}".format(cpuinfo_output)) |
| 91 | + int_output = self.c.run_command('cat /proc/interrupts') |
| 92 | + log.debug("interrupts = {}".format(int_output)) |
0 commit comments