tp: Implement support for metrics strings for diff tests
Bug:255535171
Change-Id: Id354f203f5583e1cce288a5232a0b2445ed233ce
diff --git a/python/generators/diff_tests/runner.py b/python/generators/diff_tests/runner.py
index 988c17b..c1ab31f 100644
--- a/python/generators/diff_tests/runner.py
+++ b/python/generators/diff_tests/runner.py
@@ -24,7 +24,7 @@
from typing import Dict, List, Tuple
from google.protobuf import text_format
-from python.generators.diff_tests.testing import DiffTest
+from python.generators.diff_tests.testing import DiffTest, TestType
from python.generators.diff_tests.utils import (
ColorFormatter, create_message_factory, get_env, get_trace_descriptor_path,
read_all_tests, serialize_python_trace, serialize_textproto_trace)
@@ -37,7 +37,7 @@
# Performance result of running the test.
@dataclass
class PerfResult:
- test_type: DiffTest.TestType
+ test_type: TestType
trace_path: str
query_path_or_metric: str
ingest_time_ns: int
@@ -156,7 +156,7 @@
'--analyze-trace-proto-content',
'--crop-track-events',
'--run-metrics',
- self.test.query_path,
+ self.test.blueprint.query.name,
'--metrics-output=%s' % ('json' if json_output else 'binary'),
'--perf-file',
tmp_perf_file.name,
@@ -248,12 +248,12 @@
str = f"{self.colors.yellow('[ RUN ]')} {self.test.name}\n"
- if self.test.type == DiffTest.TestType.QUERY:
+ if self.test.type == TestType.QUERY:
if not os.path.exists(self.test.query_path):
return None, str + f"Query file not found {self.test.query_path}"
result = self.__run_query_test(gen_trace_path)
- elif self.test.type == DiffTest.TestType.METRIC:
+ elif self.test.type == TestType.METRIC:
result = self.__run_metrics_test(
gen_trace_path,
create_message_factory(metrics_descriptor_paths,
diff --git a/python/generators/diff_tests/testing.py b/python/generators/diff_tests/testing.py
index af39039..f5a9fdb 100644
--- a/python/generators/diff_tests/testing.py
+++ b/python/generators/diff_tests/testing.py
@@ -28,13 +28,24 @@
filename: str
+@dataclass
+class Metric:
+ name: str
+
+
+class TestType(Enum):
+ QUERY = 1
+ METRIC = 2
+
+
# Blueprint for running the diff test. 'query' is being run over data from the
# 'trace 'and result will be compared to the 'out. Each test (function in class
# inheriting from DiffTestModule) returns a DiffTestBlueprint.
@dataclass
class DiffTestBlueprint:
- trace: Union[str, 'Path']
- query: Union[str, 'Path']
+
+ trace: Union[str, Path]
+ query: Union[str, Path, Metric]
out: Union[str, 'Path']
def is_trace_file(self):
@@ -43,6 +54,9 @@
def is_query_file(self):
return isinstance(self.query, Path)
+ def is_metric(self):
+ return isinstance(self.query, Metric)
+
def is_out_file(self):
return isinstance(self.out, Path)
@@ -53,25 +67,20 @@
# script.
class DiffTest:
- class TestType(Enum):
- QUERY = 1
- METRIC = 2
-
def __init__(self, name: str, blueprint: DiffTestBlueprint,
index_dir: str) -> None:
self.name = name
self.blueprint = blueprint
- if blueprint.is_query_file():
- if blueprint.query.filename.endswith('.sql'):
- self.type = DiffTest.TestType.QUERY
- self.query_path = os.path.abspath(
- os.path.join(index_dir, blueprint.query.filename))
- else:
- self.type = DiffTest.TestType.METRIC
- self.query_path = blueprint.query.filename
+ if blueprint.is_metric():
+ self.type = TestType.METRIC
else:
- self.type = DiffTest.TestType.METRIC
+ self.type = TestType.QUERY
+
+ if blueprint.is_query_file():
+ self.query_path = os.path.abspath(
+ os.path.join(index_dir, blueprint.query.filename))
+ else:
self.query_path = None
if blueprint.is_trace_file():
@@ -89,9 +98,12 @@
# Verifies that the test should be in test suite. If False, test will not be
# executed.
def validate(self, query_metric_filter: str, trace_filter: str):
- if not (self.blueprint.is_out_file() and self.blueprint.is_query_file() and
- self.blueprint.is_trace_file()):
+ # Assertions until string passing is supported
+ if not (self.blueprint.is_out_file() and self.blueprint.is_trace_file()):
raise AssertionError("Test parameters should be passed as files.")
+ if (self.type == TestType.QUERY and not self.blueprint.is_query_file()):
+ raise AssertionError(
+ "Only METRIC tests can have `query` passed as string.")
query_metric_pattern = re.compile(query_metric_filter)
trace_pattern = re.compile(trace_filter)
diff --git a/test/trace_processor/android/index.py b/test/trace_processor/android/index.py
index 31bae5e..de6d2b3 100644
--- a/test/trace_processor/android/index.py
+++ b/test/trace_processor/android/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/atrace/index.py b/test/trace_processor/atrace/index.py
index 8fe6aa0..4c748f2 100644
--- a/test/trace_processor/atrace/index.py
+++ b/test/trace_processor/atrace/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/camera/index.py b/test/trace_processor/camera/index.py
index c9813a9..2ffd595 100644
--- a/test/trace_processor/camera/index.py
+++ b/test/trace_processor/camera/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -23,11 +23,11 @@
def test_camera_ion_mem_trace_android_camera(self):
return DiffTestBlueprint(
trace=Path('../../data/camera-ion-mem-trace'),
- query=Path('android_camera'),
+ query=Metric('android_camera'),
out=Path('camera-ion-mem-trace_android_camera.out'))
def test_camera_ion_mem_trace_android_camera_unagg(self):
return DiffTestBlueprint(
trace=Path('../../data/camera-ion-mem-trace'),
- query=Path('android_camera_unagg'),
+ query=Metric('android_camera_unagg'),
out=Path('camera-ion-mem-trace_android_camera_unagg.out'))
diff --git a/test/trace_processor/chrome/index.py b/test/trace_processor/chrome/index.py
index 4983781..8763d43 100644
--- a/test/trace_processor/chrome/index.py
+++ b/test/trace_processor/chrome/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -125,6 +125,15 @@
query=Path('chrome_tasks_delaying_input_processing_test.sql'),
out=Path('chrome_tasks_delaying_input_processing_test.out'))
+ def test_long_task_tracking_trace_chrome_long_tasks_delaying_input_processing_test(
+ self):
+ return DiffTestBlueprint(
+ trace=Path('../../data/long_task_tracking_trace'),
+ query=Path('chrome_long_tasks_delaying_input_processing_test.sql'),
+ out=Path(
+ 'long_task_tracking_trace_chrome_long_tasks_delaying_input_processing_test.out'
+ ))
+
def test_experimental_reliable_chrome_tasks_delaying_input_processing_test(
self):
return DiffTestBlueprint(
@@ -152,13 +161,13 @@
def test_frame_times_metric(self):
return DiffTestBlueprint(
trace=Path('../../data/chrome_rendering_desktop.pftrace'),
- query=Path('frame_times'),
+ query=Metric('frame_times'),
out=Path('frame_times_metric.out'))
def test_chrome_dropped_frames_metric(self):
return DiffTestBlueprint(
trace=Path('../../data/chrome_rendering_desktop.pftrace'),
- query=Path('chrome_dropped_frames'),
+ query=Metric('chrome_dropped_frames'),
out=Path('chrome_dropped_frames_metric.out'))
def test_chrome_long_latency_metric(self):
@@ -356,19 +365,19 @@
def test_chrome_histogram_hashes(self):
return DiffTestBlueprint(
trace=Path('chrome_histogram_hashes.textproto'),
- query=Path('chrome_histogram_hashes'),
+ query=Metric('chrome_histogram_hashes'),
out=Path('chrome_histogram_hashes.out'))
def test_chrome_user_event_hashes(self):
return DiffTestBlueprint(
trace=Path('chrome_user_event_hashes.textproto'),
- query=Path('chrome_user_event_hashes'),
+ query=Metric('chrome_user_event_hashes'),
out=Path('chrome_user_event_hashes.out'))
def test_chrome_performance_mark_hashes(self):
return DiffTestBlueprint(
trace=Path('chrome_performance_mark_hashes.textproto'),
- query=Path('chrome_performance_mark_hashes'),
+ query=Metric('chrome_performance_mark_hashes'),
out=Path('chrome_performance_mark_hashes.out'))
def test_chrome_reliable_range(self):
@@ -392,7 +401,7 @@
def test_chrome_slice_names(self):
return DiffTestBlueprint(
trace=Path('chrome_slice_names.textproto'),
- query=Path('chrome_slice_names'),
+ query=Metric('chrome_slice_names'),
out=Path('chrome_slice_names.out'))
def test_chrome_tasks(self):
@@ -403,6 +412,15 @@
query=Path('chrome_tasks_test.sql'),
out=Path('chrome_tasks.out'))
+ def test_top_level_java_choreographer_slices_top_level_java_chrome_tasks_test(
+ self):
+ return DiffTestBlueprint(
+ trace=Path('../../data/top_level_java_choreographer_slices'),
+ query=Path('top_level_java_chrome_tasks_test.sql'),
+ out=Path(
+ 'top_level_java_choreographer_slices_top_level_java_chrome_tasks_test.out'
+ ))
+
def test_chrome_stack_samples_for_task_test(self):
return DiffTestBlueprint(
trace=Path('../../data/chrome_stack_traces_symbolized_trace.pftrace'),
@@ -412,7 +430,7 @@
def test_unsymbolized_args(self):
return DiffTestBlueprint(
trace=Path('unsymbolized_args.textproto'),
- query=Path('chrome_unsymbolized_args'),
+ query=Metric('chrome_unsymbolized_args'),
out=Path('unsymbolized_args.out'))
def test_async_trace_1_count_slices(self):
@@ -430,7 +448,7 @@
def test_chrome_args_class_names(self):
return DiffTestBlueprint(
trace=Path('chrome_args_class_names.textproto'),
- query=Path('chrome_args_class_names'),
+ query=Metric('chrome_args_class_names'),
out=Path('chrome_args_class_names.out'))
def test_chrome_log_message(self):
diff --git a/test/trace_processor/cros/index.py b/test/trace_processor/cros/index.py
index 49de248..6d257d0 100644
--- a/test/trace_processor/cros/index.py
+++ b/test/trace_processor/cros/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/dynamic/index.py b/test/trace_processor/dynamic/index.py
index 6cc2019..8ec4aba 100644
--- a/test/trace_processor/dynamic/index.py
+++ b/test/trace_processor/dynamic/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/fs/index.py b/test/trace_processor/fs/index.py
index c2c952b..5b303e2 100644
--- a/test/trace_processor/fs/index.py
+++ b/test/trace_processor/fs/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/fuchsia/index.py b/test/trace_processor/fuchsia/index.py
index 65c8f4c..f67ecd8 100644
--- a/test/trace_processor/fuchsia/index.py
+++ b/test/trace_processor/fuchsia/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/functions/index.py b/test/trace_processor/functions/index.py
index 45872e3..57776a4 100644
--- a/test/trace_processor/functions/index.py
+++ b/test/trace_processor/functions/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/graphics/index.py b/test/trace_processor/graphics/index.py
index f5b7421..5aa2b39 100644
--- a/test/trace_processor/graphics/index.py
+++ b/test/trace_processor/graphics/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -89,31 +89,31 @@
def test_frame_missed_metrics(self):
return DiffTestBlueprint(
trace=Path('frame_missed.py'),
- query=Path('android_surfaceflinger'),
+ query=Metric('android_surfaceflinger'),
out=Path('frame_missed_metrics.out'))
def test_surfaceflinger_gpu_invocation(self):
return DiffTestBlueprint(
trace=Path('surfaceflinger_gpu_invocation.py'),
- query=Path('android_surfaceflinger'),
+ query=Metric('android_surfaceflinger'),
out=Path('surfaceflinger_gpu_invocation.out'))
def test_gpu_metric(self):
return DiffTestBlueprint(
trace=Path('gpu_metric.py'),
- query=Path('android_gpu'),
+ query=Metric('android_gpu'),
out=Path('gpu_metric.out'))
def test_gpu_frequency_metric(self):
return DiffTestBlueprint(
trace=Path('gpu_frequency_metric.textproto'),
- query=Path('android_gpu'),
+ query=Metric('android_gpu'),
out=Path('gpu_frequency_metric.out'))
def test_android_jank_cuj(self):
return DiffTestBlueprint(
trace=Path('android_jank_cuj.py'),
- query=Path('android_jank_cuj'),
+ query=Metric('android_jank_cuj'),
out=Path('android_jank_cuj.out'))
def test_android_jank_cuj_query(self):
@@ -143,7 +143,7 @@
def test_g2d_metrics(self):
return DiffTestBlueprint(
trace=Path('g2d_metrics.textproto'),
- query=Path('g2d'),
+ query=Metric('g2d'),
out=Path('g2d_metrics.out'))
def test_composer_execution(self):
@@ -155,13 +155,13 @@
def test_display_metrics(self):
return DiffTestBlueprint(
trace=Path('display_metrics.py'),
- query=Path('display_metrics'),
+ query=Metric('display_metrics'),
out=Path('display_metrics.out'))
def test_dpu_vote_clock_bw(self):
return DiffTestBlueprint(
trace=Path('dpu_vote_clock_bw.textproto'),
- query=Path('android_hwcomposer'),
+ query=Metric('android_hwcomposer'),
out=Path('dpu_vote_clock_bw.out'))
def test_drm_vblank_gpu_track(self):
diff --git a/test/trace_processor/include_index.py b/test/trace_processor/include_index.py
index 3b89f2b..735f66c 100644
--- a/test/trace_processor/include_index.py
+++ b/test/trace_processor/include_index.py
@@ -15,6 +15,7 @@
from typing import List
from python.generators.diff_tests import testing
+
from android.index import DiffTestModule_Android
from atrace.index import DiffTestModule_Atrace
from camera.index import DiffTestModule_Camera
@@ -41,7 +42,6 @@
from track_event.index import DiffTestModule_Track_event
from translation.index import DiffTestModule_Translation
-
def fetch_all_diff_tests(include_index_path: str) -> List['testing.DiffTest']:
diff_tests = []
diff_tests.extend(
diff --git a/test/trace_processor/memory/index.py b/test/trace_processor/memory/index.py
index ae49033..41c0ee5 100644
--- a/test/trace_processor/memory/index.py
+++ b/test/trace_processor/memory/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -23,55 +23,55 @@
def test_android_mem_counters(self):
return DiffTestBlueprint(
trace=Path('../../data/memory_counters.pb'),
- query=Path('android_mem'),
+ query=Metric('android_mem'),
out=Path('android_mem_counters.out'))
def test_trace_metadata(self):
return DiffTestBlueprint(
trace=Path('../../data/memory_counters.pb'),
- query=Path('trace_metadata'),
+ query=Metric('trace_metadata'),
out=Path('trace_metadata.out'))
def test_android_mem_by_priority(self):
return DiffTestBlueprint(
trace=Path('android_mem_by_priority.py'),
- query=Path('android_mem'),
+ query=Metric('android_mem'),
out=Path('android_mem_by_priority.out'))
def test_android_mem_lmk(self):
return DiffTestBlueprint(
trace=Path('android_systrace_lmk.py'),
- query=Path('android_lmk'),
+ query=Metric('android_lmk'),
out=Path('android_mem_lmk.out'))
def test_android_lmk_oom(self):
return DiffTestBlueprint(
trace=Path('../common/oom_kill.textproto'),
- query=Path('android_lmk'),
+ query=Metric('android_lmk'),
out=Path('android_lmk_oom.out'))
def test_android_mem_delta(self):
return DiffTestBlueprint(
trace=Path('android_mem_delta.py'),
- query=Path('android_mem'),
+ query=Metric('android_mem'),
out=Path('android_mem_delta.out'))
def test_android_ion(self):
return DiffTestBlueprint(
trace=Path('android_ion.py'),
- query=Path('android_ion'),
+ query=Metric('android_ion'),
out=Path('android_ion.out'))
def test_android_ion_stat(self):
return DiffTestBlueprint(
trace=Path('android_ion_stat.textproto'),
- query=Path('android_ion'),
+ query=Metric('android_ion'),
out=Path('android_ion_stat.out'))
def test_android_dma_heap_stat(self):
return DiffTestBlueprint(
trace=Path('android_dma_heap_stat.textproto'),
- query=Path('android_dma_heap'),
+ query=Metric('android_dma_heap'),
out=Path('android_dma_heap_stat.out'))
def test_android_dma_buffer_tracks(self):
@@ -83,7 +83,7 @@
def test_android_fastrpc_dma_stat(self):
return DiffTestBlueprint(
trace=Path('android_fastrpc_dma_stat.textproto'),
- query=Path('android_fastrpc'),
+ query=Metric('android_fastrpc'),
out=Path('android_fastrpc_dma_stat.out'))
def test_shrink_slab(self):
diff --git a/test/trace_processor/network/index.py b/test/trace_processor/network/index.py
index 53ea2ca..8edc34c 100644
--- a/test/trace_processor/network/index.py
+++ b/test/trace_processor/network/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -35,7 +35,7 @@
def test_netperf_metric(self):
return DiffTestBlueprint(
trace=Path('netperf_metric.textproto'),
- query=Path('android_netperf'),
+ query=Metric('android_netperf'),
out=Path('netperf_metric.out'))
def test_inet_sock_set_state(self):
diff --git a/test/trace_processor/parsing/index.py b/test/trace_processor/parsing/index.py
index dcdf375..5eef02a 100644
--- a/test/trace_processor/parsing/index.py
+++ b/test/trace_processor/parsing/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -299,7 +299,7 @@
def test_android_package_list(self):
return DiffTestBlueprint(
trace=Path('android_package_list.py'),
- query=Path('android_package_list'),
+ query=Metric('android_package_list'),
out=Path('android_package_list.out'))
def test_process_metadata_matching(self):
@@ -373,7 +373,7 @@
def test_very_long_sched_android_trace_quality(self):
return DiffTestBlueprint(
trace=Path('very_long_sched.py'),
- query=Path('android_trace_quality'),
+ query=Metric('android_trace_quality'),
out=Path('very_long_sched_android_trace_quality.out'))
def test_sched_smoke_trailing_empty_2(self):
@@ -385,7 +385,7 @@
def test_android_multiuser_switch(self):
return DiffTestBlueprint(
trace=Path('android_multiuser_switch.textproto'),
- query=Path('android_multiuser'),
+ query=Metric('android_multiuser'),
out=Path('android_multiuser_switch.out'))
def test_atrace_compressed_sched_count(self):
@@ -403,13 +403,13 @@
def test_otheruuids_android_other_traces(self):
return DiffTestBlueprint(
trace=Path('otheruuids.textproto'),
- query=Path('android_other_traces'),
+ query=Metric('android_other_traces'),
out=Path('otheruuids_android_other_traces.out'))
def test_android_binder(self):
return DiffTestBlueprint(
trace=Path('android_binder.py'),
- query=Path('android_binder'),
+ query=Metric('android_binder'),
out=Path('android_binder.out'))
def test_statsd_atoms_all_atoms(self):
diff --git a/test/trace_processor/performance/index.py b/test/trace_processor/performance/index.py
index 4aec12f..e098caa 100644
--- a/test/trace_processor/performance/index.py
+++ b/test/trace_processor/performance/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -23,7 +23,7 @@
def test_irq_runtime_metric(self):
return DiffTestBlueprint(
trace=Path('irq_runtime_metric.textproto'),
- query=Path('android_irq_runtime'),
+ query=Metric('android_irq_runtime'),
out=Path('irq_runtime_metric.out'))
def test_cpu_frequency_limits(self):
@@ -35,5 +35,5 @@
def test_frame_timeline_metric(self):
return DiffTestBlueprint(
trace=Path('frame_timeline_metric.py'),
- query=Path('android_frame_timeline_metric'),
+ query=Metric('android_frame_timeline_metric'),
out=Path('frame_timeline_metric.out'))
diff --git a/test/trace_processor/power/index.py b/test/trace_processor/power/index.py
index fd74829..f606c6a 100644
--- a/test/trace_processor/power/index.py
+++ b/test/trace_processor/power/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -47,7 +47,7 @@
def test_dvfs_metric(self):
return DiffTestBlueprint(
trace=Path('dvfs_metric.textproto'),
- query=Path('android_dvfs'),
+ query=Metric('android_dvfs'),
out=Path('dvfs_metric.out'))
def test_wakesource_wakesource(self):
@@ -65,7 +65,7 @@
def test_suspend_period(self):
return DiffTestBlueprint(
trace=Path('suspend_period.textproto'),
- query=Path('android_batt'),
+ query=Metric('android_batt'),
out=Path('suspend_period.out'))
def test_energy_breakdown_table_test(self):
diff --git a/test/trace_processor/process_tracking/index.py b/test/trace_processor/process_tracking/index.py
index 298fe6d..96de2e5 100644
--- a/test/trace_processor/process_tracking/index.py
+++ b/test/trace_processor/process_tracking/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -73,3 +73,9 @@
trace=Path('sde_tracing_mark_write.textproto'),
query=Path('slice_with_pid_test.sql'),
out=Path('slice_with_pid_sde_tracing_mark_write.out'))
+
+ def test_unknown_thread_name_tracking(self):
+ return DiffTestBlueprint(
+ trace=Path('unknown_thread_name.systrace'),
+ query=Path('../common/process_tracking_test.sql'),
+ out=Path('unknown_thread_name_tracking.out'))
diff --git a/test/trace_processor/profiling/index.py b/test/trace_processor/profiling/index.py
index 3d52bcf..660e446 100644
--- a/test/trace_processor/profiling/index.py
+++ b/test/trace_processor/profiling/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -59,7 +59,7 @@
def test_profiler_smaps_metric(self):
return DiffTestBlueprint(
trace=Path('profiler_smaps.textproto'),
- query=Path('profiler_smaps'),
+ query=Metric('profiler_smaps'),
out=Path('profiler_smaps_metric.out'))
def test_heap_graph_flamegraph(self):
@@ -203,31 +203,31 @@
def test_unsymbolized_frames(self):
return DiffTestBlueprint(
trace=Path('heap_profile_no_symbols.textproto'),
- query=Path('unsymbolized_frames'),
+ query=Metric('unsymbolized_frames'),
out=Path('unsymbolized_frames.out'))
def test_simpleperf_event(self):
return DiffTestBlueprint(
trace=Path('simpleperf_event.py'),
- query=Path('android_simpleperf'),
+ query=Metric('android_simpleperf'),
out=Path('simpleperf_event.out'))
def test_java_heap_stats(self):
return DiffTestBlueprint(
trace=Path('heap_graph.textproto'),
- query=Path('java_heap_stats'),
+ query=Metric('java_heap_stats'),
out=Path('java_heap_stats.out'))
def test_heap_stats_closest_proc(self):
return DiffTestBlueprint(
trace=Path('heap_graph_closest_proc.textproto'),
- query=Path('java_heap_stats'),
+ query=Metric('java_heap_stats'),
out=Path('heap_stats_closest_proc.out'))
def test_java_heap_histogram(self):
return DiffTestBlueprint(
trace=Path('heap_graph.textproto'),
- query=Path('java_heap_histogram'),
+ query=Metric('java_heap_histogram'),
out=Path('java_heap_histogram.out'))
def test_perf_sample_rvc(self):
diff --git a/test/trace_processor/scheduler/index.py b/test/trace_processor/scheduler/index.py
index 38276df..679e39c 100644
--- a/test/trace_processor/scheduler/index.py
+++ b/test/trace_processor/scheduler/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/smoke/index.py b/test/trace_processor/smoke/index.py
index 9df56b9..0118833 100644
--- a/test/trace_processor/smoke/index.py
+++ b/test/trace_processor/smoke/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/span_join/index.py b/test/trace_processor/span_join/index.py
index 56fce6a..82557d9 100644
--- a/test/trace_processor/span_join/index.py
+++ b/test/trace_processor/span_join/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/startup/index.py b/test/trace_processor/startup/index.py
index 0379121..16c537c 100644
--- a/test/trace_processor/startup/index.py
+++ b/test/trace_processor/startup/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -23,107 +23,107 @@
def test_android_startup(self):
return DiffTestBlueprint(
trace=Path('android_startup.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup.out'))
def test_android_startup_slow(self):
return DiffTestBlueprint(
trace=Path('android_startup_slow.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_slow.out'))
def test_android_startup_minsdk33(self):
return DiffTestBlueprint(
trace=Path('android_startup_minsdk33.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_minsdk33.out'))
def test_android_startup_breakdown(self):
return DiffTestBlueprint(
trace=Path('android_startup_breakdown.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_breakdown.out'))
def test_android_startup_breakdown_slow(self):
return DiffTestBlueprint(
trace=Path('android_startup_breakdown_slow.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_breakdown_slow.out'))
def test_android_startup_process_track(self):
return DiffTestBlueprint(
trace=Path('android_startup_process_track.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_process_track.out'))
def test_android_startup_attribution(self):
return DiffTestBlueprint(
trace=Path('android_startup_attribution.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_attribution.out'))
def test_android_startup_attribution_slow(self):
return DiffTestBlueprint(
trace=Path('android_startup_attribution_slow.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_attribution_slow.out'))
def test_android_startup_lock_contention(self):
return DiffTestBlueprint(
trace=Path('android_startup_lock_contention.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_lock_contention.out'))
def test_android_startup_lock_contention_slow(self):
return DiffTestBlueprint(
trace=Path('android_startup_lock_contention_slow.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_lock_contention_slow.out'))
def test_android_startup_installd_dex2oat(self):
return DiffTestBlueprint(
trace=Path('android_startup_installd_dex2oat.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_installd_dex2oat.out'))
def test_android_startup_installd_dex2oat_slow(self):
return DiffTestBlueprint(
trace=Path('android_startup_installd_dex2oat_slow.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_installd_dex2oat_slow.out'))
def test_android_startup_unlock(self):
return DiffTestBlueprint(
trace=Path('android_startup_unlock.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_unlock.out'))
def test_android_startup_broadcast(self):
return DiffTestBlueprint(
trace=Path('android_startup_broadcast.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_broadcast.out'))
def test_android_startup_broadcast_multiple(self):
return DiffTestBlueprint(
trace=Path('android_startup_broadcast_multiple.py'),
- query=Path('android_startup'),
+ query=Metric('android_startup'),
out=Path('android_startup_broadcast_multiple.out'))
def test_android_batt_counters(self):
return DiffTestBlueprint(
trace=Path('android_startup_battery.py'),
- query=Path('android_batt'),
+ query=Metric('android_batt'),
out=Path('android_batt_counters.out'))
def test_android_startup_cpu(self):
return DiffTestBlueprint(
trace=Path('android_startup_cpu.py'),
- query=Path('android_cpu'),
+ query=Metric('android_cpu'),
out=Path('android_startup_cpu.out'))
def test_android_startup_powrails(self):
return DiffTestBlueprint(
trace=Path('android_startup_powrails.py'),
- query=Path('android_powrails'),
+ query=Metric('android_powrails'),
out=Path('android_startup_powrails.out'))
diff --git a/test/trace_processor/tables/index.py b/test/trace_processor/tables/index.py
index 9042f3b..408c18e 100644
--- a/test/trace_processor/tables/index.py
+++ b/test/trace_processor/tables/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
@@ -95,13 +95,13 @@
def test_trace_metadata(self):
return DiffTestBlueprint(
trace=Path('../../data/memory_counters.pb'),
- query=Path('trace_metadata'),
+ query=Metric('trace_metadata'),
out=Path('trace_metadata.json.out'))
def test_android_task_names(self):
return DiffTestBlueprint(
trace=Path('process_uids.textproto'),
- query=Path('android_task_names'),
+ query=Metric('android_task_names'),
out=Path('android_task_names.out'))
def test_ftrace_setup_errors(self):
diff --git a/test/trace_processor/track_event/index.py b/test/trace_processor/track_event/index.py
index 4ff0537..f4b76ad 100644
--- a/test/trace_processor/track_event/index.py
+++ b/test/trace_processor/track_event/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/translation/index.py b/test/trace_processor/translation/index.py
index d535f3c..e00f233 100644
--- a/test/trace_processor/translation/index.py
+++ b/test/trace_processor/translation/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/test/trace_processor/ufs/index.py b/test/trace_processor/ufs/index.py
index 9b12767..72050df 100644
--- a/test/trace_processor/ufs/index.py
+++ b/test/trace_processor/ufs/index.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from python.generators.diff_tests.testing import Path
+from python.generators.diff_tests.testing import Path, Metric
from python.generators.diff_tests.testing import DiffTestBlueprint
from python.generators.diff_tests.testing import DiffTestModule
diff --git a/tools/diff_test_trace_processor.py b/tools/diff_test_trace_processor.py
index cf22882..2c66ea1 100755
--- a/tools/diff_test_trace_processor.py
+++ b/tools/diff_test_trace_processor.py
@@ -28,7 +28,7 @@
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(ROOT_DIR))
-from python.generators.diff_tests.testing import DiffTest
+from python.generators.diff_tests.testing import TestType
from python.generators.diff_tests.utils import ctrl_c_handler
from python.generators.diff_tests.runner import DiffTestSuiteRunner
@@ -91,7 +91,7 @@
trace_short_path = os.path.relpath(perf_args.trace_path, test_dir)
query_short_path_or_metric = perf_args.query_path_or_metric
- if perf_args.test_type == DiffTest.TestType.QUERY:
+ if perf_args.test_type == TestType.QUERY:
query_short_path_or_metric = os.path.relpath(
perf_args.query_path_or_metric, trace_processor_dir)