Add some way to test kernel

This commit is contained in:
Mathieu Maret 2018-11-08 22:09:12 +01:00
parent cb65400d60
commit 7633e54663
3 changed files with 19 additions and 1 deletions

View File

@ -6,7 +6,7 @@ LDFLAGS += -g -m32 -nostdlib -static -fno-common -fno-use-cxa-atexit -fno-except
CFLAGS += -g -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-pie -fno-stack-protector CFLAGS += -g -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-pie -fno-stack-protector
CXXFLAGS += -g -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti -fno-pie CXXFLAGS += -g -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti -fno-pie
SUBDIRS := core drivers SUBDIRS := core drivers tests
CPPFLAGS += $(foreach dir, $(SUBDIRS), -I$(dir)) CPPFLAGS += $(foreach dir, $(SUBDIRS), -I$(dir))
@ -37,6 +37,10 @@ core/irq_handler.o:core/irq_handler.c
%.o:%.asm %.o:%.asm
$(AS) $(ASFLAGS) -o $@ $< $(AS) $(ASFLAGS) -o $@ $<
self_test: CFLAGS += -DRUN_TEST
self_test: clean kernel
qemu-system-x86_64 -kernel kernel -serial stdio
test:kernel test:kernel
qemu-system-x86_64 -kernel $< qemu-system-x86_64 -kernel $<

11
tests/test.c Normal file
View File

@ -0,0 +1,11 @@
#include "serial.h"
#include "vga.h"
void run_test(){
printf("Testing Serial");
serialWrite('h');
serialWrite('e');
serialWrite('l');
serialWrite('l');
serialWrite('o');
}

3
tests/test.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
void run_test();