1# Copyright (C) 2022 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Contains tables for unittesting.""" 15 16from python.generators.trace_processor_table.public import Column as C 17from python.generators.trace_processor_table.public import ColumnFlag 18from python.generators.trace_processor_table.public import CppInt64 19from python.generators.trace_processor_table.public import Table 20from python.generators.trace_processor_table.public import CppUint32 21 22EVENT_TABLE = Table( 23 python_module=__file__, 24 class_name="TestEventTable", 25 sql_name="event", 26 columns=[ 27 C("ts", CppInt64(), flags=ColumnFlag.SORTED), 28 C("arg_set_id", CppUint32()), 29 ]) 30 31EVENT_CHILD_TABLE = Table( 32 python_module=__file__, 33 class_name="TestEventChildTable", 34 sql_name="event", 35 parent=EVENT_TABLE, 36 columns=[]) 37 38SLICE_TABLE = Table( 39 python_module=__file__, 40 class_name="TestSliceTable", 41 sql_name="slice", 42 parent=EVENT_TABLE, 43 columns=[ 44 C("dur", CppInt64()), 45 ]) 46 47ARGS_TABLE = Table( 48 python_module=__file__, 49 class_name="TestArgsTable", 50 sql_name="args", 51 columns=[ 52 C("arg_set_id", 53 CppUint32(), 54 flags=ColumnFlag.SET_ID | ColumnFlag.SORTED), 55 C("int_value", CppInt64()), 56 ]) 57 58# Keep this list sorted. 59ALL_TABLES = [ 60 ARGS_TABLE, 61 EVENT_TABLE, 62 EVENT_CHILD_TABLE, 63 SLICE_TABLE, 64] 65