Commit 88b91df1 by Cody Northrop Committed by Commit Bot

Capture/Replay: Support multi-digit context

The code is designed for single digit contexts, i.e 1-9. We've hit our first app that uses context 10, so update the logic. Bug: b/184105957 Bug: angleproject:5807 Change-Id: Ice5facad8a86f009c0a85d184db4a20e48eff248 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2796402 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent fe6b4269
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
"src/tests/restricted_traces/free_fire.tar.gz.sha1": "src/tests/restricted_traces/free_fire.tar.gz.sha1":
"a4e7aba54fb48524bb4f3022623bc7cd", "a4e7aba54fb48524bb4f3022623bc7cd",
"src/tests/restricted_traces/gen_restricted_traces.py": "src/tests/restricted_traces/gen_restricted_traces.py":
"7df2fbfb890d54ea9932b443439ae97e", "e16f270a02d11ad334cdd43bdff8b068",
"src/tests/restricted_traces/google_maps.tar.gz.sha1": "src/tests/restricted_traces/google_maps.tar.gz.sha1":
"5d7001969619570e80e5a39b1ab8b0c4", "5d7001969619570e80e5a39b1ab8b0c4",
"src/tests/restricted_traces/happy_color.tar.gz.sha1": "src/tests/restricted_traces/happy_color.tar.gz.sha1":
......
...@@ -302,10 +302,17 @@ def get_context(trace): ...@@ -302,10 +302,17 @@ def get_context(trace):
for file in os.listdir(trace): for file in os.listdir(trace):
# Load up the only header present for each trace # Load up the only header present for each trace
if fnmatch.fnmatch(file, '*.h'): if fnmatch.fnmatch(file, '*.h'):
# Strip the extension to isolate the context # Strip the extension to isolate the context by scanning
context = file[len(file) - 3] # for numbers leading up to the last one, i.e.:
assert context.isdigit() == True, "Failed to find trace context number" # app_capture_context123.h
assert file[len(file) - 4].isdigit() == False, "Context number is higher than 9" # ^^
# start---||---end
start = len(file) - 3
end = start + 1
while file[start - 1].isdigit():
start -= 1
context = file[start:end]
assert context.isnumeric(), "Failed to find trace context number"
return context return context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment