commit fc464c71c095cd1e55dd43bef2f065f71c1afd08
parent e83e2cf69b7393376b77861086a3d2368652fa0b
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Tue, 3 Jul 2018 18:49:18 +0200
Refactored the test targets in the Makefile, use this in .travis.yml instead of duplicating the commands
Diffstat:
5 files changed, 19 insertions(+), 21 deletions(-)
diff --git 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
@@ -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
@@ -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" <<EOF
diff --git a/test/qemu-system-i386.sh b/test/qemu-system-i386.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"
qemu-system-i386 -drive format=raw,file=${os_filename},index=0,if=floppy &
pid=$!
diff --git a/test/virtualbox.sh b/test/virtualbox.sh
@@ -1,7 +1,11 @@
#!/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"
+
img_file="$(mktemp --suffix=".img")"
vbox_dir="$(mktemp -d --suffix="_vbox")"
vmname="automatic-os-test-$(date +%s)-$$"