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

@ -66,6 +66,7 @@ pub fn create_bootdev_image(
initramfs_path: PathBuf,
grub_cfg: String,
protocol: BootProtocol,
release_mode: bool,
) -> PathBuf {
let target_dir = jinux_path.parent().unwrap();
let iso_root = target_dir.join("iso_root");
@ -86,7 +87,11 @@ pub fn create_bootdev_image(
let target_path = match protocol {
BootProtocol::Linux => {
// 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())
.join("out")
.join("bin")

View File

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