Make integration test runs in release mode

This commit is contained in:
Chen Chengjun
2023-11-02 14:09:37 +08:00
committed by Tate, Hongliang Tian
parent cf1d4faab4
commit 5d75298144
4 changed files with 26 additions and 6 deletions

View File

@ -18,14 +18,14 @@ jobs:
- name: Boot Test (Multiboot) - name: Boot Test (Multiboot)
id: boot_test_mb id: boot_test_mb
run: RUSTFLAGS="-C opt-level=1" make run AUTO_TEST=boot ENABLE_KVM=0 BOOT_PROTOCOL=multiboot run: make run AUTO_TEST=boot ENABLE_KVM=0 BOOT_PROTOCOL=multiboot RELEASE_MODE=1
- name: Boot Test (Multiboot2) - name: Boot Test (Multiboot2)
id: boot_test_mb2 id: boot_test_mb2
run: RUSTFLAGS="-C opt-level=1" make run AUTO_TEST=boot ENABLE_KVM=0 BOOT_PROTOCOL=multiboot2 run: make run AUTO_TEST=boot ENABLE_KVM=0 BOOT_PROTOCOL=multiboot2 RELEASE_MODE=1
- name: Syscall Test (Linux Boot Protocol) - name: Syscall Test (Linux Boot Protocol)
id: syscall_test_linux id: syscall_test_linux
run: RUSTFLAGS="-C opt-level=1" make run AUTO_TEST=syscall ENABLE_KVM=0 BOOT_PROTOCOL=linux run: make run AUTO_TEST=syscall ENABLE_KVM=0 BOOT_PROTOCOL=linux RELEASE_MODE=1
# TODO: include the integration tests for MicroVM, which is not ready yet. # TODO: include the integration tests for MicroVM, which is not ready yet.

View File

@ -9,6 +9,7 @@ GDB_CLIENT ?= 0
GDB_SERVER ?= 0 GDB_SERVER ?= 0
INTEL_TDX ?= 0 INTEL_TDX ?= 0
SKIP_GRUB_MENU ?= 1 SKIP_GRUB_MENU ?= 1
RELEASE_MODE ?= 0
# End of setting up Make varaiables # End of setting up Make varaiables
KERNEL_CMDLINE := SHELL="/bin/sh" LOGNAME="root" HOME="/" USER="root" PATH="/bin" init=/usr/bin/busybox -- sh -l KERNEL_CMDLINE := SHELL="/bin/sh" LOGNAME="root" HOME="/" USER="root" PATH="/bin" init=/usr/bin/busybox -- sh -l
@ -22,11 +23,21 @@ endif
CARGO_KBUILD_ARGS := CARGO_KBUILD_ARGS :=
CARGO_KRUN_ARGS := -- '$(KERNEL_CMDLINE)' CARGO_KRUN_ARGS :=
ifeq ($(RELEASE_MODE), 1)
CARGO_KBUILD_ARGS += --release
CARGO_KRUN_ARGS += --release
endif
CARGO_KRUN_ARGS += -- '$(KERNEL_CMDLINE)'
CARGO_KRUN_ARGS += --boot-method="$(BOOT_METHOD)" CARGO_KRUN_ARGS += --boot-method="$(BOOT_METHOD)"
CARGO_KRUN_ARGS += --boot-protocol="$(BOOT_PROTOCOL)" CARGO_KRUN_ARGS += --boot-protocol="$(BOOT_PROTOCOL)"
ifeq ($(RELEASE_MODE), 1)
CARGO_KRUN_ARGS += --release-mode
endif
ifeq ($(EMULATE_IOMMU), 1) ifeq ($(EMULATE_IOMMU), 1)
CARGO_KRUN_ARGS += --emulate-iommu CARGO_KRUN_ARGS += --emulate-iommu
endif endif

View File

@ -66,6 +66,7 @@ pub fn create_bootdev_image(
initramfs_path: PathBuf, initramfs_path: PathBuf,
grub_cfg: String, grub_cfg: String,
protocol: BootProtocol, protocol: BootProtocol,
release_mode: bool,
) -> PathBuf { ) -> PathBuf {
let target_dir = jinux_path.parent().unwrap(); let target_dir = jinux_path.parent().unwrap();
let iso_root = target_dir.join("iso_root"); let iso_root = target_dir.join("iso_root");
@ -86,7 +87,11 @@ pub fn create_bootdev_image(
let target_path = match protocol { let target_path = match protocol {
BootProtocol::Linux => { BootProtocol::Linux => {
// Find the setup header in the build script output directory. // Find the setup header in the build script output directory.
let bs_out_dir = glob("target/x86_64-custom/debug/build/jinux-frame-*").unwrap(); let bs_out_dir = if release_mode {
glob("target/x86_64-custom/release/build/jinux-frame-*").unwrap()
} else {
glob("target/x86_64-custom/debug/build/jinux-frame-*").unwrap()
};
let header_path = Path::new(bs_out_dir.into_iter().next().unwrap().unwrap().as_path()) let header_path = Path::new(bs_out_dir.into_iter().next().unwrap().unwrap().as_path())
.join("out") .join("out")
.join("bin") .join("bin")

View File

@ -80,6 +80,10 @@ struct Args {
/// Run a GDB client instead of running the kernel. /// Run a GDB client instead of running the kernel.
#[arg(long, default_value_t = false)] #[arg(long, default_value_t = false)]
run_gdb_client: bool, run_gdb_client: bool,
/// Run in the release mode.
#[arg(long, default_value_t = false)]
release_mode: bool,
} }
pub const COMMON_ARGS: &[&str] = &[ pub const COMMON_ARGS: &[&str] = &[
@ -119,7 +123,6 @@ pub const GDB_ARGS: &[&str] = &[
fn main() { fn main() {
let args = Args::parse(); let args = Args::parse();
if args.run_gdb_client { if args.run_gdb_client {
let gdb_grub = args.boot_method == BootMethod::QemuGrub; let gdb_grub = args.boot_method == BootMethod::QemuGrub;
// You should comment out the next line if you want to debug grub instead // You should comment out the next line if you want to debug grub instead
@ -195,6 +198,7 @@ fn main() {
initramfs_path, initramfs_path,
grub_cfg, grub_cfg,
args.boot_protocol, args.boot_protocol,
args.release_mode,
); );
qemu_cmd.arg("-cdrom"); qemu_cmd.arg("-cdrom");
qemu_cmd.arg(bootdev_image.as_os_str()); qemu_cmd.arg(bootdev_image.as_os_str());