From 5832119ec7419df8d6e3ced74e667cf03ff857f2 Mon Sep 17 00:00:00 2001 From: FlareCoding Date: Mon, 9 Sep 2024 16:28:52 -0400 Subject: [PATCH] Added support for a new make target just for unit tests and ability to extract the serial output into a file --- .gitignore | 4 +++- Makefile | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 29bb79e..0ef6c2d 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,8 @@ bin/ *.app *.efi -# QEMU files +# QEMU/Debug files usb_debug.log +com1.serial com2.serial +dev_os_output.log diff --git a/Makefile b/Makefile index f260211..d148b45 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ DISK_IMG := $(BIN_DIR)/$(OSNAME).elf # QEMU QEMU_CORES := 8 QEMU_EMULATOR := qemu-system-x86_64 -COMMON_QEMU_FLAGS := -machine q35 -device qemu-xhci,id=xhci -drive file=$(DISK_IMG),format=raw -m 4G -net none -smp $(QEMU_CORES) -serial mon:stdio -serial file:com2.serial -trace usb_xhci_* -D /tmp/stellux-qemu-xhci.log +COMMON_QEMU_FLAGS := -machine q35 -device qemu-xhci,id=xhci -drive file=$(DISK_IMG),format=raw -m 4G -net none -smp $(QEMU_CORES) -serial mon:stdio -trace usb_xhci_* -D /tmp/stellux-qemu-xhci.log QEMU_FLAGS := $(COMMON_QEMU_FLAGS) -drive if=pflash,format=raw,unit=0,file="efi/OVMF_CODE.fd",readonly=on -drive if=pflash,format=raw,unit=1,file="efi/OVMF_VARS.fd" # Sample connected USB 2.0 devices @@ -94,9 +94,13 @@ run-debug-headless: $(DISK_IMG) connect-gdb: gdb -ex "source ./gdb_setup.gdb" -ex "target remote localhost:4554" -ex "add-symbol-file kernel/bin/kernel.elf" -ex "b _kentry" +# Run tests target +run-tests: $(DISK_IMG) + $(QEMU_EMULATOR) $(QEMU_FLAGS) -nographic | tee dev_os_output.log + # Clean target clean: rm -rf $(BIN_DIR) $(MAKE) -C $(BOOTLOADER_DIR) clean $(MAKE) -C $(KERNEL_DIR) clean - rm -rf com2.serial + rm -rf com1.serial com2.serial dev_os_output.log