d4a51e4102
* Adding att v3 support * misc fix * bug fix * Python linting workflow and rules * fix regex * Adding temporary args * fix temporary args * fix format * remove att_perfcounters from test input * Review comments (#163) Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com> * Revert "Review comments (#163)" This reverts commit 9ef0f8e5a4489d5581255e1b70ced2aef5c1c1d0. * Address review comments 2 * review changes * review comments * review * cmake alias * review * review * review * review * Enabling percounter in v3 script * review * formatting * formatting --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com> Co-authored-by: Baraldi, Giovanni <Giovanni.Baraldi@amd.com> Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com>
48 línte
1.5 KiB
Python
48 línte
1.5 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import pytest
|
|
import re
|
|
import os
|
|
|
|
|
|
def test_json_data(json_data):
|
|
data = json_data["rocprofiler-sdk-tool"]
|
|
strings = data["strings"]
|
|
assert "att_filenames" in strings.keys()
|
|
att_files = data["strings"]["att_filenames"]
|
|
assert len(att_files) > 0
|
|
|
|
|
|
def test_code_object_memory(code_object_file_path, json_data, output_path):
|
|
|
|
data = json_data["rocprofiler-sdk-tool"]
|
|
tool_memory_load = data["strings"]["code_object_snapshot_filenames"]
|
|
gfx_pattern = "gfx[a-z0-9]+"
|
|
match = re.search(gfx_pattern, tool_memory_load[0])
|
|
assert match != None
|
|
gpu_name = match.group(0)
|
|
tool_memory_load_1 = open(os.path.join(output_path, tool_memory_load[0]), "rb")
|
|
tool_memory_load_2 = open(os.path.join(output_path, tool_memory_load[1]), "rb")
|
|
found = False
|
|
for hsa_file in code_object_file_path["hsa_memory_load"]:
|
|
|
|
m = re.search(gfx_pattern, hsa_file)
|
|
assert m != None
|
|
gpu = m.group(0)
|
|
|
|
if gpu == gpu_name:
|
|
found = True
|
|
hsa_memory_load = open(hsa_file, "rb")
|
|
hsa_memory_fs = hsa_memory_load.read()
|
|
tool_memory_fs_1 = tool_memory_load_1.read()
|
|
tool_memory_fs_2 = tool_memory_load_2.read()
|
|
assert hsa_memory_fs == tool_memory_fs_2 or hsa_memory_fs == tool_memory_fs_1
|
|
break
|
|
assert found == True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
exit_code = pytest.main(["-x", __file__] + sys.argv[1:])
|
|
sys.exit(exit_code)
|