From c59fed186238d07557817a752f951471201ba9e0 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Tue, 22 Feb 2022 12:47:51 -0700 Subject: Automated testing --- Common.mk | 10 +++++++++- tests/run.sh | 4 ++++ tests/test1.bash | 9 +++++++++ tests/test1.sh | 10 ---------- 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100755 tests/run.sh create mode 100755 tests/test1.bash delete mode 100755 tests/test1.sh diff --git a/Common.mk b/Common.mk index 8ef25af..9852b2d 100644 --- a/Common.mk +++ b/Common.mk @@ -34,7 +34,7 @@ endif CFLAGS += -DVERSION="\"0.1b\"" -.PHONY: clean run run-debug debug export tree disk +.PHONY: clean run run-silent run-debug debug export tree disk test default: clean build/kernel7.img @@ -70,6 +70,10 @@ run: build/kernel.elf @tput setaf 6 2> /dev/null || true; echo Starting QEMU; tput sgr0 2> /dev/null || true @${QEMU} -kernel $< ${QFLAGS} +run-silent: build/kernel.elf + @tput setaf 6 2> /dev/null || true; echo Starting QEMU; tput sgr0 2> /dev/null || true + @${QEMU} -kernel $< -nographic ${QFLAGS} + run-debug: build/kernel-g.elf @echo Starting QEMU in Debug Mode @${QEMU} -kernel $< -s -S ${QFLAGS} @@ -88,3 +92,7 @@ clean: tree: @tree -a -I obj\|build\|.git\|.gitignore + +test: clean build/kernel.elf + @tput setaf 6 2> /dev/null || true; echo Running Tests; tput sgr0 2> /dev/null || true + @./tests/run.sh diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 0000000..80217e8 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +for file in ./tests/*.bash; do + ${file} +done diff --git a/tests/test1.bash b/tests/test1.bash new file mode 100755 index 0000000..d04af60 --- /dev/null +++ b/tests/test1.bash @@ -0,0 +1,9 @@ +#!/bin/bash +rm -f l.test1.log +make run-silent & +cat guest.out >> l.test1.log & +sleep 0.5 +printf "ab" >> guest.in +sleep 1 +printf "\001x" >> guest.in +sleep 0.5 diff --git a/tests/test1.sh b/tests/test1.sh deleted file mode 100755 index 2641953..0000000 --- a/tests/test1.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -pushd ./ -rm -f test1.log -make run & -cat guest.out >> test1.log & -sleep 1 -printf "ab" >> guest.in -sleep 2 -printf "\001x" >> guest.in -popd -- cgit v1.2.1