fix: droiddeckctl pacing reads timestats dumps with Windows line ends (#2186)

This commit is contained in:
Jordan Y authored and GitHub committed 2026-11-07 08:23:06 -05:00
1 parent aba55031c3
commit 7c429f3a26
2 files changed
+6

No files matched your search

+1
View File
@@ -295,6 +295,7 @@ def record(adb: str, serial: str, path: str, seconds: float, display: int | None
def pacing_summary(text: str, package: str = PACKAGE) -> dict:
text = text.replace("\r\n", "\n")
records = {"game": [], "surface": []}
for part in re.split(r"^displayRefreshRate = ", text, flags=re.M)[1:]:
rate = re.match(r"(\d+)", part)
+5
View File
@@ -344,6 +344,11 @@ class DroiddeckctlTest(FakeAdbTest):
self.assertEqual(248, summary["offCadence"])
self.assertEqual(13.8, summary["offCadencePercent"])
def test_pacing_reads_a_dump_with_windows_line_ends(self):
summary = ctl.pacing_summary(TIMESTATS_SPLIT.replace("\n", "\r\n"), "com.droiddeck.launcher")
self.assertEqual(ctl.pacing_summary(TIMESTATS_SPLIT, "com.droiddeck.launcher"), summary)
self.assertEqual(1800, summary["frames"])
def test_pacing_falls_back_to_the_sessions_surfaceview(self):
summary = ctl.pacing_summary(TIMESTATS_SURFACEVIEW, "com.droiddeck.launcher")
self.assertEqual(1, len(summary["layers"]))