Refactored the test targets in the Makefile, use this in .travis.yml instead of duplicating the commands

This commit is contained in:
Georges Dupéron 2018-07-03 18:49:18 +02:00
parent e83e2cf69b
commit fc464c71c0
5 changed files with 19 additions and 21 deletions

View File

@ -44,8 +44,7 @@ install:
- if test "$MODE" = virtualbox -o "$MODE" = self-test; then ./utils/install-virtualbox.sh; fi - if test "$MODE" = virtualbox -o "$MODE" = self-test; then ./utils/install-virtualbox.sh; fi
script: script:
- (cd example-os && make) - (cd example-os && make test/${MODE})
- ./utils/gui-wrapper.sh 800x600x24 ./test/${MODE}.sh
- | - |
./utils/auto-push.sh "https://github.com/jsmaniac/travis-os.git" \ ./utils/auto-push.sh "https://github.com/jsmaniac/travis-os.git" \
"git@github.com:jsmaniac/travis-os-deploy-artifacts.git" \ "git@github.com:jsmaniac/travis-os-deploy-artifacts.git" \

View File

@ -1,4 +1,5 @@
os_filename = os.bat os_filename = os.bat
tests = test/qemu-system-i386 test/qemu-system-arm test/virtualbox test/bochs
.PHONY: all .PHONY: all
all: $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm .gitignore Makefile all: $(os_filename) os.ndisasm.disasm os.reasm.asm os.reasm .gitignore Makefile
@ -37,20 +38,8 @@ clean: Makefile
echo /os.reasm.disasm >> $@ echo /os.reasm.disasm >> $@
.PHONY: test .PHONY: test
test: test-qemu-system-i386 test-qemu-system-arm test-virtualbox test-bochs Makefile test: $(tests) Makefile
.PHONY: test-qemu-system-i386 .PHONY: $(tests)
test-qemu-system-i386: $(os_filename) ../deploy-screenshots Makefile $(tests): $(os_filename) ../deploy-screenshots Makefile
(cd .. && ./utils/gui-wrapper.sh 800x600x24 ./test/qemu-system-i386.sh) (cd .. && ./utils/gui-wrapper.sh 800x600x24 ./$@.sh example-os/$<)
.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)

View File

@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
set -e 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)" bochsrc="$(mktemp)"
cat > "$bochsrc" <<EOF cat > "$bochsrc" <<EOF

View File

@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
set -e 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 & qemu-system-i386 -drive format=raw,file=${os_filename},index=0,if=floppy &
pid=$! pid=$!

View File

@ -1,7 +1,11 @@
#!/bin/sh #!/bin/sh
set -e 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")" img_file="$(mktemp --suffix=".img")"
vbox_dir="$(mktemp -d --suffix="_vbox")" vbox_dir="$(mktemp -d --suffix="_vbox")"
vmname="automatic-os-test-$(date +%s)-$$" vmname="automatic-os-test-$(date +%s)-$$"