Skip to content

Commit 396a62a

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

File tree

8 files changed

+45
-7
lines changed

8 files changed

+45
-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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ function clone_amazon_linux_repo {
119119
}
120120

121121
function apply_kernel_patches_for_ci {
122-
for p in $PWD/guest_configs/patches/* ; do
123-
patch -p2 < $p
122+
local PATCHES_DIR=$1
123+
for patch in $PATCHES_DIR/* ; do
124+
echo "Applying $patch"
125+
patch -p2 < $patch
124126
done
125127
}
126128

@@ -198,12 +200,22 @@ build_initramfs
198200
clone_amazon_linux_repo
199201

200202
# Apply kernel patches on top of AL configuration
201-
apply_kernel_patches_for_ci
203+
git checkout guest_configs
204+
apply_kernel_patches_for_ci guest_configs/patches
202205

203206
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config
204207
if [ $ARCH == "x86_64" ]; then
205208
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10-no-acpi.config
206209
fi
207210
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-6.1.config
208211

212+
# Build debug kernels
213+
git checkout guest_configs
214+
OUTPUT_DIR=$OUTPUT_DIR/debug
215+
mkdir -pv $OUTPUT_DIR
216+
apply_kernel_patches_for_ci guest_configs/patches-debug
217+
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config
218+
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-6.1.config
219+
220+
209221
tree -h $OUTPUT_DIR

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)