aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/big-sur_master.pngbin0 -> 200793 bytes
-rw-r--r--tests/boot-images.sh67
-rw-r--r--tests/catalina_master.pngbin0 -> 323513 bytes
-rw-r--r--tests/high-sierra_master.pngbin0 -> 335861 bytes
-rw-r--r--tests/mojave_master.pngbin0 -> 323843 bytes
-rw-r--r--tests/monterey_master.pngbin0 -> 198807 bytes
-rw-r--r--tests/test.sh143
7 files changed, 132 insertions, 78 deletions
diff --git a/tests/big-sur_master.png b/tests/big-sur_master.png
new file mode 100644
index 0000000..b3e0636
--- /dev/null
+++ b/tests/big-sur_master.png
Binary files differ
diff --git a/tests/boot-images.sh b/tests/boot-images.sh
new file mode 100644
index 0000000..6b914b9
--- /dev/null
+++ b/tests/boot-images.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# Author: Sick.Codes https://twitter.com/sickcodes
+# Contact: https://github.com/sickcodes, https://sick.codes
+# Copyright: sickcodes (C) 2021
+# License: GPLv3+
+# Title: Docker-OSX (Mac on Docker)
+# Repository: https://github.com/sickcodes/Docker-OSX
+# Website: https://sick.codes
+#
+# Status: Used internally to run each image and take screenshots until they match the pngs in this folder.
+#
+
+# note to self: # to get master images, boot each image, then screen shot using DISPLAY=:99 in the test.sh script
+# scrot -o high-sierra_master.png
+# scrot -o mojave_master.png
+# scrot -o catalina_master.png
+# scrot -o big-sur_master.png
+# scrot -o monterey_master.png
+# pull off remote server to the tests folder
+# REMOTE_SERVER=
+# scp root@"${REMOTE_SERVER}":~/*_master.png .
+
+export DISPLAY=:99
+
+TESTS=(
+ high-sierra
+ mojave
+ catalina
+ big-sur
+ monterey
+)
+
+# test each docker image to see if they boot to their unique respective installation screens.
+
+for TEST in "${TESTS[@]}"; do
+ # run the image detached
+ docker run --rm -d \
+ --device /dev/kvm \
+ -v /tmp/.X11-unix:/tmp/.X11-unix \
+ -e "DISPLAY=:99" \
+ "sickcodes/docker-osx:${TEST}"
+
+ # imcat the expected test screenshot to ./"${TEST}_master.txt"
+ imcat ~/Docker-OSX/tests/${TEST}_master.png > ./"${TEST}_master.txt"
+
+ # run until the screen matches the expected screen
+ while :; do
+ sleep 5
+ # screenshot the Xvfb
+ scrotcat > ./"${TEST}.txt"
+ # diff the low res txt files created from imcat
+ diff "./${TEST}.txt" ./"${TEST}_master.txt" && break
+ scrotcat
+ done
+
+ # kill any containers
+ docker kill "$(docker ps --format "{{.ID}}")"
+
+ # ensure all containers are dead
+ until [[ "$(docker ps | wc -l)" = 1 ]]; do
+ sleep 1
+ docker ps | xargs docker kill
+ done
+
+done
+
+exit 0
diff --git a/tests/catalina_master.png b/tests/catalina_master.png
new file mode 100644
index 0000000..9749507
--- /dev/null
+++ b/tests/catalina_master.png
Binary files differ
diff --git a/tests/high-sierra_master.png b/tests/high-sierra_master.png
new file mode 100644
index 0000000..9a5a8c7
--- /dev/null
+++ b/tests/high-sierra_master.png
Binary files differ
diff --git a/tests/mojave_master.png b/tests/mojave_master.png
new file mode 100644
index 0000000..4a9c8b6
--- /dev/null
+++ b/tests/mojave_master.png
Binary files differ
diff --git a/tests/monterey_master.png b/tests/monterey_master.png
new file mode 100644
index 0000000..15c33b6
--- /dev/null
+++ b/tests/monterey_master.png
Binary files differ
diff --git a/tests/test.sh b/tests/test.sh
index e66f04f..84ec774 100644
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/docker
+#!/usr/bin/bash
# ____ __ ____ ______ __
# / __ \____ _____/ /_____ _____/ __ \/ ___/ |/ /
# / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \| /
@@ -12,7 +12,7 @@
# Repository: https://github.com/sickcodes/Docker-OSX
# Website: https://sick.codes
#
-# Status: Work in progress.
+# Status: Used internally to auto build, run and test images on DO.
#
help_text="Usage: ./test.sh --branch <string> --repo <string>
@@ -120,13 +120,17 @@ NO_CACHE="${NO_CACHE:=--no-cache}"
TEST_BUILDS=(
-'docker-osx:latest'
-'docker-osx:naked'
-'docker-osx:naked-auto'
-'docker-osx:big-sur'
-'docker-osx:monterey'
-'docker-osx:auto'
-#'docker-osx:auto-big-sur'
+ 'docker-osx:naked'
+ 'docker-osx:naked-auto'
+ 'docker-osx:auto'
+)
+
+VERSION_BUILDS=(
+ 'high-sierra'
+ 'mojave'
+ 'catalina'
+ 'big-sur'
+ 'monterey'
)
install_docker () {
@@ -174,7 +178,7 @@ install_scrotcat () {
make -C ./imcat
sudo cp ./imcat/imcat /usr/bin/imcat
touch /usr/bin/scrotcat
- tee -a /usr/bin/scrotcat <<< '/usr/bin/imcat <(scrot -o /dev/stdout)'
+ tee /usr/bin/scrotcat <<< '/usr/bin/imcat <(scrot -o /dev/stdout)'
chmod +x /usr/bin/scrotcat
}
@@ -196,23 +200,10 @@ enable_kvm () {
echo 1 | tee /sys/module/kvm/parameters/ignore_msrs
}
-
clone_repo () {
git clone --branch="${1}" "${2}" Docker-OSX
}
-
-docker-osx:latest () {
- docker build ${NO_CACHE} \
- --build-arg BRANCH="${BRANCH}" \
- --build-arg RANKMIRRORS=true \
- --build-arg MIRROR_COUNTRY="${MIRROR_COUNTRY}" \
- -f ./Dockerfile \
- -t docker-osx:latest .
- docker tag docker-osx:latest sickcodes/docker-osx:latest
-}
-
-
docker-osx:naked () {
docker build ${NO_CACHE} \
--squash \
@@ -223,7 +214,6 @@ docker-osx:naked () {
docker tag docker-osx:naked sickcodes/docker-osx:naked
}
-
docker-osx:naked-auto () {
docker build ${NO_CACHE} \
--squash \
@@ -234,26 +224,6 @@ docker-osx:naked-auto () {
docker tag docker-osx:naked-auto sickcodes/docker-osx:naked-auto
}
-
-docker-osx:big-sur () {
- docker build ${NO_CACHE} \
- --build-arg VERSION=11 \
- --build-arg RANKMIRRORS=true \
- --build-arg MIRROR_COUNTRY="${MIRROR_COUNTRY}" \
- -f ./Dockerfile \
- -t docker-osx:big-sur .
- docker tag docker-osx:big-sur sickcodes/docker-osx:big-sur
-}
-
-docker-osx:monterey () {
- docker build ${NO_CACHE} \
- --build-arg RANKMIRRORS=true \
- --build-arg MIRROR_COUNTRY="${MIRROR_COUNTRY}" \
- -f ./Dockerfile.monterey \
- -t docker-osx:monterey .
- docker tag docker-osx:monterey sickcodes/docker-osx:monterey
-}
-
docker-osx:auto () {
docker build ${NO_CACHE} \
--build-arg RANKMIRRORS=true \
@@ -263,14 +233,26 @@ docker-osx:auto () {
docker tag docker-osx:auto sickcodes/docker-osx:auto
}
-docker-osx:auto-big-sur () {
+# docker-osx:auto-big-sur () {
+# docker build ${NO_CACHE} \
+# --build-arg RANKMIRRORS=true \
+# --build-arg MIRROR_COUNTRY="${MIRROR_COUNTRY}" \
+# --build-arg IMAGE_URL='https://images.sick.codes/mac_hdd_ng_auto_big_sur.img' \
+# -f ./Dockerfile.auto \
+# -t docker-osx:auto-big-sur .
+# docker tag docker-osx:auto-big-sur sickcodes/docker-osx:auto-big-sur
+# }
+
+docker-osx:version () {
+ SHORTNAME="${1}"
docker build ${NO_CACHE} \
+ --build-arg BRANCH="${BRANCH}" \
--build-arg RANKMIRRORS=true \
+ --build-arg SHORTNAME="${SHORTNAME}" \
--build-arg MIRROR_COUNTRY="${MIRROR_COUNTRY}" \
- --build-arg IMAGE_URL='https://images.sick.codes/mac_hdd_ng_auto_big_sur.img' \
- -f ./Dockerfile.auto \
- -t docker-osx:auto-big-sur .
- docker tag docker-osx:auto-big-sur sickcodes/docker-osx:auto-big-sur
+ -f ./Dockerfile \
+ -t "docker-osx:${SHORTNAME}" .
+ docker tag "docker-osx:${SHORTNAME}" "sickcodes/docker-osx:${SHORTNAME}"
}
reset_docker_hard () {
@@ -288,42 +270,47 @@ EOF
systemctl enable --now docker
}
-tee -a ~/.bashrc <<EOF ; true &&
+tee -a ~/.bashrc <<EOF
export DEBIAN_FRONTEND=noninteractive
export TZ=UTC
EOF
-export DEBIAN_FRONTEND=noninteractive \
-; export TZ=UTC \
-; ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime \
-; tee -a /etc/timezone <<< "${TZ}" \
-; apt update -y \
-; apt-get install keyboard-configuration -y \
-; docker -v | grep '\ 20\.\|\ 19\.' || install_docker \
-; yes | apt install -y --no-install-recommends tzdata -y \
-; install_scrotcat \
-; yes | install_vnc \
-; export_display_99 \
-; echo start_xvfb \
-; start_vnc \
-; enable_kvm \
-; reset_docker_hard \
-; echo killall Xvfb \
-; clone_repo "${BRANCH}" "${REPO}" \
-; cd Docker-OSX \
-; for TEST_BUILD in "${TEST_BUILDS[@]}"; do
+export DEBIAN_FRONTEND=noninteractive
+export TZ=UTC
+ln -snf "/usr/share/zoneinfo/${TZ}" /etc/localtime
+tee -a /etc/timezone <<< "${TZ}"
+apt update -y
+apt-get install keyboard-configuration -y
+docker -v | grep '\ 20\.\|\ 19\.' || install_docker
+yes | apt install -y --no-install-recommends tzdata -y
+install_scrotcat
+yes | install_vnc
+export_display_99
+start_xvfb
+# start_vnc
+enable_kvm
+reset_docker_hard
+echo killall Xvfb
+clone_repo "${BRANCH}" "${REPO}"
+cd ./Docker-OSX
+
+for SHORTNAME in "${VERSION_BUILDS[@]}"; do
+ docker-osx:version "${SHORTNAME}"
+done
+
+docker tag docker-osx:catalina sickcodes/docker-osx:latest
+
+for TEST_BUILD in "${TEST_BUILDS[@]}"; do
"${TEST_BUILD}"
-done \
-&& touch COMPLETED
+done
+
+# boot each image and test
+bash ./tests/boot-images.sh || exit 1
if [[ "${DOCKER_USERNAME}" ]] && [[ "${DOCKER_PASSWORD}" ]]; then
docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}" \
- && docker push sickcodes/docker-osx:latest \
- && docker push sickcodes/docker-osx:big-sur \
- && docker push sickcodes/docker-osx:monterey \
- && docker push sickcodes/docker-osx:naked \
- && docker push sickcodes/docker-osx:naked-auto \
- && docker push sickcodes/docker-osx:auto \
- && docker push sickcodes/docker-osx:auto-big-sur \
+ && for SHORTNAME in "${VERSION_BUILDS[@]}"; do
+ docker push "sickcodes/docker-osx:${SHORTNAME}"
+ done \
&& touch PUSHED
fi