Skip to content

Commit a63c40f

Browse files
committed
Merge branch 'master' into deploy
2 parents f595d21 + ddeb976 commit a63c40f

7 files changed

Lines changed: 84 additions & 25 deletions

File tree

build/scripts/container-build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ elif [[ "$1" == "docs" ]]; then
153153
elif [[ "$1" == "perf" ]]; then
154154
cmd="make $quiet -C tools/perf O=/output"
155155

156+
if [[ $(uname -m) != "ppc64le" ]]; then
157+
cmd+=" NO_LIBELF=1 NO_LIBTRACEEVENT=1"
158+
fi
159+
156160
if [[ -n "$PRE_CLEAN" ]]; then
157161
(set -x; $cmd clean)
158162
fi

lib/pexpect_utils.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,10 @@ def terminate(self):
3838
self.child.terminate()
3939
self.wait_for_exit()
4040

41-
def drain_and_terminate(self, child, msg):
42-
logging.error(msg)
43-
44-
# Wait for the end of the oops, if it is one
45-
try:
46-
idx = self.child.expect(['--\[ end trace', pexpect.TIMEOUT], timeout=10)
47-
except pexpect.exceptions.EOF:
48-
idx = -1
49-
pass
50-
51-
if idx == 1:
52-
# That didn't match, let it run for a bit
53-
time.sleep(5)
54-
41+
def drain_and_terminate(self):
42+
# Wait for 10s out of output, which should give oopses time to be logged
43+
self.child.expect([pexpect.TIMEOUT, pexpect.EOF], timeout=10)
5544
self.terminate()
56-
raise Exception(msg)
5745

5846
def get_match(self, i=0):
5947
return self.child.match.group(i)
@@ -71,10 +59,16 @@ def expect(self, patterns, timeout=-1, bug_patterns=None):
7159
patterns.extend(bug_patterns)
7260

7361
idx = self.child.expect(patterns, timeout=timeout)
74-
logging.debug("Matched: '%s' %s", self.get_match(), self.matches())
62+
if self.child.match == pexpect.TIMEOUT:
63+
logging.debug("Timed out looking for a match")
64+
else:
65+
logging.debug("Matched: '%s' %s", self.get_match(), self.matches())
7566

7667
if idx >= len(patterns) - len(bug_patterns):
77-
self.drain_and_terminate(self.child, "Error: saw oops/warning etc. while expecting")
68+
msg = "Error: saw oops/warning etc. while expecting"
69+
logging.error(msg)
70+
self.drain_and_terminate()
71+
raise Exception(msg)
7872

7973
return idx
8074

lib/qemu.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,19 @@ def apply_defaults(self):
8484

8585
if self.cpuinfo is None:
8686
if self.machine_is('pseries'):
87-
self.cpuinfo = 'IBM pSeries \(emulated by qemu\)'
87+
self.cpuinfo = ['IBM pSeries \(emulated by qemu\)']
8888
elif self.machine_is('powernv'):
89-
self.cpuinfo = 'IBM PowerNV \(emulated by qemu\)'
89+
self.cpuinfo = ['IBM PowerNV \(emulated by qemu\)']
9090
elif self.machine == 'mac99':
91-
self.cpuinfo = 'PowerMac3,1 MacRISC MacRISC2 Power Macintosh'
91+
self.cpuinfo = ['PowerMac3,1 MacRISC MacRISC2 Power Macintosh']
9292
elif self.machine == 'g3beige':
93-
self.cpuinfo = 'AAPL,PowerMac G3 MacRISC'
93+
self.cpuinfo = ['AAPL,PowerMac G3 MacRISC']
9494
elif self.machine == 'bamboo':
95-
self.cpuinfo = 'PowerPC 44x Platform'
95+
self.cpuinfo = ['PowerPC 44x Platform']
9696
elif self.machine == 'ppce500':
97-
self.cpuinfo = 'QEMU ppce500'
97+
self.cpuinfo = ['QEMU ppce500']
98+
if self.cpu:
99+
self.cpuinfo.insert(0, f'cpu\s+: {self.cpu}')
98100

99101
if self.qemu_path is None:
100102
if self.machine_is('pseries') or self.machine_is('powernv'):
@@ -235,6 +237,7 @@ def qemu_monitor_shutdown(p):
235237

236238

237239
def get_qemu(name='qemu-system-ppc64'):
240+
# This looks for QEMU_SYSTEM_PPC64 or QEMU_SYSTEM_PPC in the environment
238241
qemu = get_env_var(name.upper().replace('-', '_'))
239242
if qemu is None:
240243
# Defer to $PATH search
@@ -381,7 +384,8 @@ def qemu_main(qconf):
381384

382385
p.send('cat /proc/cpuinfo')
383386
if qconf.cpuinfo:
384-
p.expect(qconf.cpuinfo)
387+
for s in qconf.cpuinfo:
388+
p.expect(s)
385389
p.expect_prompt()
386390

387391
if qconf.net_tests:

scripts/boot/qemu-e500mc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/python3
2+
#
3+
# Kernel needs:
4+
# corenet32_smp_defconfig +
5+
# CONFIG_PPC_QEMU_E500=y
6+
# CONFIG_POWER_RESET_GPIO=y
7+
#
8+
# $ cd ~/src/linux
9+
# $ make
10+
# $ ~/src/ci-scripts/scripts/boot/qemu-e500mc
11+
#
12+
# Or:
13+
#
14+
# export VMLINUX_PATH=~/src/linux/vmlinux
15+
# export KERNEL_RELEASE_PATH=~/src/linux/include/config/kernel.release
16+
#
17+
# Optional:
18+
# export QEMU_SYSTEM_PPC=~/src/qemu/ppc-softmmu/qemu-system-ppc
19+
# export ROOT_DISK_PATH=~/some/directory
20+
#
21+
# Expects ROOT_DISK_PATH to contain:
22+
# ppc-rootfs.cpio.gz
23+
24+
import logging
25+
import os, sys
26+
sys.path.append(f'{os.path.dirname(sys.argv[0])}/../../lib')
27+
28+
from qemu import QemuConfig, qemu_main
29+
from utils import setup_logging
30+
31+
32+
def main():
33+
setup_logging()
34+
35+
qconf = QemuConfig('ppce500')
36+
qconf.configure_from_env()
37+
qconf.configure_from_args(sys.argv[1:])
38+
qconf.qemu_path = 'qemu-system-ppc'
39+
qconf.net_tests = False
40+
qconf.mem = '2G'
41+
qconf.smp = 1
42+
qconf.cpu = 'e500mc'
43+
44+
qconf.apply_defaults()
45+
46+
return qemu_main(qconf)
47+
48+
sys.exit(0 if main() else 1)

scripts/boot/qemu-e5500

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
exec "$(dirname "$0")"/qemu-ppc64e $@

scripts/boot/qemu-e6500

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
export CPU=e6500
4+
export QEMU_INITRD=ppc64-rootfs.cpio.gz
5+
6+
exec "$(dirname "$0")"/qemu-ppc64e $@

scripts/boot/qemu-ppc64e

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def main():
3636
setup_logging()
3737

3838
qconf = QemuConfig('ppce500')
39+
qconf.cpu = 'e5500'
3940
qconf.configure_from_env()
4041
qconf.configure_from_args(sys.argv[1:])
4142
qconf.qemu_path = 'qemu-system-ppc64'
4243
qconf.net_tests = False
4344
qconf.mem = '4G'
4445
qconf.smp = 1
45-
qconf.cpu = 'e5500'
4646

4747
qconf.apply_defaults()
4848

0 commit comments

Comments
 (0)