diff --git a/tools/docker_build_tests.sh b/tools/docker_build_tests.sh new file mode 100755 index 0000000..3ab977a --- /dev/null +++ b/tools/docker_build_tests.sh @@ -0,0 +1,48 @@ +#!/bin/sh +set -eu + +PROJDIRNAME=$(basename $(realpath "$(dirname "$0")"/..)) +cd $(realpath "$(dirname "$0")"/../..) + +FAILED=0 + +do_test(){ + case "$1" in + "debian:stable"|"debian:latest") + SYSTEM_UPDATE="apt-get update ;apt-get -y install make bin86 xxd verilator g++ libz-dev" + ;; + "ubuntu:latest") + SYSTEM_UPDATE="apt-get update ;apt-get -y install make bin86 xxd verilator g++ libz-dev libfindbin-libs-perl" + ;; + "fedora:latest") + SYSTEM_UPDATE="dnf install -y make verilator dev86 g++ zlib-devel xxd" + ;; + "archlinux:latest") + SYSTEM_UPDATE="pacman --noconfirm -Sy make verilator xxd bin86 gcc python" + ;; + esac + if tar c "$PROJDIRNAME" | docker run -i "$1" bash -c 'set -eu;tar x ;'"$SYSTEM_UPDATE"'; cd 9086; make clean; if [ "$(make -j boot_code/gnome_sort.run| tail -n5|head -n 1)" = "06 09 17 18 1F 21 33 37 3A 3F 44 4F 51 51 54 5D 8B 99 A5 AE DB DF E9 EE " ];then echo pass;else echo failed check; exit 1;fi ' > /dev/null 2>/dev/null + then + return 0 + else + return 1 + fi +} + +# ubuntu:latest has a version of verilator that is too old. +for i in debian:stable debian:latest fedora:latest archlinux:latest +do + printf 'Testing with docker image %s \t: ' "$i" |expand -t 44 + if ! do_test "$i" + then + FAILED=1 + printf '\e[1;31mFailed\e[0m\n' + else + printf '\e[1;32mPassed\e[0m\n' + fi +done + +if [ "$FAILED" = 1 ] +then + exit 1 +fi