forked from rcore-os/zCore
tests: update Makefile
This commit is contained in:
parent
7763b9d4e0
commit
180081bae7
6
Makefile
6
Makefile
|
@ -98,9 +98,3 @@ baremetal-test-img: prebuilt/linux/$(ROOTFS_TAR) rcore-fs-fuse
|
|||
@cp prebuilt/linux/libc-libos.so rootfs/lib/ld-musl-x86_64.so.1
|
||||
@echo Resizing $(ARCH).img
|
||||
@qemu-img resize $(OUT_IMG) +5M
|
||||
|
||||
baremetal-test:
|
||||
@make -C zCore baremetal-test MODE=release LINUX=1 | tee stdout-baremetal-test
|
||||
|
||||
baremetal-test-rv64:
|
||||
@make -C zCore baremetal-test-rv64 ARCH=riscv64 MODE=release LINUX=1 ROOTPROC=$(ROOTPROC) | tee -a stdout-baremetal-test-rv64 | tee stdout-rv64
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
mod event_listener;
|
||||
mod id_allocator;
|
||||
mod irq_manager;
|
||||
|
|
|
@ -8,12 +8,12 @@ LINUX ?=
|
|||
LIBOS ?=
|
||||
TEST ?=
|
||||
GRAPHIC ?=
|
||||
DISK ?=
|
||||
HYPERVISOR ?=
|
||||
V ?=
|
||||
|
||||
USER ?=
|
||||
ZBI ?= bringup
|
||||
CMDLINE ?= LOG=$(LOG)
|
||||
|
||||
SMP ?= 1
|
||||
ACCEL ?=
|
||||
|
@ -21,6 +21,12 @@ ACCEL ?=
|
|||
OBJDUMP ?= rust-objdump --print-imm-hex --x86-asm-syntax=intel
|
||||
OBJCOPY ?= rust-objcopy --binary-architecture=$(ARCH)
|
||||
|
||||
ifeq ($(LINUX), 1)
|
||||
CMDLINE ?= LOG=$(LOG)
|
||||
else
|
||||
CMDLINE ?= LOG=$(LOG):TERM=xterm-256color:console.shell=true:virtcon.disable=true
|
||||
endif
|
||||
|
||||
ifeq ($(LINUX), 1)
|
||||
user_img := $(ARCH).img
|
||||
else ifeq ($(USER), 1)
|
||||
|
@ -126,32 +132,33 @@ endif
|
|||
qemu_opts := -smp $(SMP)
|
||||
|
||||
ifeq ($(ARCH), x86_64)
|
||||
baremetal-test-qemu_opts := \
|
||||
qemu_opts += \
|
||||
-machine q35 \
|
||||
-cpu Haswell,+smap,-check,-fsgsbase \
|
||||
-m 4G \
|
||||
-m 1G \
|
||||
-serial mon:stdio \
|
||||
-drive format=raw,if=pflash,readonly=on,file=$(ovmf) \
|
||||
-drive format=raw,file=fat:rw:$(esp) \
|
||||
-device ich9-ahci,id=ahci \
|
||||
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \
|
||||
-nic none
|
||||
qemu_opts += $(baremetal-test-qemu_opts) \
|
||||
-drive format=qcow2,id=userdisk,if=none,file=$(qemu_disk) \
|
||||
-device ide-hd,bus=ahci.0,drive=userdisk
|
||||
else ifeq ($(ARCH), riscv64)
|
||||
qemu_opts += \
|
||||
-machine virt \
|
||||
-bios default \
|
||||
-m 512M \
|
||||
-no-reboot \
|
||||
-no-shutdown \
|
||||
-serial mon:stdio \
|
||||
-drive format=qcow2,id=userdisk,file=$(qemu_disk) \
|
||||
-device virtio-blk-device,drive=userdisk \
|
||||
-kernel $(kernel_img) \
|
||||
-initrd $(USER_IMG) \
|
||||
-append "LOG=$(LOG)"
|
||||
-append "$(CMDLINE)"
|
||||
endif
|
||||
|
||||
ifeq ($(DISK), on)
|
||||
ifeq ($(ARCH), x86_64)
|
||||
qemu_opts += -device ide-hd,bus=ahci.0,drive=userdisk
|
||||
else ifeq ($(ARCH), riscv64)
|
||||
qemu_opts += -device virtio-blk-device,drive=userdisk
|
||||
endif
|
||||
qemu_opts += -drive format=qcow2,id=userdisk,if=none,file=$(qemu_disk)
|
||||
endif
|
||||
|
||||
ifeq ($(GRAPHIC), on)
|
||||
|
@ -165,7 +172,6 @@ ifeq ($(GRAPHIC), on)
|
|||
endif
|
||||
else
|
||||
qemu_opts += -display none -nographic
|
||||
baremetal-test-qemu_opts += -display none -nographic
|
||||
endif
|
||||
|
||||
ifeq ($(ACCEL), 1)
|
||||
|
@ -198,6 +204,10 @@ endif
|
|||
|
||||
.PHONY: justrun
|
||||
justrun: $(qemu_disk)
|
||||
ifeq ($(ARCH), x86_64)
|
||||
$(sed) 's#initramfs=.*#initramfs=\\EFI\\zCore\\$(notdir $(user_img))#' $(esp)/EFI/Boot/rboot.conf
|
||||
$(sed) 's#cmdline=.*#cmdline=$(CMDLINE)#' $(esp)/EFI/Boot/rboot.conf
|
||||
endif
|
||||
$(qemu) $(qemu_opts)
|
||||
|
||||
.PHONY: debugrun
|
||||
|
@ -243,12 +253,6 @@ ifeq ($(ARCH), x86_64)
|
|||
cp rboot.conf $(esp)/EFI/Boot/rboot.conf
|
||||
cp $(kernel_elf) $(esp)/EFI/zCore/zcore.elf
|
||||
cp $(user_img) $(esp)/EFI/zCore/
|
||||
$(sed) "s/fuchsia.zbi/$(notdir $(user_img))/" $(esp)/EFI/Boot/rboot.conf
|
||||
ifneq ($(CMDLINE),)
|
||||
$(sed) "s#cmdline=.*#cmdline=$(CMDLINE)#" $(esp)/EFI/Boot/rboot.conf
|
||||
else
|
||||
$(sed) "s/LOG=warn/LOG=$(LOG)/" $(esp)/EFI/Boot/rboot.conf
|
||||
endif
|
||||
else ifeq ($(ARCH), riscv64)
|
||||
$(OBJCOPY) $(kernel_elf) --strip-all -O binary $@
|
||||
endif
|
||||
|
@ -271,21 +275,6 @@ image:
|
|||
hdiutil create -fs fat32 -ov -volname EFI -format UDTO -srcfolder $(esp) $(build_path)/zcore.cdr
|
||||
qemu-img convert -f raw $(build_path)/zcore.cdr -O qcow2 $(build_path)/zcore.qcow2
|
||||
|
||||
################ Tests ################
|
||||
|
||||
.PHONY: baremetal-qemu-disk
|
||||
baremetal-qemu-disk:
|
||||
@qemu-img create -f qcow2 $(build_path)/disk.qcow2 100M
|
||||
|
||||
.PHONY: baremetal-test
|
||||
baremetal-test:
|
||||
cp rboot.conf $(esp)/EFI/Boot/rboot.conf
|
||||
timeout --foreground 8s $(qemu) $(baremetal-test-qemu_opts)
|
||||
|
||||
.PHONY: baremetal-test-rv64
|
||||
baremetal-test-rv64: build $(qemu_disk)
|
||||
timeout --foreground 8s $(qemu) $(qemu_opts) -append ROOTPROC=$(ROOTPROC)
|
||||
|
||||
################ Deprecated ################
|
||||
|
||||
VMDISK := $(build_path)/boot.vdi
|
||||
|
|
|
@ -39,11 +39,13 @@ pub fn boot_options() -> BootOptions {
|
|||
std::process::exit(-1);
|
||||
}
|
||||
|
||||
let log_level = std::env::var("LOG").unwrap_or_default();
|
||||
let cmdline = if cfg!(feature = "zircon") {
|
||||
args.get(2).cloned().unwrap_or_default()
|
||||
let (cmdline, log_level) = if cfg!(feature = "zircon") {
|
||||
let cmdline = args.get(2).cloned().unwrap_or_default();
|
||||
let options = parse_cmdline(&cmdline);
|
||||
let log_level = String::from(*options.get("LOG").unwrap_or(&""));
|
||||
(cmdline, log_level)
|
||||
} else {
|
||||
String::new()
|
||||
(String::new(), std::env::var("LOG").unwrap_or_default())
|
||||
};
|
||||
BootOptions {
|
||||
cmdline,
|
||||
|
@ -89,10 +91,10 @@ pub fn wait_for_exit(proc: Option<Arc<Process>>) -> ! {
|
|||
let future = async move {
|
||||
use zircon_object::object::Signal;
|
||||
let object: Arc<dyn KernelObject> = proc.clone();
|
||||
let signal = if cfg!(feature = "zircon") {
|
||||
Signal::USER_SIGNAL_0
|
||||
} else {
|
||||
let signal = if cfg!(any(feature = "linux", feature = "baremetal-test")) {
|
||||
Signal::PROCESS_TERMINATED
|
||||
} else {
|
||||
Signal::USER_SIGNAL_0
|
||||
};
|
||||
object.wait_signal(signal).await;
|
||||
check_exit_code(proc)
|
||||
|
@ -120,9 +122,6 @@ pub fn wait_for_exit(proc: Option<Arc<Process>>) -> ! {
|
|||
let has_task = executor::run_until_idle();
|
||||
if cfg!(feature = "baremetal-test") && !has_task {
|
||||
proc.map(check_exit_code);
|
||||
// if let Some(p) = proc {
|
||||
// check_exit_code(p);
|
||||
// }
|
||||
kernel_hal::cpu::reset();
|
||||
}
|
||||
kernel_hal::interrupt::wait_for_interrupt();
|
||||
|
|
|
@ -291,7 +291,7 @@ impl Syscall<'_> {
|
|||
info_ptr.write(job.get_info())?;
|
||||
}
|
||||
Topic::ProcessVmos => {
|
||||
error!("A dummy implementation for utest Bti.NoDelayedUnpin, it does not check the reture value");
|
||||
warn!("A dummy implementation for utest Bti.NoDelayedUnpin, it does not check the reture value");
|
||||
actual.write(0)?;
|
||||
avail.write(0)?;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue