Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions project_tuxbox/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,11 @@ def expect_root_translations(output):
return "the provider substituted a stand-in for the program its root can bind"
return None

names = ("TUXBOX_LOG", "WINEDEBUG", "TUXBOX_SHADER_SESSION")
# This gate deliberately checks one refused program's stand-in. Do not
# inherit the caller's policy for the real game or another verification gate.
names = ("TUXBOX_LOG", "WINEDEBUG", "TUXBOX_SHADER_SESSION", "TUXBOX_NULL_PIPELINES")
saved = {name: host.env.get(name) for name in names}
host.env.update(TUXBOX_LOG="1", WINEDEBUG="-all,+debugstr")
host.env.update(TUXBOX_LOG="1", WINEDEBUG="-all,+debugstr", TUXBOX_NULL_PIPELINES="1")
host.env.pop("TUXBOX_SHADER_SESSION", None)
try:
forget(rootless)
Expand Down
12 changes: 11 additions & 1 deletion tests/test_lanes_compute_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ComputeRootGateTests(unittest.TestCase):
STAND_IN = "substituted null compute pipeline for an untranslated shader (1 so far)\n"
REFUSAL = "unmapped descriptor at s5 + 0xa0"

def run_gate(self, output, compiled, refused):
def run_gate(self, output, compiled, refused, null_policy=None):
rootless = [hashlib.sha256(shader_fixture.root_shader(offset)).hexdigest() for offset in (0x40, 0xA0)]
with TemporaryDirectory() as prefix:
sources = Path(prefix) / SOURCE_CACHE
Expand All @@ -80,6 +80,8 @@ def run_gate(self, output, compiled, refused):
for path in (*stale, kept):
path.write_bytes(b"")
env = {"WINEPREFIX": prefix, "TUXBOX_SHADER_SESSION": "1", "TUXBOX_LOG": "stderr"}
if null_policy is not None:
env["TUXBOX_NULL_PIPELINES"] = null_policy
seen = {}

@contextmanager
Expand Down Expand Up @@ -118,6 +120,14 @@ def test_root_translations_pass_and_clean_their_entries(self):
self.assertEqual(seen["env_after"]["TUXBOX_SHADER_SESSION"], "1")
self.assertEqual(seen["env_after"]["TUXBOX_LOG"], "stderr")

def test_null_policy_is_explicit_and_restored(self):
for policy in (None, "0", "1"):
with self.subTest(policy=policy):
seen, _ = self.run_gate(self.STAND_IN, ["a"*64], [("b"*64, self.REFUSAL)], policy)
self.assertEqual(seen["env"]["TUXBOX_NULL_PIPELINES"], "1")
self.assertEqual(seen["env_after"].get("TUXBOX_NULL_PIPELINES"), policy)
self.assertIsNone(seen["problem"])

def test_rootless_fallback_fails(self):
rootless = self.run_gate(self.STAND_IN, [], [])[1]
refusal = [("b" * 64, self.REFUSAL)]
Expand Down
Loading