From 8593d3803040d7a605b0532042d22e1377da7d77 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 5 Nov 2025 13:41:40 +0100 Subject: [PATCH] Add non-headless singleplayer tests to CI --- .github/workflows/linux.yml | 6 +++++- .github/workflows/lua.yml | 6 +++++- util/test_singleplayer.sh | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100755 util/test_singleplayer.sh diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b84c0442f2..eac53a99e3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -119,7 +119,7 @@ jobs: - name: Install deps run: | source ./util/ci/common.sh - install_linux_deps clang-18 lldb + install_linux_deps clang-18 lldb xvfb - name: Build run: | @@ -136,6 +136,10 @@ jobs: run: | ./util/test_multiplayer.sh + - name: Singleplayer test + run: | + xvfb-run ./util/test_singleplayer.sh + # Build with prometheus-cpp (server-only), also runs on ARM64 clang_prometheus_arm: name: "clang (with Prometheus, ARM64)" diff --git a/.github/workflows/lua.yml b/.github/workflows/lua.yml index 1f83c76882..8a1d840bc8 100644 --- a/.github/workflows/lua.yml +++ b/.github/workflows/lua.yml @@ -23,7 +23,7 @@ jobs: - name: Install deps run: | source ./util/ci/common.sh - install_linux_deps clang gdb libluajit-5.1-dev + install_linux_deps clang gdb libluajit-5.1-dev xvfb - name: Build run: | @@ -37,6 +37,10 @@ jobs: run: | serverconf="profiler.load=true" ./util/test_multiplayer.sh + - name: Singleplayer test (GL3) + run: | + clientconf="video_driver=opengl3" xvfb-run ./util/test_singleplayer.sh + luacheck: name: "Builtin Luacheck and Unit Tests" runs-on: ubuntu-latest diff --git a/util/test_singleplayer.sh b/util/test_singleplayer.sh new file mode 100755 index 0000000000..63bbd51950 --- /dev/null +++ b/util/test_singleplayer.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Runs a singleplayer session with software-rendering. + +dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +gameid=${gameid:-devtest} +executable=$dir/../bin/luanti +testspath=$dir/../tests +conf_client=$testspath/client.conf +worldpath=$testspath/world + +[ -e "$executable" ] || { echo "executable $executable missing"; exit 1; } + +rm -rf "$worldpath" +mkdir -p "$worldpath/worldmods" + +# enable a lot of visual effects so we can catch shader errors and other obvious bugs +printf '%s\n' >"$conf_client" \ + screen_w=384 screen_h=256 fps_max=5 \ + active_block_range=1 viewing_range=40 helper_mode=devtest \ + opengl_debug=true mip_map=true enable_waving_{leaves,plants,water}=true \ + enable_{auto_exposure,bloom,dynamic_shadows,translucent_foliage,volumetric_lighting}=true \ + shadow_map_color=true antialiasing=ssaa \ + "${clientconf:-}" + +ln -s "$dir/helper_mod" "$worldpath/worldmods/" + +export ALSOFT_DRIVERS=null +export LIBGL_ALWAYS_SOFTWARE=true +export MESA_DEBUG=1 +timeout 25 "$executable" --config "$conf_client" --go --world "$worldpath" --gameid "$gameid" --info +r=$? +echo "Exit status: $r" +[ $r -eq 124 ] && echo "(timed out)" +[ $r -ne 0 ] && exit 1 + +echo "Success" +exit 0