summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordzwdz2021-10-15 17:56:15 +0200
committerdzwdz2021-10-15 17:56:15 +0200
commit6f9626fbd235f5e66ba61affa064e3b44ffc012a (patch)
tree6a9f54c0d9e05b614c683cc681f5bc4b91d61c41
parent75b26dae5bd8a3aa0131a49769cfe9f361808b1b (diff)
basic QEMU automation for testing
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6f6f71c..df82583 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wold-style-definition
CFLAGS += -mgeneral-regs-only
CFLAGS += -Isrc/
LFLAGS = -ffreestanding -O2 -nostdlib -lgcc
-QFLAGS = -no-reboot -serial stdio -display none
+QFLAGS = -no-reboot -display none
define from_sources
$(patsubst src/%.s,out/obj/%.s.o,$(shell find $(1) -type f -name '*.s')) \
@@ -19,12 +19,23 @@ endef
all: out/boot.iso check
boot: all out/hdd
- qemu-system-i386 -cdrom out/boot.iso $(QFLAGS) \
+ qemu-system-i386 -cdrom out/boot.iso $(QFLAGS) -serial stdio \
-drive file=out/hdd,format=raw,media=disk
+test: all
+ @# pipes for the serial
+ @mkfifo out/qemu.in out/qemu.out 2> /dev/null || true
+ qemu-system-i386 -cdrom out/boot.iso $(QFLAGS) -serial pipe:out/qemu &
+ @# for some reason the first sent character doesn't go through to the shell
+ @# the empty echo takes care of that, so the next echos will work just fine
+ @echo > out/qemu.in
+ echo run_tests > out/qemu.in
+ echo exit > out/qemu.in
+ @echo
+ @cat out/qemu.out
debug: all
- qemu-system-i386 -cdrom out/boot.iso $(QFLAGS) -s -S &
+ qemu-system-i386 -cdrom out/boot.iso $(QFLAGS) -serial stdio -s -S &
@sleep 1
gdb