mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-20 22:41:36 +00:00
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:
@@ -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
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user