1// Copyright 2020 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 15package { 16 // See: http://go/android-license-faq 17 // A large-scale-change added 'default_applicable_licenses' to import 18 // all of the 'license_kinds' from "frameworks_native_license" 19 // to get the below license kinds: 20 // SPDX-license-identifier-Apache-2.0 21 default_applicable_licenses: ["frameworks_native_license"], 22} 23 24cc_aconfig_library { 25 name: "gpuservice_unittest_flags_c_lib", 26 aconfig_declarations: "graphicsenv_flags", 27} 28 29genrule_defaults { 30 name: "gpuservice_unittest_feature_config_pb_defaults", 31 tools: ["aprotoc"], 32 tool_files: [ 33 ":feature_config_proto_definitions", 34 ], 35 cmd: "$(location aprotoc) " + 36 "--encode=feature_override.FeatureOverrideProtos " + 37 "$(locations :feature_config_proto_definitions) " + 38 "< $(in) " + 39 "> $(out) ", 40} 41 42// Main protobuf used by the unit tests. 43filegroup { 44 name: "gpuservice_unittest_feature_config_vk_prototext", 45 srcs: [ 46 "data/feature_config_test.txtpb", 47 ], 48} 49 50genrule { 51 name: "gpuservice_unittest_feature_config_vk_binarypb", 52 defaults: ["gpuservice_unittest_feature_config_pb_defaults"], 53 srcs: [ 54 ":gpuservice_unittest_feature_config_vk_prototext", 55 ], 56 out: ["gpuservice_unittest_feature_config_vk.binarypb"], 57} 58 59// "Updated" protobuf, used to validate forceFileRead(). 60filegroup { 61 name: "gpuservice_unittest_feature_config_vk_force_read_prototext", 62 srcs: [ 63 "data/feature_config_test_force_read.txtpb", 64 ], 65} 66 67genrule { 68 name: "gpuservice_unittest_feature_config_vk_force_read_binarypb", 69 defaults: ["gpuservice_unittest_feature_config_pb_defaults"], 70 srcs: [ 71 ":gpuservice_unittest_feature_config_vk_force_read_prototext", 72 ], 73 out: ["gpuservice_unittest_feature_config_vk_force_read.binarypb"], 74} 75 76cc_test { 77 name: "gpuservice_unittest", 78 test_suites: ["device-tests"], 79 defaults: [ 80 "aconfig_lib_cc_static_link.defaults", 81 "libgpuservice_defaults", 82 ], 83 srcs: [ 84 "FeatureOverrideParserTest.cpp", 85 "GpuMemTest.cpp", 86 "GpuMemTracerTest.cpp", 87 "GpuServiceTest.cpp", 88 "GpuStatsTest.cpp", 89 ], 90 header_libs: ["bpf_headers"], 91 shared_libs: [ 92 "gpuservice_multiuser_flags_c_lib", 93 "libbase", 94 "libbinder", 95 "libbpf_bcc", 96 "libcutils", 97 "libgraphicsenv", 98 "liblog", 99 "libprotobuf-cpp-lite", 100 "libprotoutil", 101 "libstatslog", 102 "libstatspull", 103 "libutils", 104 ], 105 static_libs: [ 106 "gpuservice_unittest_flags_c_lib", 107 "libgmock", 108 "libgpuservice", 109 "libperfetto_client_experimental", 110 "perfetto_trace_protos", 111 ], 112 data: [ 113 ":gpuservice_unittest_feature_config_vk_binarypb", 114 ":gpuservice_unittest_feature_config_vk_force_read_binarypb", 115 ], 116 require_root: true, 117} 118