Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

chore(compat): rebase multi-appid import and CI regression on merged checks (#775)

A Hazy Reign Is Fluid44ee53af7bc0
diff --git a/Makefile b/Makefile
index 9aacb74..0787c17 100644
--- a/Makefile
+++ b/Makefile
@@ -190,6 +190,11 @@ compat-reported-check:
@if [ ! -f scripts/tests/compat-reported-commit.sh ]; then $(call SKIP,compat-reported-check,scripts/tests/compat-reported-commit.sh); exit 0; fi; \
sh scripts/tests/compat-reported-commit.sh
+# Offline test for compatible wiki pages with more than one Steam app ID.
+.PHONY: compat-reported-import-check
+compat-reported-import-check:
+ @python3 scripts/tests/compat-reported.py
+
.PHONY: mincheck
mincheck:
@if [ ! -d "$(APP_BUNDLE)" ]; then echo "==> mincheck: $(APP_BUNDLE) not present, skipped (make app builds it)"; exit 0; fi; \
@@ -885,7 +890,7 @@ np-inventory-check:
# overlay-shim-tests is left out: it needs a Metal GPU and real frame timing.
CI_CHECKS := mincheck l10ncheck \
sigcheck callscheck np-test-batch-check webpatch-fixtures peicon-fixtures panel-behavior spawn-env \
- activatecheck compatcheck compatsvc-check prefixstate-check shortcutcheck launch-shell envcheck \
+ activatecheck compat-reported-import-check compatcheck compatsvc-check prefixstate-check shortcutcheck launch-shell envcheck \
buildcheck settingscheck routecheck bridgecheck envpasscheck prefixnotecheck powernotecheck exitcheck gamedrivecheck launchercheck \
seedcheck gamefixescheck versioncheck cicheck padcheck compat-reported-check np-inventory-check np-native-tests native-shim-tests \
app-tests native-installercheck
diff --git a/scripts/compat-reported.py b/scripts/compat-reported.py
index 7f2e2ca..9758448 100755
--- a/scripts/compat-reported.py
+++ b/scripts/compat-reported.py
@@ -66,10 +66,15 @@ def main():
for p in d["query"]["pages"]:
text = (p.get("revisions") or [{}])[0].get("slots", {}).get("main", {}).get("content", "")
rating = field(text, "crossover").lower()
- appid = field(text, "steam appid").split(",")[0].strip()
- if rating in GOOD and appid.isdigit():
- games[int(appid)] = {"appid": int(appid), "name": p["title"], "crossover": rating,
- "page": "https://www.applegamingwiki.com/wiki/" + urllib.parse.quote(p["title"].replace(" ", "_"))}
+ if rating in GOOD:
+ for value in field(text, "steam appid").split(","):
+ appid = value.strip()
+ if appid.isdigit():
+ games[int(appid)] = {
+ "appid": int(appid), "name": p["title"], "crossover": rating,
+ "page": "https://www.applegamingwiki.com/wiki/" +
+ urllib.parse.quote(p["title"].replace(" ", "_")),
+ }
print(f" {min(i + 50, len(titles))}/{len(titles)}: {len(games)} should work", file=sys.stderr)
out = {
"source": "AppleGamingWiki, CrossOver ratings (https://www.applegamingwiki.com)",
diff --git a/scripts/tests/compat-reported.py b/scripts/tests/compat-reported.py
new file mode 100644
index 0000000..0ba9527
--- /dev/null
+++ b/scripts/tests/compat-reported.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+"""Regression coverage for multi-ID Steam compatibility entries (offline)."""
+import importlib.util
+import json
+from pathlib import Path
+import tempfile
+import unittest
+from unittest.mock import patch
+
+
+SCRIPT = Path(__file__).resolve().parents[1] / "compat-reported.py"
+spec = importlib.util.spec_from_file_location("bridgeplay_compat_reported", SCRIPT)
+module = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(module)
+
+
+class ReportedCompatTests(unittest.TestCase):
+ def test_multiple_appids_from_one_compatible_page(self):
+ pages = [
+ {"title": "Two Editions", "revisions": [{"slots": {"main": {"content":
+ "| crossover = Perfect\n| steam appid = 42, 43, invalid\n"}}}]},
+ {"title": "Not Compatible", "revisions": [{"slots": {"main": {"content":
+ "| crossover = Broken\n| steam appid = 44\n"}}}]},
+ ]
+ with tempfile.TemporaryDirectory() as tmp, \
+ patch.object(module, "OUT", str(Path(tmp) / "reported.json")), \
+ patch.object(module, "pages", return_value=[p["title"] for p in pages]), \
+ patch.object(module, "api", return_value={"query": {"pages": pages}}):
+ module.main()
+ result = json.loads(Path(module.OUT).read_text())
+ self.assertEqual([42, 43], sorted(g["appid"] for g in result["games"]))
+ self.assertTrue(all(g["crossover"] == "perfect" for g in result["games"]))
+
+
+if __name__ == "__main__":
+ unittest.main()