mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 12:29:57 -04:00
Write the session's reports when the window loses the focus in play, more often in play, and log every end of the game in the launcher.
The session of 2026-11-13 ended 8 s after its window lost the focus, after 7 minutes of play, with none of the game's exit lines: no frame-time summary of its last period, no stutter map of its last minute and no growth ranking at all, as the ranking came every 10 minutes. When the window loses the focus in play, the present thread now writes the frame-time summary so far (starting a new period), the stutter map and the growth ranking at its next present, at most once a minute; formatting only, nothing asks the device. The growth ranking comes every 2 minutes of play instead of 10, the stutter map every 5 instead of 10. A process that ends through exit() rather than plat_exit now writes the log thread's queue last, after the frame-time summary's exit handler, instead of losing it. The launcher logged a game's end only for a nonzero code, so the session's end with code 0 left no line anywhere. It now logs every end of a game it started, and when the game's log has no line of the game's own end (the window's close, the game's ExitProcess, a timed run's end, a FATAL or exit line), it notes the end there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5153,6 +5153,30 @@ class WhilePlayingTest(Tmp):
|
||||
self.assertEqual(app.last_fatal(self.tmp), '')
|
||||
self.assertEqual(app.last_fatal(''), '')
|
||||
|
||||
def test_an_end_with_code_0_is_logged_and_noted_without_the_games_exit_line(self):
|
||||
"""A run ended with code 0 goes into launcher.log; when the game's log has no line of the game's own end (the
|
||||
window's close, its ExitProcess, a FATAL line), the end is noted in that log too."""
|
||||
try:
|
||||
from launcher.ui import app
|
||||
except ImportError as e:
|
||||
self.skipTest(f'no window toolkit: {e}')
|
||||
a, log = self.ended(0, '[host] log: x\n[host] gfx: window closed; exiting\n[host] perf: after it\n')
|
||||
a.ctx.log.assert_called_once_with('the game ended with code 0')
|
||||
self.assertNotIn('[launcher]', log.read_text(encoding='utf-8'))
|
||||
a, log = self.ended(0, '[host] log: x\n[host] perf: frame 39660: the last line of play\n')
|
||||
a.ctx.log.assert_called_once_with('the game ended with code 0, and its log has no line of its own end')
|
||||
text = log.read_text(encoding='utf-8')
|
||||
self.assertIn("[launcher] the game ended with code 0 (the log has no line of the game's own end", text)
|
||||
self.assertIs(app.log_has_own_exit(self.tmp), False) # the note ends the search for the next run
|
||||
log.write_text('FATAL: x\n', encoding='utf-8')
|
||||
self.assertIs(app.log_has_own_exit(self.tmp), True)
|
||||
log.write_text('[host] guest ExitProcess at main+0x10; exiting\n', encoding='utf-8')
|
||||
self.assertIs(app.log_has_own_exit(self.tmp), True)
|
||||
log.unlink()
|
||||
self.assertIsNone(app.log_has_own_exit(self.tmp))
|
||||
a, _ = self.ended(0, None) # no log: logged as an end with code 0, nothing noted
|
||||
a.ctx.log.assert_called_once_with('the game ended with code 0')
|
||||
|
||||
def test_the_fatal_line_is_looked_for_in_the_logs_end(self):
|
||||
try:
|
||||
from launcher.ui import app
|
||||
|
||||
Reference in New Issue
Block a user