Skip to content

Commit efa632e

Browse files
committed
ci: build debug kernels
Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 349a124 commit efa632e

File tree

8 files changed

+42
-7
lines changed

8 files changed

+42
-7
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../patches/0001-fix-Adjust-config-options-for-what-is-needed-by-our-.patch
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../patches/0002-ci-adjust-6.1-guest-kernel-configs-for-our-CI.patch

resources/rebuild.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ function clone_amazon_linux_repo {
135135
}
136136

137137
function apply_kernel_patches_for_ci {
138-
for p in $PWD/guest_configs/patches/* ; do
139-
patch -p2 < $p
138+
local PATCHES_DIR=$1
139+
for patch in $PATCHES_DIR/* ; do
140+
echo "Applying $patch"
141+
patch -p2 < $patch
140142
done
141143
}
142144

@@ -224,7 +226,7 @@ function build_al_kernels {
224226
clone_amazon_linux_repo
225227

226228
# Apply kernel patches on top of AL configuration
227-
apply_kernel_patches_for_ci
229+
apply_kernel_patches_for_ci guest_config/patches
228230

229231
if [[ "$KERNEL_VERSION" == @(all|5.10) ]]; then
230232
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config
@@ -239,6 +241,13 @@ function build_al_kernels {
239241
# Undo kernel patches on top of AL configuration
240242
git restore $PWD/guest_configs
241243
rm -rf $PWD/guest_configs/*.orig
244+
245+
# Build debug kernels
246+
OUTPUT_DIR=$OUTPUT_DIR/debug
247+
mkdir -pv $OUTPUT_DIR
248+
apply_kernel_patches_for_ci guest_configs/patches-debug
249+
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config
250+
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-6.1.config
242251
}
243252

244253
function print_help {

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,17 @@ def uvm_plain_any(microvm_factory, guest_kernel, rootfs_ubuntu_22):
444444
return microvm_factory.build(guest_kernel, rootfs_ubuntu_22)
445445

446446

447+
guest_kernel_6_1_debug = pytest.fixture(
448+
guest_kernel_fxt,
449+
params=kernel_params("vmlinux-6.1*", artifact_dir=defs.ARTIFACT_DIR / "debug"),
450+
)
451+
452+
453+
@pytest.fixture
454+
def uvm_plain_debug(microvm_factory, guest_kernel_6_1_debug, rootfs_rw):
455+
return microvm_factory.build(guest_kernel_6_1_debug, rootfs_rw)
456+
457+
447458
@pytest.fixture
448459
def uvm_with_initrd(
449460
microvm_factory, guest_kernel_linux_5_10, record_property, artifact_dir

tests/framework/artifacts.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def select_supported_kernels():
3333
return supported_kernels
3434

3535

36-
def kernels(glob) -> Iterator:
36+
def kernels(glob, artifact_dir: Path = ARTIFACT_DIR) -> Iterator:
3737
"""Return supported kernels as kernels supported by the current combination of kernel and
3838
instance type.
3939
"""
4040
supported_kernels = select_supported_kernels()
41-
for kernel in sorted(ARTIFACT_DIR.rglob(glob)):
41+
for kernel in sorted(artifact_dir.glob(glob)):
4242
for kernel_regex in supported_kernels:
4343
if re.fullmatch(kernel_regex, kernel.name):
4444
yield kernel
@@ -50,9 +50,11 @@ def disks(glob) -> Iterator:
5050
yield from sorted(ARTIFACT_DIR.glob(glob))
5151

5252

53-
def kernel_params(glob="vmlinux-*", select=kernels) -> Iterator:
53+
def kernel_params(
54+
glob="vmlinux-*", select=kernels, artifact_dir=ARTIFACT_DIR
55+
) -> Iterator:
5456
"""Return supported kernels"""
55-
for kernel in select(glob):
57+
for kernel in select(glob, artifact_dir):
5658
yield pytest.param(kernel, id=kernel.name)
5759

5860

tools/sandbox.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def parse_byte_size(param):
7373
if args.cpu_template_path is not None:
7474
cpu_template = json.loads(args.cpu_template_path.read_text())
7575
vmfcty = MicroVMFactory(*bins)
76+
77+
print(f"uvm with kernel {args.kernel} ...")
7678
uvm = vmfcty.build(args.kernel, args.rootfs)
7779
uvm.help.enable_console()
7880
uvm.help.resize_disk(uvm.rootfs_file, args.rootfs_size)
@@ -85,3 +87,12 @@ def parse_byte_size(param):
8587
print(cpu_template)
8688
uvm.start()
8789
uvm.get_all_metrics()
90+
91+
kernel_dbg_dir = args.kernel.parent / "debug"
92+
kernel_dbg = kernel_dbg_dir / args.kernel.name
93+
print(f"uvm2 with kernel {kernel_dbg} ...")
94+
uvm2 = vmfcty.build(kernel_dbg, args.rootfs)
95+
uvm2.spawn()
96+
uvm2.add_net_iface()
97+
uvm2.basic_config(vcpu_count=args.vcpus, mem_size_mib=args.guest_mem_size // 2**20)
98+
uvm2.start()

0 commit comments

Comments
 (0)