minecraft-pi-reborn/scripts/test.sh
2024-02-04 00:36:58 -05:00

31 lines
602 B
Bash
Executable File

#!/bin/sh
set -e
# Variables
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
ARCH='host'
# Build
./scripts/build.mjs none "${MODE}" "${ARCH}" -DMCPI_HEADLESS_MODE=ON
# Add To PATH
export PATH="$(pwd)/out/${MODE}/${ARCH}/usr/bin:${PATH}"
# Make Test Directory
rm -rf build/test
mkdir -p build/test
# 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
fi