Update Perfetto and fix tests (#378)

Fix for "SWDEV-479652" - Perfetto-based tests are failing.

Updated version of perfetto submodule to v46.0.
Modified Omnitrace code that uses Perfetto, so it can compile.
Modified the testing code, so it can run the version of trace_processor_shell provided (v46.0).

---------

Signed-off-by: Aleksandar Janicijevic <Aleksandar.Janicijevic@amd.com>
Co-authored-by: David Galiffi <David.Galiffi@amd.com>
Šī revīzija ir iekļauta:
ajanicijamdunDavid Galiffi authored and GitHub committed 2024-09-13 13:43:26 -04:00
1 vecāks 1413ab612d
revīzija 96d7b8f0ab
15 files changed
+173 -70

No files matched your search

+2 -1
Parādīt failu
@@ -166,7 +166,8 @@ foreach(_VERSION ${OMNITRACE_PYTHON_VERSIONS})
NAME ${TEST_NAME}-validate-perfetto
COMMAND
${_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/validate-perfetto-proto.py
-m ${TEST_PERFETTO_METRIC} ${TEST_ARGS} -p -i
-m ${TEST_PERFETTO_METRIC} ${TEST_ARGS} -p -t
/opt/trace_processor/bin/trace_processor_shell -i
PYTHON_VERSION ${_VERSION}
FILE omnitrace-tests-output/${TEST_NAME}/${_VERSION}/${TEST_PERFETTO_FILE}
DEPENDS ${TEST_NAME}-${_VERSION}
+1
Parādīt failu
@@ -985,6 +985,7 @@ function(OMNITRACE_ADD_VALIDATION_TEST)
${CMAKE_CURRENT_LIST_DIR}/validate-perfetto-proto.py -m
"${TEST_PERFETTO_METRIC}" ${TEST_ARGS} -i
${PROJECT_BINARY_DIR}/omnitrace-tests-output/${TEST_NAME}/${TEST_PERFETTO_FILE}
-t /opt/trace_processor/bin/trace_processor_shell
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
endif()
+22 -6
Parādīt failu
@@ -1,23 +1,36 @@
#!/usr/bin/env python3
import sys
import os
import argparse
from perfetto.trace_processor import TraceProcessor
from perfetto.trace_processor import TraceProcessor, TraceProcessorConfig
def load_trace(inp, max_tries=5, retry_wait=1):
def load_trace(inp, max_tries=5, retry_wait=1, bin_path=None):
"""Occasionally connecting to the trace processor fails with HTTP errors
so this function tries to reduce spurious test failures"""
n = 0
tp = None
# Check if bin_path is set and if it exists
print("trace_processor path: ", bin_path)
if bin_path and not os.path.isfile(bin_path):
print(f"Path {bin_path} does not exist. Using the default path.")
bin_path = None
while tp is None:
try:
tp = TraceProcessor(trace=(inp))
if bin_path:
config = TraceProcessorConfig(bin_path=bin_path)
tp = TraceProcessor(trace=inp, config=config)
else:
tp = TraceProcessor(trace=inp)
break
except Exception as e:
sys.stderr.write(f"{e}\n")
except Exception as ex:
sys.stderr.write(f"{ex}\n")
sys.stderr.flush()
if n >= max_tries:
raise
else:
@@ -71,6 +84,9 @@ if __name__ == "__main__":
"-p", "--print", action="store_true", help="Print the processed perfetto data"
)
parser.add_argument("-i", "--input", type=str, help="Input file", required=True)
parser.add_argument(
"-t", "--trace_processor_shell", type=str, help="Path of trace_processor_shell"
)
parser.add_argument(
"--key-names",
type=str,
@@ -93,7 +109,7 @@ if __name__ == "__main__":
"The same number of labels, counts, and depths must be specified"
)
tp = load_trace(args.input)
tp = load_trace(args.input, bin_path=args.trace_processor_shell)
if tp is None:
raise ValueError(f"trace {args.input} could not be loaded")