Skip to content

Commit 2378a6f

Browse files
committed
ngci: Import CI wrapper scripts
Scripts that configure and build multiple kernels, using the existing build Makefiles. Then run various qemu boots of those kernels using the qemu scripts. Example usage: $ cd ~/linux $ ~/ci-scripts/scripts/ngci/qemu-coverage -j $(nproc) $PWD
1 parent 1bf1919 commit 2378a6f

11 files changed

+1328
-0
lines changed

etc/configs.py

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Shared config fragments etc.
2+
3+
guest_configs = [
4+
'arch/powerpc/configs/guest.config',
5+
'netconsole-n',
6+
'ibmveth', # For PowerVM LPARs
7+
'kuap',
8+
'criu', # For seccomp tests
9+
'user-ns', # For seccomp tests
10+
'lkdtm', # Because it's useful
11+
'ptdump', # Because it's useful
12+
'strict-rwx', # Get some test coverage
13+
'kfence',
14+
'srr-debug',
15+
'irq-soft-mask-debug',
16+
'printk-index',
17+
'debug-atomic-sleep',
18+
'secure-boot',
19+
'debug-vm',
20+
'btrfs-y', # Needed for F39
21+
'vfat-y', # Needed for F39
22+
'zram', # Needed for F39
23+
]
24+
25+
guest_configs_4k = guest_configs + ['4k-pages']
26+
guest_configs_maxsmp = guest_configs + ['nr-cpus-8192']
27+
28+
legacy_guest_configs = [
29+
'arch/powerpc/configs/guest.config',
30+
'netconsole-n',
31+
'ibmveth', # For PowerVM LPARs
32+
'ibmehea', # Needed for Power7
33+
'strict-rwx-off', # Bloats image too much for netboot to work w/128MB RMA
34+
'nr-cpus-64', # Shrink kernel size
35+
'ftrace-n', # Shrink kernel size
36+
]
37+
38+
pmac32_configs = [
39+
'pmaczilog',
40+
'devtmpfs',
41+
'debugfs',
42+
'ptdump',
43+
'debug-atomic-sleep',
44+
'cgroups-y',
45+
'arch/powerpc/configs/guest.config',
46+
]
47+
48+
g5_configs = [
49+
'pmaczilog',
50+
'debugfs',
51+
'ptdump',
52+
'pstore',
53+
'kvm-pr-y',
54+
'agp-uninorth-y',
55+
]
56+
57+
cell_configs = [
58+
'cell',
59+
'lockdep-y',
60+
'debug-atomic-sleep',
61+
'xmon-non-default',
62+
]
63+
64+
powernv_configs = [
65+
'tools/testing/selftests/ftrace/config',
66+
'tools/testing/selftests/bpf/config',
67+
'criu', # needed for selftests-seccomp
68+
'igb', # Needed on some machines
69+
'xfs-y', # Needed on some machines
70+
'bridge-y', # Needed on some machines
71+
'ahci-y', # Needed on some machines
72+
'i40e-y', # Needed on some machines
73+
'kvm-pr-m',
74+
'strict-rwx',
75+
'debug-atomic-sleep',
76+
'selftests',
77+
'pci-iov',
78+
'page-poisoning-y',
79+
'srr-debug', # Get some test coverage
80+
'livepatch',
81+
'secure-boot',
82+
'zram',
83+
'ptdump',
84+
'amdgpu-y',
85+
'drm-aspeed-y', # Aspeed DRM driver for /dev/fb0 on powernv machines
86+
'fb-y', # Enable frame buffer for /dev/fb0 & alignment test
87+
'xmon-non-default', # Better oopses in logs
88+
'xmon-rw',
89+
'selinux', # Avoid selinux relabeling on Fedora machines
90+
'vfio-y', # Test coverage of VFIO
91+
'cgroups-y', # So podman can run
92+
'gup-test-y', # Enable selftest
93+
]
94+
95+
powernv_lockdep_configs = powernv_configs + ['lockdep-y']
96+
97+
corenet64_configs = [
98+
'debug-info-n',
99+
'ppc64e-qemu',
100+
'arch/powerpc/configs/guest.config',
101+
]

etc/defaults.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
QEMU_VERSION = '9.0.2'
2+
3+
DEFAULT_OLD_IMAGE = '[email protected]'
4+
DEFAULT_NEW_IMAGE = 'fedora'
5+
DEFAULT_IMAGES = [DEFAULT_OLD_IMAGE, DEFAULT_NEW_IMAGE]
6+
7+
CLANG_IMAGES = ['fedora', 'ubuntu']
8+
SPARSE_IMAGES = ['fedora', 'ubuntu']

etc/tests.py

+285
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
from ngci import TestSuite, SelftestsBuild, SelftestsConfig, QemuSelftestsConfig, TestConfig, QemuNetTestConfig
2+
from configs import *
3+
from defaults import *
4+
from qemu import kvm_present
5+
6+
7+
def std_images(args):
8+
if args.images:
9+
return args.images
10+
11+
return DEFAULT_IMAGES
12+
13+
14+
def sparse_image(images):
15+
for image in images:
16+
if image in SPARSE_IMAGES:
17+
return image
18+
return None
19+
20+
21+
def clang_image(images):
22+
for image in images:
23+
if image in CLANG_IMAGES:
24+
return image
25+
return None
26+
27+
28+
def qemu_coverage(args, suite=None):
29+
images = std_images(args)
30+
if suite is None:
31+
suite = TestSuite('qemu-coverage', qemus=args.qemus)
32+
33+
k = suite.add_kernel
34+
b = suite.add_qemu_boot
35+
36+
have_kvm = kvm_present()
37+
if have_kvm:
38+
accel = 'kvm'
39+
else:
40+
accel = 'tcg'
41+
42+
image = clang_image(images)
43+
# Clang builds & boots
44+
if image:
45+
k('ppc64le_guest_defconfig+clang', image, merge_config=guest_configs, clang=True)
46+
k('ppc64_guest_defconfig+clang', image, merge_config=guest_configs, clang=True)
47+
k('corenet64_smp_defconfig+clang', image, merge_config=corenet64_configs + ['disable-werror'], clang=True)
48+
k('corenet32_smp_defconfig+clang', image, merge_config=['debug-info-n', 'ppc64e-qemu', 'disable-werror'], clang=True)
49+
k('pmac32_defconfig+clang', image, merge_config=pmac32_configs + ['disable-werror'], clang=True)
50+
k('g5_defconfig+clang', image, merge_config=g5_configs + ['disable-werror'], clang=True)
51+
52+
b('qemu-mac99', 'pmac32_defconfig+clang', image)
53+
b('qemu-g5', 'g5_defconfig+clang', image)
54+
# Doesn't boot
55+
# b('qemu-e500mc', 'corenet32_smp_defconfig+clang', image)
56+
b('qemu-ppc64e', 'corenet64_smp_defconfig+clang', image)
57+
b('qemu-pseries+p10+tcg', 'ppc64le_guest_defconfig+clang', image)
58+
b('qemu-powernv+p10+tcg', 'ppc64le_guest_defconfig+clang', image)
59+
60+
b(f'qemu-pseries+p8+{accel}', 'ppc64le_guest_defconfig+clang', image)
61+
b(f'qemu-pseries+p9+{accel}', 'ppc64le_guest_defconfig+clang', image)
62+
b(f'qemu-pseries+p8+{accel}', 'ppc64_guest_defconfig+clang', image)
63+
b(f'qemu-pseries+p9+{accel}', 'ppc64_guest_defconfig+clang', image)
64+
65+
# GCC builds & boots
66+
for image in images:
67+
# BOOK3S64 && LITTLE_ENDIAN, PSERIES and POWERNV
68+
k('ppc64le_guest_defconfig+lockdep', image, merge_config=guest_configs + ['lockdep-y'])
69+
# BOOK3S64 && BIG_ENDIAN
70+
# PSERIES, POWERNV, CELL, PS3, PMAC && PMAC64, PASEMI, MAPLE
71+
k('ppc64_guest_defconfig+lockdep', image, merge_config=guest_configs + ['lockdep-y'])
72+
# As above with 4K page size
73+
k('ppc64le_guest_defconfig+4k', image, merge_config=guest_configs_4k)
74+
k('ppc64_guest_defconfig+4k', image, merge_config=guest_configs_4k)
75+
# G5
76+
k('g5_defconfig', image, merge_config=g5_configs)
77+
# BOOK3E_64
78+
k('corenet64_smp_defconfig', image, merge_config=corenet64_configs)
79+
k('corenet64_smp_defconfig+e6500', image, merge_config=corenet64_configs + ['e6500-y', 'altivec-y'])
80+
# PPC_BOOK3S_32
81+
k('pmac32_defconfig', image, merge_config=pmac32_configs)
82+
# 44x
83+
k('ppc44x_defconfig', image, merge_config=['devtmpfs'])
84+
# 8xx
85+
k('mpc885_ads_defconfig', image)
86+
87+
# PPC_85xx
88+
if image != "[email protected]":
89+
k('corenet32_smp_defconfig', image, merge_config=['debug-info-n'])
90+
b('qemu-e500mc', 'corenet32_smp_defconfig', image)
91+
92+
# PPC_BOOK3S_32
93+
b('qemu-mac99', 'pmac32_defconfig', image)
94+
b('qemu-mac99+debian', 'pmac32_defconfig', image)
95+
# 44x
96+
b('qemu-44x', 'ppc44x_defconfig', image)
97+
# ppc64e
98+
b('qemu-ppc64e', 'corenet64_smp_defconfig', image)
99+
b('qemu-ppc64e+compat', 'corenet64_smp_defconfig', image)
100+
b('qemu-e6500', 'corenet64_smp_defconfig+e6500', image)
101+
b('qemu-e6500+debian', 'corenet64_smp_defconfig+e6500', image)
102+
# G5
103+
b('qemu-g5', 'g5_defconfig', image)
104+
b('qemu-g5+compat', 'g5_defconfig', image)
105+
# pseries boots
106+
b('qemu-pseries+p10+tcg', 'ppc64le_guest_defconfig+lockdep', image)
107+
b('qemu-pseries+p10+tcg', 'ppc64_guest_defconfig+lockdep', image)
108+
109+
b(f'qemu-pseries+p8+{accel}', 'ppc64le_guest_defconfig+lockdep', image)
110+
b(f'qemu-pseries+p9+{accel}', 'ppc64le_guest_defconfig+lockdep', image)
111+
b(f'qemu-pseries+p8+{accel}', 'ppc64_guest_defconfig+lockdep', image)
112+
b(f'qemu-pseries+p9+{accel}', 'ppc64_guest_defconfig+lockdep', image)
113+
b(f'qemu-pseries+p9+{accel}+fedora39', 'ppc64le_guest_defconfig+lockdep', image)
114+
# powernv boots
115+
b('qemu-powernv+p8+tcg', 'ppc64le_guest_defconfig+lockdep', image)
116+
b('qemu-powernv+p9+tcg', 'ppc64le_guest_defconfig+lockdep', image)
117+
b('qemu-powernv+p10+tcg', 'ppc64le_guest_defconfig+lockdep', image)
118+
b('qemu-powernv+p8+tcg', 'ppc64_guest_defconfig+lockdep', image)
119+
b('qemu-powernv+p9+tcg', 'ppc64_guest_defconfig+lockdep', image)
120+
b('qemu-powernv+p10+tcg', 'ppc64_guest_defconfig+lockdep', image)
121+
122+
123+
for image in ['[email protected]', 'ubuntu']:
124+
suite.add_selftest(image, 'ppc64le')
125+
suite.add_selftest(image, 'ppc64le', 'ppctests')
126+
127+
return suite
128+
129+
130+
def full_compile_test(args, suite=None):
131+
images = std_images(args)
132+
if suite is None:
133+
suite = TestSuite('full-compile-test')
134+
135+
k = suite.add_kernel
136+
137+
#########################################
138+
# Clang builds
139+
#########################################
140+
image = clang_image(images)
141+
if image:
142+
k('ppc64le_guest_defconfig+clang', image, merge_config=guest_configs, clang=True)
143+
k('ppc64le_guest_defconfig+clang+ias', image, merge_config=guest_configs, clang=True, llvm_ias=True)
144+
k('ppc64_guest_defconfig+clang', image, merge_config=guest_configs, clang=True)
145+
k('corenet64_smp_defconfig+clang', image, merge_config=corenet64_configs + ['disable-werror'], clang=True)
146+
k('corenet32_smp_defconfig+clang', image, merge_config=['debug-info-n', 'ppc64e-qemu', 'disable-werror'], clang=True)
147+
k('pmac32_defconfig+clang', image, merge_config=pmac32_configs + ['disable-werror'], clang=True)
148+
k('g5_defconfig+clang', image, merge_config=g5_configs + ['disable-werror'], clang=True)
149+
k('mpc885_ads_defconfig+clang', image, clang=True)
150+
k('ppc44x_defconfig+clang', image, clang=True)
151+
152+
#########################################
153+
# Sparse builds
154+
#########################################
155+
image = sparse_image(images)
156+
if image:
157+
k('ppc64le_defconfig+sparse', image, sparse=True)
158+
k('ppc64_defconfig+sparse', image, sparse=True)
159+
k('pmac32_defconfig+sparse', image, sparse=True)
160+
161+
# MICROWATT, also VSX=n, doesn't build with GCC 5.5.0
162+
k('microwatt_defconfig', 'fedora')
163+
164+
# GCC builds & boots
165+
for image in images:
166+
#########################################
167+
# Major platforms coverage
168+
#########################################
169+
# BOOK3S64 && LITTLE_ENDIAN, PSERIES and POWERNV
170+
k('ppc64le_guest_defconfig', image, merge_config=guest_configs)
171+
# BOOK3S64 && BIG_ENDIAN
172+
# PSERIES, POWERNV, CELL, PS3, PMAC && PMAC64, PASEMI, MAPLE
173+
k('ppc64_guest_defconfig', image, merge_config=guest_configs)
174+
# As above with 4K page size
175+
k('ppc64le_guest_defconfig+4k', image, merge_config=guest_configs_4k)
176+
k('ppc64_guest_defconfig+4k', image, merge_config=guest_configs_4k)
177+
# PMAC && PMAC64
178+
k('g5_defconfig', image, merge_config=g5_configs)
179+
# BOOK3E_64
180+
k('corenet64_smp_defconfig', image, merge_config=corenet64_configs)
181+
# PPC_85xx, PPC_E500MC
182+
k('corenet32_smp_defconfig', image, merge_config=['debug-info-n'])
183+
# PPC_85xx, SMP=y, PPC_E500MC=n
184+
k('mpc85xx_smp_defconfig', image)
185+
# PPC_85xx, SMP=n
186+
k('mpc85xx_defconfig', image)
187+
# PPC_BOOK3S_32
188+
k('pmac32_defconfig', image, merge_config=pmac32_configs)
189+
k('pmac32_defconfig+smp', image, merge_config=pmac32_configs + ['smp-y'])
190+
# 44x
191+
k('ppc44x_defconfig', image, merge_config=['devtmpfs'])
192+
# 8xx
193+
k('mpc885_ads_defconfig', image)
194+
195+
#########################################
196+
# allyes/no/mod
197+
#########################################
198+
if image.startswith('korg@'):
199+
no_gcc_plugins = ['gcc-plugins-n']
200+
else:
201+
no_gcc_plugins = []
202+
203+
# 32-bit Book3S BE
204+
k('allnoconfig', image)
205+
# 64-bit Book3S LE
206+
# Doesn't exist
207+
#k('ppc64le_allyesconfig', image)
208+
209+
# GCC 5.5.0 fails on various things for allyes/allmod
210+
tmp_image = image.replace('[email protected]', '[email protected]')
211+
# 64-bit Book3S BE
212+
k('allyesconfig', tmp_image, merge_config=no_gcc_plugins)
213+
# 64-bit Book3S BE
214+
k('allmodconfig', tmp_image, merge_config=no_gcc_plugins)
215+
# 64-bit Book3S LE
216+
k('ppc64le_allmodconfig', tmp_image, merge_config=no_gcc_plugins)
217+
# 32-bit Book3S BE (korg 5.5.0 doesn't build)
218+
k('ppc32_allmodconfig', tmp_image, merge_config=no_gcc_plugins)
219+
# 64-bit BOOK3E BE (korg 5.5.0 doesn't build)
220+
# FIXME Broken due to start_text_address problems
221+
# k('ppc64_book3e_allmodconfig', tmp_image, merge_config=no_gcc_plugins)
222+
223+
#########################################
224+
# specific machine/platform configs
225+
#########################################
226+
# PSERIES (BE)
227+
k('pseries_defconfig', image),
228+
# PSERIES (LE)
229+
k('pseries_le_defconfig', image),
230+
# Options for old LPARs
231+
k('ppc64le_guest_defconfig+legacy', image, merge_config=legacy_guest_configs)
232+
# POWERNV
233+
cfgs = powernv_configs
234+
if image == '[email protected]':
235+
# BTF causes build errors with 5.5.0, disable it
236+
cfgs.append('btf-n')
237+
k('powernv_defconfig', image, merge_config=cfgs)
238+
# CELL
239+
k('cell_defconfig', image, merge_config=cell_configs)
240+
# POWERNV, some shrinking/hardening options
241+
k('skiroot_defconfig', image)
242+
# PPC_86xx (BOOK3S_32)
243+
k('mpc86xx_smp_defconfig', image)
244+
245+
#########################################
246+
# specific features
247+
#########################################
248+
# PPC_8xx + PPC16K_PAGES
249+
k('mpc885_ads_defconfig+16k', image, merge_config=['16k-pages'])
250+
251+
#########################################
252+
# specific enabled features
253+
#########################################
254+
for feature in ['preempt', 'compat', 'lockdep', 'reltest']:
255+
k(f'ppc64_defconfig+{feature}', image, merge_config=[f'{feature}-y'])
256+
k(f'ppc64le_defconfig+{feature}', image, merge_config=[f'{feature}-y'])
257+
258+
#########################################
259+
# specific disabled features
260+
#########################################
261+
for feature in ['radix', 'modules']:
262+
k(f'ppc64_defconfig+no{feature}', image, merge_config=[f'{feature}-n'])
263+
k(f'ppc64le_defconfig+no{feature}', image, merge_config=[f'{feature}-n'])
264+
265+
# PPC_85xx + RANDOMIZE_BASE
266+
# This hits gcc segfaults with earlier compilers, so use 8.5.0
267+
k('mpc85xx_smp_defconfig+kaslr', image.replace('[email protected]', '[email protected]'), merge_config=['randomize-base-y'])
268+
269+
#########################################
270+
# selftests
271+
#########################################
272+
for version in ['16.04', '18.04', '20.04', '22.04', '22.10']:
273+
image = f'ubuntu@{version}'
274+
for subarch in ['ppc64', 'ppc64le']:
275+
suite.add_selftest(image, subarch, 'selftests')
276+
suite.add_selftest(image, subarch, 'ppctests')
277+
278+
return suite
279+
280+
281+
def full_compile_and_qemu(args):
282+
suite = TestSuite('full-compile-and-qemu', qemus=args.qemus)
283+
full_compile_test(args, suite)
284+
qemu_coverage(args, suite)
285+
return suite

lib/configs.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../etc/configs.py

0 commit comments

Comments
 (0)