From 6c09097e5441eafc971c8d5d414963a4e66a892f Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Thu, 31 Oct 2019 21:06:46 +0100 Subject: Add testing to build --- kernel/build.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'kernel/build.sh') diff --git a/kernel/build.sh b/kernel/build.sh index d8086b6..86842b1 100755 --- a/kernel/build.sh +++ b/kernel/build.sh @@ -9,10 +9,13 @@ GRUB_CFG_PATH="src/grub.cfg" ARCH="x86_64" TARGET="$ARCH-uff" RUST_BIN="$TARGET_PATH/$TARGET/debug/libkernel.a" +QUEMU="qemu-system-x86_64 -cdrom $TARGET_PATH/uff.iso" -remove_target() { - rm -rf $TMP_PATH/* &> /dev/null +cleanup_target() { rm -f $TARGET_PATH/uff.iso &> /dev/null + rm -rf $TARGET_PATH/kernel.bin + + cleanup_temp } create_target() { @@ -54,7 +57,11 @@ build_init() { } build_launch() { - qemu-system-x86_64 -cdrom $TARGET_PATH/uff.iso + $QUEMU +} + +build_launch_serial() { + $QEMU -device isa-debug-exit,iobase=0xf4,iosize=0x04 -serial stdio #-display none } build_run() { @@ -65,16 +72,20 @@ build_run() { } build_clean() { - remove_target + cleanup_target } build_build() { cargo xbuild - rm -rf $TARGET_PATH/sysroot - rm -rf $TARGET_PATH/kernel.bin - rm -rf $TARGET_PATH/uff.iso + cleanup_target build_run } +build_build() { + cargo xbuild --features testing + cleanup_target + build_kernel_iso + build_launch_serial +} build_all() { build_kernel_elf @@ -91,6 +102,7 @@ for arg in "$@"; do "run") build_run;; "clean") build_clean;; "build") build_build;; + "test") build_tests;; "all") build_all;; *) echo "warn: ignoring unknown option '$arg'" @@ -107,6 +119,7 @@ print_help() { echo " clean cleanup binaries" echo " launch launch iso in qemu" echo " run creates iso if necessary and runs it in qemu" + echo " test runs tests in qemu" echo echo " kernel-elf build the kernel-elf" echo " kernel-iso build the kernel-elf if necessary and the kernel-iso" -- cgit v1.2.3-54-g00ecf