mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-22 17:19:58 -04:00
Triforce v0.7.0 "Sage Of Courage"
The 0.6 crashes after warps and area changes fixed (no write-back into memory the capture leaves out), invisible objects fixed (occlusion gate), DLSS frame generation flicker fixed, achievements, the renderer built with a play profile, faster translated game code, helper threads judged on settled scenes, memory, shader preparation, audio effects, launcher, controls and Linux fixes.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
"""Exercise actual production stage-all/copy/swap statements with authored temporary files.
|
||||
|
||||
python -I -B tests/test_finish_output.py
|
||||
|
||||
(The fixture's program is Triforce.exe, the name the build gives it: under its old name the finish's own cleanup of old
|
||||
programs removed it, and five of these tests stopped on a missing file.)
|
||||
"""
|
||||
import ast
|
||||
import contextlib
|
||||
@@ -49,7 +52,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.built = self.work / "sa" / "build"
|
||||
self.built.mkdir(parents=True)
|
||||
self.out.mkdir()
|
||||
self.source, self.destination = self.built / "hookshot.exe", self.out / "hookshot.exe"
|
||||
self.source, self.destination = self.built / "Triforce.exe", self.out / "Triforce.exe"
|
||||
self.source.write_bytes(b"new synthetic executable")
|
||||
self.destination.write_bytes(b"existing synthetic executable")
|
||||
(self.work / "sa" / "image").mkdir()
|
||||
@@ -67,7 +70,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
def finish(self, launcher=False):
|
||||
if launcher:
|
||||
(self.root / "HookshotBuilder-Setup.exe").write_bytes(b"new synthetic launcher")
|
||||
with mock.patch.object(make_game, "BESIDE", ["hookshot.exe"]):
|
||||
with mock.patch.object(make_game, "BESIDE", ["Triforce.exe"]):
|
||||
# Comprehensions use globals. Keep one namespace, as in production, and discover only authored setup files.
|
||||
namespace = dict(make_game.__dict__, built=str(self.built), out=str(self.out), work=str(self.work),
|
||||
ROOT=str(self.root / "tools"), LINUX=False if launcher else make_game.LINUX)
|
||||
@@ -78,7 +81,10 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.assertEqual((self.out / "image.bin").read_bytes(), b"existing synthetic image")
|
||||
|
||||
def assert_no_staging_files(self):
|
||||
self.assertEqual(sorted(path.name for path in self.out.iterdir()), ["hookshot.exe", "image.bin"])
|
||||
# (the note of what was installed is the finish's own, not a staging file: the performance audit's IO-45,
|
||||
# tests/test_finish_installed.py)
|
||||
self.assertEqual(sorted(path.name for path in self.out.iterdir() if path.name != make_game.INSTALLED_NOTE),
|
||||
["Triforce.exe", "image.bin"])
|
||||
|
||||
def stopped_output(self):
|
||||
output = io.StringIO()
|
||||
@@ -124,7 +130,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.assert_no_staging_files()
|
||||
|
||||
def test_launcher_stages_all_three_files_before_replacement(self):
|
||||
binary = self.out / "bin" / "hookshot.exe"
|
||||
binary = self.out / "bin" / "Triforce.exe"
|
||||
binary.parent.mkdir()
|
||||
binary.write_bytes(b"existing synthetic game in bin")
|
||||
copy = make_game.shutil.copy2
|
||||
@@ -148,7 +154,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.assertEqual(list(self.out.rglob("*.new")), [])
|
||||
|
||||
def test_partial_launcher_copy_preserves_game_image_and_launcher(self):
|
||||
binary = self.out / "bin" / "hookshot.exe"
|
||||
binary = self.out / "bin" / "Triforce.exe"
|
||||
binary.parent.mkdir()
|
||||
binary.write_bytes(b"existing synthetic game in bin")
|
||||
copy = make_game.shutil.copy2
|
||||
@@ -164,9 +170,9 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.finish(launcher=True)
|
||||
self.assert_installed_unchanged()
|
||||
self.assertEqual(binary.read_bytes(), b"existing synthetic game in bin")
|
||||
self.assertEqual(binary.with_name("hookshot.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertEqual(binary.with_name("Triforce.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertEqual((self.out / "image.bin.new").read_bytes(), self.image.read_bytes())
|
||||
self.assertEqual((self.out / "hookshot.exe.new").read_bytes(), b"partial launcher")
|
||||
self.assertEqual((self.out / "Triforce.exe.new").read_bytes(), b"partial launcher")
|
||||
|
||||
def test_partial_executable_copy_preserves_both_installed_files(self):
|
||||
def partial_copy(source, destination):
|
||||
@@ -177,7 +183,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
with self.assertRaises(OSError):
|
||||
self.finish()
|
||||
self.assert_installed_unchanged()
|
||||
self.assertEqual((self.out / "hookshot.exe.new").read_bytes(), b"incomplete replacement")
|
||||
self.assertEqual((self.out / "Triforce.exe.new").read_bytes(), b"incomplete replacement")
|
||||
self.assertFalse((self.out / "image.bin.new").exists())
|
||||
|
||||
def test_partial_image_copy_preserves_both_installed_files(self):
|
||||
@@ -194,7 +200,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
with self.assertRaises(OSError):
|
||||
self.finish()
|
||||
self.assert_installed_unchanged()
|
||||
self.assertEqual((self.out / "hookshot.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertEqual((self.out / "Triforce.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertEqual((self.out / "image.bin.new").read_bytes(), b"incomplete image")
|
||||
|
||||
def test_readonly_source_mode_is_preserved_on_success(self):
|
||||
@@ -212,8 +218,8 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.assertIn("writable", message)
|
||||
self.assertNotIn("the game is running", message)
|
||||
self.assert_installed_unchanged()
|
||||
self.assertEqual((self.out / "hookshot.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertFalse((self.out / "hookshot.exe.new").stat().st_mode & stat.S_IWRITE)
|
||||
self.assertEqual((self.out / "Triforce.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertFalse((self.out / "Triforce.exe.new").stat().st_mode & stat.S_IWRITE)
|
||||
self.assertEqual((self.out / "image.bin.new").read_bytes(), self.image.read_bytes())
|
||||
|
||||
def test_stage_copy_permission_failure_has_actionable_paths(self):
|
||||
@@ -224,13 +230,13 @@ class FinishOutputTests(unittest.TestCase):
|
||||
with mock.patch.object(make_game.shutil, "copy2", side_effect=denied_copy):
|
||||
message = self.stopped_output()
|
||||
self.assertIn("stage", message)
|
||||
self.assertIn(str(self.out / "hookshot.exe.new"), message)
|
||||
self.assertIn(str(self.out / "Triforce.exe.new"), message)
|
||||
self.assertIn(str(self.source), message)
|
||||
self.assertIn("readable", message)
|
||||
self.assertIn("writable", message)
|
||||
self.assertIn("No installed files were replaced", message)
|
||||
self.assert_installed_unchanged()
|
||||
self.assertEqual((self.out / "hookshot.exe.new").read_bytes(), b"partial staged copy")
|
||||
self.assertEqual((self.out / "Triforce.exe.new").read_bytes(), b"partial staged copy")
|
||||
|
||||
@unittest.skipUnless(os.name == "nt", "Windows file-sharing contract")
|
||||
def test_locked_destination_reports_action_and_retains_staged_build(self):
|
||||
@@ -250,7 +256,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
self.assertIn(str(self.destination), message)
|
||||
self.assertIn(str(self.source), message)
|
||||
self.assert_installed_unchanged()
|
||||
self.assertEqual((self.out / "hookshot.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertEqual((self.out / "Triforce.exe.new").read_bytes(), self.source.read_bytes())
|
||||
self.assertEqual((self.out / "image.bin.new").read_bytes(), self.image.read_bytes())
|
||||
finally:
|
||||
self.assertTrue(kernel.CloseHandle(handle))
|
||||
@@ -270,7 +276,7 @@ class FinishOutputTests(unittest.TestCase):
|
||||
|
||||
@unittest.skipUnless(os.name == "nt", "Windows read-only staging-file contract")
|
||||
def test_readonly_existing_stage_is_not_removed_or_unlocked(self):
|
||||
staged = self.out / "hookshot.exe.new"
|
||||
staged = self.out / "Triforce.exe.new"
|
||||
staged.write_bytes(b"pre-existing staged content")
|
||||
staged.chmod(stat.S_IREAD)
|
||||
with mock.patch.object(make_game.os, "chmod", wraps=make_game.os.chmod) as chmod:
|
||||
|
||||
Reference in New Issue
Block a user