Add Python test helper validate_eventids()

Called when loading captures in Iter_Test and Repeat_Load

Checks the consistency of EventIds:

Walk the actions to find all the referenced EventId's:
- Error if any EventId is duplicated
- Error if the EventId's are not contiguous (with no gaps)
This commit is contained in:
Jake Turner
2026-04-24 15:50:40 +01:00
parent 20ffe66fb5
commit d0b69c7034
3 changed files with 26 additions and 0 deletions
+22
View File
@@ -1164,3 +1164,25 @@ class TestCase:
raise TestFailureException(f"Step {i} ShaderVariableChange for '{c.after.name}' before is not well formed")
return True
def validate_eventids(self, controller: rd.ReplayController) -> bool:
actions = controller.GetRootActions()
eventIds = set()
maxEventId = 0
while len(actions) > 0:
action = actions.pop()
for event in action.events:
eid = event.eventId
if eid in eventIds:
log.error(f"ERROR: Duplicated EventId: {eid} Action: {action.actionId} {action.customName}")
return False
if eid > maxEventId:
maxEventId = eid
eventIds.add(eid)
for child in action.children:
actions.append(child)
for eid in range(1, maxEventId+1):
if not eid in eventIds:
log.error(f"ERROR: Missing EventId: {eid}")
return False
return True
+2
View File
@@ -501,6 +501,8 @@ class Iter_Test(rdtest.TestCase):
continue
section_name = 'Iterating {}'.format(file.name)
if not self.validate_eventids(self.controller):
raise rdtest.TestFailureException("ERROR: capture doesn't have valid event IDs.")
rdtest.log.begin_section(section_name)
self.iter_test()
+2
View File
@@ -19,6 +19,8 @@ class Repeat_Load(rdtest.TestCase):
return
rdtest.log.print("Loaded capture.")
if not self.validate_eventids(controller):
raise rdtest.TestFailureException("ERROR: capture doesn't have valid event IDs.")
# Do nothing, just ensure it's loaded
memory_usage: int = rd.GetCurrentProcessMemoryUsage()