Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fb721b196 | ||
|
|
1146fccb60 | ||
|
|
c6cf738106 |
@@ -17,4 +17,7 @@ RUN curl -sSL --fail -o /tmp/b.zip https://broth.itch.zone/butler/linux-amd64/15
|
||||
&& unzip -q /tmp/b.zip -d /opt/butler && chmod +x /opt/butler/butler && ln -s /opt/butler/butler /usr/local/bin/butler && rm /tmp/b.zip
|
||||
# the small template from the prerelease template-<ver> (build_image.sh downloads it next to this file)
|
||||
COPY template.exe /opt/tinmerezhi/template.exe
|
||||
# a ready Wine prefix: wine_check.sh copies it instead of running wineboot on every release (same overrides as there)
|
||||
RUN WINEPREFIX=/opt/wineprefix WINEDEBUG=-all WINEDLLOVERRIDES="mscoree,mshtml=;winedbg.exe=d" xvfb-run -a wineboot -i; \
|
||||
WINEPREFIX=/opt/wineprefix wineserver -w; test -f /opt/wineprefix/system.reg
|
||||
RUN godot --version && go-winres --help >/dev/null && butler -V && python3 -c 'import fontTools' && wine --version
|
||||
|
||||
@@ -8,19 +8,26 @@ EXE=$(realpath "$1"); SHOTS=$(realpath -m "$2"); W=/tmp/wine_check
|
||||
rm -rf $W && mkdir -p $W "$SHOTS"
|
||||
# no Mono/Gecko installers, no crash debugger (it waits forever); a Wine virtual desktop instead of bare Xvfb windows
|
||||
export WINEPREFIX=$W/prefix WINEDEBUG=-all WINEDLLOVERRIDES="mscoree,mshtml=;winedbg.exe=d"
|
||||
run() { xvfb-run -a -s "-screen 0 1280x800x24" timeout "$1" wine explorer /desktop=ci,1280x720 "$2" -- "Z:$SHOTS"; }
|
||||
xvfb-run -a wineboot -i >/dev/null 2>&1 || true
|
||||
fail=0
|
||||
# every Wine run gets its own X display (-n: no xvfb-run -a race) and its own copy of the prefix (own wineserver and
|
||||
# user://, because the tests reuse save file names), so the game and all tests run at the same time
|
||||
run() { cp -a $W/prefix $W/p_$3; WINEPREFIX=$W/p_$3 xvfb-run -n $4 -s "-screen 0 1280x800x24" timeout "$1" wine explorer /desktop=ci,1280x720 "$2" -- "Z:$SHOTS"; }
|
||||
if [ -d /opt/wineprefix ]; then cp -a /opt/wineprefix $W/prefix # prepared in the CI image (ci/Dockerfile)
|
||||
else
|
||||
xvfb-run -a wineboot -i >/dev/null 2>&1 || true
|
||||
wineserver -w 2>/dev/null || true # the prefix must be fully written before it is copied
|
||||
fi
|
||||
|
||||
echo "=== the game: starts and runs 20 s without crashing or script errors"
|
||||
run 20 "$EXE" > $W/game.log 2>&1 || true
|
||||
grep -vE "^ALSA|X connection|^$" $W/game.log | tail -12
|
||||
if grep -qE "SCRIPT ERROR|Parse Error|Failed to load|Unhandled|X Error" $W/game.log; then echo "FAIL: errors or a crash in the game log"; fail=1; fi
|
||||
# the game: starts and runs 20 s without crashing or script errors
|
||||
(run 20 "$EXE" game 90 || true) > $W/game.log 2>&1 &
|
||||
|
||||
# release builds ignore --main-pack and -s, so every test gets its own pack whose main loop is the test script,
|
||||
# run by a copy of the same template: t_<name>.exe loads t_<name>.pck next to it
|
||||
for t in fx balance update shot; do
|
||||
rm -rf $W/proj && cp -r . $W/proj && cd $W/proj
|
||||
TESTS="fx balance update shot"
|
||||
n=90
|
||||
for t in $TESTS; do
|
||||
n=$((n + 1))
|
||||
(
|
||||
rm -rf $W/proj_$t && cp -r . $W/proj_$t && cd $W/proj_$t
|
||||
sed -i 's|^exclude_filter=.*|exclude_filter=""|' export_presets.cfg
|
||||
sed -i '1a class_name WineTest' tests/$t.gd
|
||||
# Wine loses the exit code (and may crash after quit), so the test prints it before quitting
|
||||
@@ -31,13 +38,23 @@ for t in fx balance update shot; do
|
||||
sed -i 's|^run/main_scene=.*|run/main_scene="res://tests/empty.tscn"|' project.godot
|
||||
sed -i 's|^\[application\]|[application]\n\nrun/main_loop_type="WineTest"|' project.godot
|
||||
sed -i 's|^config/version=.*|config/version="dev"|' project.godot # tests expect a dev build (no self-update)
|
||||
godot --headless --path . --import >/dev/null 2>&1
|
||||
godot --headless --path . --export-pack "Windows Desktop" $W/t_$t.pck >/dev/null 2>&1
|
||||
XDG_DATA_HOME=$W/u_$t godot --headless --path . --import >/dev/null 2>&1
|
||||
XDG_DATA_HOME=$W/u_$t godot --headless --path . --export-pack "Windows Desktop" $W/t_$t.pck >/dev/null 2>&1
|
||||
cd - >/dev/null
|
||||
cp "${TEMPLATE:-tools/template.exe}" $W/t_$t.exe
|
||||
echo "=== $t ($(stat -c %s $W/t_$t.pck) bytes pack)"
|
||||
run 300 $W/t_$t.exe > $W/$t.log 2>&1 || true
|
||||
grep -vE "^ALSA|X connection|^Godot Engine|^$|audio|WASAPI|SDR white|^ at:" $W/$t.log | tail -8
|
||||
echo "pack $(stat -c %s $W/t_$t.pck) bytes, start $(date +%T)"
|
||||
run 300 $W/t_$t.exe $t $n 2>&1 || true
|
||||
echo "end $(date +%T)"
|
||||
) > $W/$t.log 2>&1 &
|
||||
done
|
||||
wait
|
||||
|
||||
echo "=== the game: starts and runs 20 s without crashing or script errors"
|
||||
grep -vE "^ALSA|X connection|^$" $W/game.log | tail -12
|
||||
if grep -qE "SCRIPT ERROR|Parse Error|Failed to load|Unhandled|X Error" $W/game.log; then echo "FAIL: errors or a crash in the game log"; fail=1; fi
|
||||
for t in $TESTS; do
|
||||
echo "=== $t ($(grep -m1 '^pack ' $W/$t.log), $(grep -m1 '^end ' $W/$t.log))"
|
||||
grep -vE "^ALSA|X connection|^Godot Engine|^$|audio|WASAPI|SDR white|^ at:|^pack |^end " $W/$t.log | tail -8
|
||||
grep -q "^WINE_EXIT 0" $W/$t.log || { echo "FAIL: $t"; fail=1; }
|
||||
done
|
||||
ls "$SHOTS"
|
||||
|
||||
@@ -160,7 +160,7 @@ static func run(g, ti: int, src: String) -> Dictionary:
|
||||
var b = g.agent_best.get(key, [999, 999999])
|
||||
if res["lines"] < b[0] or (res["lines"] == b[0] and res["steps"] < b[1]):
|
||||
g.agent_best[key] = [res["lines"], res["steps"]]
|
||||
g.online.score_agent(ti, res["lines"], res["steps"])
|
||||
g.online.score_agent(ti, g.agent_best[key][0], g.agent_best[key][1]) # кожен успіх шле найкращий результат: рекорди, поставлені до ввімкнення онлайну, теж потраплять у таблицю
|
||||
res["msg"] = L.t("✔ Задачу \"%s\" виконано: %d рядк., %d кроків. Рекорд: %d / %d.") % [t["name"], res["lines"], res["steps"], g.agent_best[key][0], g.agent_best[key][1]]
|
||||
if first:
|
||||
g.stats["agents"] += 1
|
||||
|
||||
@@ -15,6 +15,12 @@ func frames(n: int) -> void:
|
||||
for i in n:
|
||||
await process_frame
|
||||
|
||||
# друк тексту йде за кадрами (3 символи на кадр), а тости й сплеші — за часом (до ~4 с): під програмним GL
|
||||
# у Wine це ~11 кадрів/с, тож замість сотень кадрів дописуємо текст одразу і чекаємо секунди
|
||||
func settle() -> void:
|
||||
g._finish_typing()
|
||||
await create_timer(4.0).timeout
|
||||
|
||||
func shot(name: String) -> void:
|
||||
await frames(3)
|
||||
root.get_viewport().get_texture().get_image().save_png(dir.path_join(name))
|
||||
@@ -31,7 +37,7 @@ func _run() -> void:
|
||||
g.settings_path = "user://test_settings.json"
|
||||
g.sound = false
|
||||
root.add_child(g)
|
||||
await frames(240) # завантаження й друк першого листа
|
||||
await settle() # завантаження й перший лист
|
||||
g.map_hover = 1
|
||||
await shot("1_start.png")
|
||||
g.map_hover = -1
|
||||
@@ -70,7 +76,7 @@ func _run() -> void:
|
||||
g.run("skills")
|
||||
g.run("shop")
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("3b_progress.png")
|
||||
g.run("clear")
|
||||
g.busts = 0
|
||||
@@ -83,7 +89,7 @@ func _run() -> void:
|
||||
g.run("ports")
|
||||
g.run("logs")
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("3c_ports.png")
|
||||
g.run("disconnect")
|
||||
g.run("agent 2")
|
||||
@@ -103,7 +109,7 @@ func _run() -> void:
|
||||
g.run("missions")
|
||||
g.run("connect 37")
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("4_act4.png")
|
||||
g.run("disconnect")
|
||||
g.mission = 35
|
||||
@@ -112,7 +118,7 @@ func _run() -> void:
|
||||
g.cur["open"] = true
|
||||
g.run("download echo_core.bin")
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("5_choice.png")
|
||||
g.run("choose 2") # кінцівка Акту IV — далі Акт V
|
||||
g.mission = g.A5_START + 2
|
||||
@@ -120,7 +126,7 @@ func _run() -> void:
|
||||
g.run("connect 40")
|
||||
g.cur["open"] = true
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("6_act5.png")
|
||||
g.run("disconnect")
|
||||
g.mission = g.A6_START - 1
|
||||
@@ -133,7 +139,7 @@ func _run() -> void:
|
||||
g.run("connect 43")
|
||||
g.cur["open"] = true
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("6b_act6.png")
|
||||
g.run("disconnect")
|
||||
g.mission = g.missions.size() - 1
|
||||
@@ -142,7 +148,7 @@ func _run() -> void:
|
||||
g.run("download puilo_heart.bin")
|
||||
g.run("choose 1")
|
||||
g.render()
|
||||
await frames(200)
|
||||
await settle()
|
||||
await shot("7_dossier.png")
|
||||
# графіка: теми, заставка акту, сцени фіналів, обличчя Пуйла
|
||||
if g.has_node("Splash"):
|
||||
|
||||
Reference in New Issue
Block a user