mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 23:36:04 +00:00
perf: session log step times carry milliseconds (#993)
The == STEP lines in session.log now read HH:MM:SS.mmm, so the setup steps before Steam starts can be timed; with whole seconds most of them showed the same time. Co-authored-by: ovurrsl <ovurrsl@users.noreply.github.com> Co-authored-by: xXJsonDeruloXx <danielhimebauch@gmail.com>
This commit is contained in:
1 parent
d60f683b62
commit
3331edf265
2 files changed
+28
-1
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import re
|
||||
import subprocess
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
SESSION = Path(__file__).resolve().parents[1] / "linuxfs/overlay/usr/local/bin/droiddeck-session"
|
||||
|
||||
|
||||
def step_function():
|
||||
match = re.search(r"^step\(\) \{.*\}$", SESSION.read_text(), re.M)
|
||||
return match.group(0)
|
||||
|
||||
|
||||
class SessionStepTimeTest(unittest.TestCase):
|
||||
def test_a_step_line_carries_milliseconds_before_its_text(self):
|
||||
out = subprocess.run(["bash", "-c", step_function() + "\nstep starting the Steam client"],
|
||||
capture_output=True, text=True, timeout=30).stdout.strip()
|
||||
self.assertRegex(out, r"^== STEP \d{2}:\d{2}:\d{2}\.\d{3} starting the Steam client$")
|
||||
|
||||
def test_the_text_after_the_first_space_is_the_step_name(self):
|
||||
out = subprocess.run(["bash", "-c", step_function() + "\nstep checking the Steam client"],
|
||||
capture_output=True, text=True, timeout=30).stdout.strip()
|
||||
self.assertEqual("checking the Steam client", out.removeprefix("== STEP ").split(" ", 1)[1])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user