minecraft-pi-docker/scripts/test.sh

43 lines
894 B
Bash
Raw Normal View History

2021-06-17 21:32:24 +00:00
#!/bin/sh
set -e
2023-12-26 22:29:45 +00:00
# Variables
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH="$(dpkg-architecture -qDEB_BUILD_ARCH)"
2022-03-09 23:47:31 +00:00
2023-12-26 22:29:45 +00:00
# Build
./scripts/setup.sh "${MODE}" "${ARCH}" -DMCPI_HEADLESS_MODE=ON
./scripts/build.sh "${MODE}" "${ARCH}"
# Add To PATH
export PATH="$(pwd)/out/${MODE}-${ARCH}/usr/bin:${PATH}"
2021-06-17 21:32:24 +00:00
2023-12-26 22:29:45 +00:00
# Make Test Directory
2021-06-17 21:32:24 +00:00
rm -rf build/test
mkdir -p build/test
2023-12-26 22:29:45 +00:00
# Run
if [ "${MODE}" = "server" ]; then
# Server Test
cd build/test
minecraft-pi-reborn-server --only-generate
cd ../../
else
# Client Test
export _MCPI_SKIP_ROOT_CHECK=1
export HOME="$(pwd)/build/test"
minecraft-pi-reborn-client --default --no-cache --benchmark
# Build Example Mods
for project in example-mods/*/; do
cd "${project}"
rm -rf build
mkdir build
cd build
cmake -GNinja ..
cmake --build .
cd ../../../
done
fi