36 lines
1.5 KiB
Bash
Executable File
36 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Exercise the real packer without installing Emscripten or compiling Luanti.
|
|
repo="$(cd "$(dirname "$0")/.." && pwd)"
|
|
scratch="$(mktemp -d)"
|
|
trap 'rm -rf "$scratch"' EXIT
|
|
cp "$repo/build_fsroot.sh" "$scratch/"
|
|
printf 'BASE_DIR=%q\nBUILD_DIR=%q\n' "$repo" "$scratch/build" > "$scratch/common.sh"
|
|
mkdir -p "$scratch/build/luanti-install/builtin/mainmenu"
|
|
cd "$scratch"
|
|
|
|
env -u LUANTI_SERVER_ADDRESS -u LUANTI_SERVER_PORT bash ./build_fsroot.sh > /dev/null 2>&1
|
|
cmp "$repo/menu/init.lua" build/fsroot/luanti/builtin/mainmenu/init.lua
|
|
grep -qx 'address = luanti.eom.dev' build/fsroot/luanti/builtin/mainmenu/server.conf
|
|
grep -qx 'port = 30000' build/fsroot/luanti/builtin/mainmenu/server.conf
|
|
tar tf build/fsroot.tar | grep -q './luanti/builtin/mainmenu/server.conf'
|
|
|
|
LUANTI_SERVER_ADDRESS=custom.example LUANTI_SERVER_PORT=03001 bash ./build_fsroot.sh > /dev/null 2>&1
|
|
grep -qx 'address = custom.example' build/fsroot/luanti/builtin/mainmenu/server.conf
|
|
grep -qx 'port = 03001' build/fsroot/luanti/builtin/mainmenu/server.conf
|
|
|
|
for port in 0 65536 -1 xyz '30000;print(1)' 12345678901234567890; do
|
|
if LUANTI_SERVER_PORT="$port" bash ./build_fsroot.sh > /dev/null 2>&1; then
|
|
echo "Accepted invalid port: $port" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
for host in 'evil;host' $'host\nport = 1' 'https://host' 'host with spaces'; do
|
|
if LUANTI_SERVER_ADDRESS="$host" bash ./build_fsroot.sh > /dev/null 2>&1; then
|
|
echo "Accepted invalid host" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
echo 'Filesystem packaging tests passed'
|