2021-06-17 21:32:24 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-02-12 05:44:38 +00:00
|
|
|
# Change Directory
|
|
|
|
cd "$(dirname "$0")/../"
|
|
|
|
|
2023-12-26 22:29:45 +00:00
|
|
|
# Variables
|
|
|
|
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
2024-06-15 12:52:15 +00:00
|
|
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
|
|
|
APPIMAGE="$(pwd)/out/minecraft-pi-reborn-$(cat VERSION)-${ARCH}.AppImage"
|
2022-03-09 23:47:31 +00:00
|
|
|
|
2024-06-15 12:52:15 +00:00
|
|
|
# Check If File Exists
|
|
|
|
if [ ! -f "${APPIMAGE}" ]; then
|
|
|
|
echo 'Missing AppImage!' > /dev/stderr
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-06-17 21:32:24 +00:00
|
|
|
|
2023-12-26 22:29:45 +00:00
|
|
|
# Make Test Directory
|
2024-02-04 05:43:25 +00:00
|
|
|
TEST_WORKING_DIR="$(pwd)/.testing-tmp"
|
|
|
|
rm -rf "${TEST_WORKING_DIR}"
|
|
|
|
mkdir -p "${TEST_WORKING_DIR}"
|
2024-06-15 12:52:15 +00:00
|
|
|
ROOT="$(pwd)"
|
|
|
|
cd "${TEST_WORKING_DIR}"
|
|
|
|
|
|
|
|
# Prepare AppImage For Docker
|
|
|
|
cp "${APPIMAGE}" tmp.AppImage
|
|
|
|
"${ROOT}/scripts/fix-appimage-for-docker.sh" tmp.AppImage
|
|
|
|
chmod +x tmp.AppImage
|
2021-06-17 21:32:24 +00:00
|
|
|
|
2023-12-26 22:29:45 +00:00
|
|
|
# Run
|
|
|
|
if [ "${MODE}" = "server" ]; then
|
|
|
|
# Server Test
|
2024-06-15 12:52:15 +00:00
|
|
|
./tmp.AppImage --appimage-extract-and-run --server --only-generate
|
2023-12-26 22:29:45 +00:00
|
|
|
else
|
|
|
|
# Client Test
|
2024-02-04 05:43:25 +00:00
|
|
|
export HOME="${TEST_WORKING_DIR}"
|
2024-06-15 12:52:15 +00:00
|
|
|
./tmp.AppImage --appimage-extract-and-run --default --no-cache --benchmark --force-headless
|
2023-12-26 22:29:45 +00:00
|
|
|
fi
|
2024-02-04 05:43:25 +00:00
|
|
|
|
|
|
|
# Clean Up
|
|
|
|
rm -rf "${TEST_WORKING_DIR}"
|