From fc464c71c095cd1e55dd43bef2f065f71c1afd08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Tue, 3 Jul 2018 18:49:18 +0200 Subject: [PATCH] Refactored the test targets in the Makefile, use this in .travis.yml instead of duplicating the commands --- .travis.yml | 3 +-- example-os/Makefile | 21 +++++---------------- test/bochs.sh | 5 ++++- test/qemu-system-i386.sh | 5 ++++- test/virtualbox.sh | 6 +++++- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 130c065..f908f20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,8 +44,7 @@ install: - if test "$MODE" = virtualbox -o "$MODE" = self-test; then ./utils/install-virtualbox.sh; fi script: - - (cd example-os && make) - - ./utils/gui-wrapper.sh 800x600x24 ./test/${MODE}.sh + - (cd example-os && make test/${MODE}) - | ./utils/auto-push.sh "https://github.com/jsmaniac/travis-os.git" \ "git@github.com:jsmaniac/travis-os-deploy-artifacts.git" \ diff --git a/example-os/Makefile b/example-os/Makefile index 7713bad..fcc6cd7 100644 --- a/example-os/Makefile +++ b/example-os/Makefile @@ -1,4 +1,5 @@ os_filename = os.bat +tests = test/qemu-system-i386 test/qemu-system-arm test/virtualbox test/bochs .PHONY: all all: $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm .gitignore Makefile @@ -37,20 +38,8 @@ clean: Makefile echo /os.reasm.disasm >> $@ .PHONY: test -test: test-qemu-system-i386 test-qemu-system-arm test-virtualbox test-bochs Makefile +test: $(tests) Makefile -.PHONY: test-qemu-system-i386 -test-qemu-system-i386: $(os_filename) ../deploy-screenshots Makefile - (cd .. && ./utils/gui-wrapper.sh 800x600x24 ./test/qemu-system-i386.sh) - -.PHONY: test-qemu-system-arm -test-qemu-system-arm: $(os_filename) ../deploy-screenshots Makefile - (cd .. && ./utils/gui-wrapper.sh 800x600x24 ./test/qemu-system-arm.sh) - -.PHONY: test-virtualbox -test-virtualbox: $(os_filename) ../deploy-screenshots Makefile - (cd .. && ./utils/gui-wrapper.sh 800x600x24 ./test/virtualbox.sh) - -.PHONY: test-bochs -test-bochs: $(os_filename) ../deploy-screenshots Makefile - (cd .. && ./utils/gui-wrapper.sh 800x600x24 ./test/bochs.sh) +.PHONY: $(tests) +$(tests): $(os_filename) ../deploy-screenshots Makefile + (cd .. && ./utils/gui-wrapper.sh 800x600x24 ./$@.sh example-os/$<) diff --git a/test/bochs.sh b/test/bochs.sh index 2cea0fe..19a5df5 100755 --- a/test/bochs.sh +++ b/test/bochs.sh @@ -1,7 +1,10 @@ #!/bin/sh set -e -os_filename="example-os/os.bat" +if test $# -ne 1 || test "$1" = '-h' -o "$1" = '--help'; then + echo "Usage: $0 operating_system_file" +fi +os_filename="$1" bochsrc="$(mktemp)" cat > "$bochsrc" <