Files
DroidDeck/tools/tests/test_steam_compat_x64.py
The412Banner db8d1c9910 feat: optional x86-64 Steam client (Valve's Linux client under FEX) beside the arm64 one (#152)
An opt-in second Steam client (Steam settings, Steam client: x86-64): Valve's
x86-64 Linux client, unchanged, runs under FEX in its own home with its own
game library and the same sign-in. Linux builds run directly, so titles such
as Team Fortress 2 and Half-Life use their Linux versions; Windows games use
DroidDeck-Proton as on arm64. The arm64 client stays the default.

- droiddeck-steam-x64: FEX and the x86-64 rootfs from DroidDeck-Components
  (sha256-pinned), client install and sync from Valve's CDN, sign-in shared
  with the arm64 client, its web helper on the GPU (ANGLE GL over FEX's GL
  thunk, zink, Turnip), Proton wrappers for the arm64 client's tools,
  DroidDeck direct for Linux builds, SD-card library (x86-64/ beside the
  arm64 one), repair.
- FEX 2610 built by build-fex.yml with thunks and three patches: an openat2
  fallback without openat2 (proot), newer-clang thunkgen, MAP_32BIT
  exhaustion returning ENOMEM. libblsession resolves RESOLVE_IN_ROOT paths
  inside the root.
- Session: x86-64 gating, shortcuts and compatibility tools per client,
  logs from the client that ran.
- App: client setting with the FEX version, an x86-64 chip on the Games
  header, the active client's library, art, storage, downloads, repair,
  Offline Mode, Decky, desktop mode, optional VAC diagnostics; per-client
  state for art, the content log, repair and leftovers.
- Strings in every locale.
- Review fixes: the library cache is saved only by the newest scan; an
  abandoned session's Steam logs come from the client it recorded; distinct
  VAC console names; FEXInterpreter in CPU pinning; clearer VAC hint in
  pl, ru, uk, cs and bg.
2026-10-17 23:57:52 -04:00

109 lines
3.7 KiB
Python

import os
from pathlib import Path
import runpy
import tempfile
import unittest
BIN = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin"
COMPAT = runpy.run_path(str(BIN / "steam-compatibility"))
CONFIG = '''"InstallConfigStore"
{
\t"Software"
\t{
\t\t"Valve"
\t\t{
\t\t\t"Steam"
\t\t\t{
\t\t\t\t"CompatToolMapping"
\t\t\t\t{
\t\t\t\t\t"550"
\t\t\t\t\t{
\t\t\t\t\t\t"name"\t\t"proton_experimental"
\t\t\t\t\t\t"config"\t\t""
\t\t\t\t\t\t"priority"\t\t"250"
\t\t\t\t\t}
\t\t\t\t\t"620"
\t\t\t\t\t{
\t\t\t\t\t\t"name"\t\t"proton-cachyos-a64"
\t\t\t\t\t\t"config"\t\t""
\t\t\t\t\t\t"priority"\t\t"250"
\t\t\t\t\t}
\t\t\t\t\t"880"
\t\t\t\t\t{
\t\t\t\t\t\t"name"\t\t"droiddeck-proton-arm64"
\t\t\t\t\t\t"config"\t\t""
\t\t\t\t\t\t"priority"\t\t"250"
\t\t\t\t\t}
\t\t\t\t\t"730"
\t\t\t\t\t{
\t\t\t\t\t\t"name"\t\t"steamlinuxruntime"
\t\t\t\t\t\t"config"\t\t""
\t\t\t\t\t\t"priority"\t\t"250"
\t\t\t\t\t}
\t\t\t\t}
\t\t\t}
\t\t}
\t}
}
'''
class X64RepointTest(unittest.TestCase):
"""steam-compatibility --x64: the x86-64 client's Proton entries go to its arm64 wrapper."""
def setUp(self):
self.home = tempfile.TemporaryDirectory()
self.root = Path(self.home.name) / "Steam"
(self.root / "config").mkdir(parents=True)
(self.root / "config" / "config.vdf").write_text(CONFIG)
# A wrapper of its own whose name starts with "proton": kept, never repointed.
own = self.root / "compatibilitytools.d" / "proton-cachyos-a64"
own.mkdir(parents=True)
(own / "compatibilitytool.vdf").write_text('"compatibilitytools"\n{\n\t"compat_tools"\n\t{\n\t\t"proton-cachyos-a64"\n\t\t{\n\t\t}\n\t}\n}\n')
self.old_home = os.environ.get("HOME")
os.environ["HOME"] = self.home.name
def tearDown(self):
if self.old_home is None:
os.environ.pop("HOME", None)
else:
os.environ["HOME"] = self.old_home
self.home.cleanup()
def mapping(self):
tokens = COMPAT["tokenize"]((self.root / "config" / "config.vdf").read_text())
return COMPAT["read_mapping"](tokens, COMPAT["mapping_block"](tokens))
def test_repoints_valve_proton_only(self):
moved = COMPAT["x64_repoint"](str(self.root), "GE-Proton11-7-a64")
self.assertEqual(moved, ["550", "880"])
m = self.mapping()
self.assertEqual(m["550"], "GE-Proton11-7-a64")
self.assertEqual(m["620"], "proton-cachyos-a64")
self.assertEqual(m["730"], "steamlinuxruntime")
# The arm64 client's own Proton name, which this client ignores.
self.assertEqual(m["880"], "GE-Proton11-7-a64")
self.assertEqual(m["0"], "GE-Proton11-7-a64")
def test_repoints_arm64_name_even_with_its_stray_tool(self):
# An arm64 compat pass that ran against this client also left its tool folder here.
stray = self.root / "compatibilitytools.d" / "droiddeck-proton-arm64"
stray.mkdir(parents=True)
(stray / "compatibilitytool.vdf").write_text('"compatibilitytools"\n{\n\t"compat_tools"\n\t{\n\t\t"droiddeck-proton-arm64"\n\t\t{\n\t\t}\n\t}\n}\n')
self.assertIn("880", COMPAT["x64_repoint"](str(self.root), "GE-Proton11-7-a64"))
self.assertEqual(self.mapping()["880"], "GE-Proton11-7-a64")
def test_live_notes_pending_restart(self):
COMPAT["x64_repoint"](str(self.root), "GE-Proton11-7-a64", live=True)
self.assertEqual((Path(self.home.name) / ".bl-compat-pending").read_text(), "550\n880\n")
def test_no_tool_changes_nothing(self):
before = (self.root / "config" / "config.vdf").read_text()
self.assertEqual(COMPAT["x64_repoint"](str(self.root), None), [])
self.assertEqual((self.root / "config" / "config.vdf").read_text(), before)
if __name__ == "__main__":
unittest.main()