xref: /aosp_15_r20/platform_testing/scripts/perf-setup/Android.bp (revision dd0948b35e70be4c0246aabd6c72554a5eb8b22a)
1//
2// Copyright (C) 2016 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16// Rules to generate setup script for device perf tests
17// Different devices may share the same script. To add a new script, define a
18// new variable named <device name>_script, pointing at the script in current
19// source folder.
20// At execution time, scripts will be pushed onto device and run with root
21// identity.
22
23// Only define the target if a perf setup script is defined by the BoardConfig
24// of the device we are building.
25//
26// To add a new script:
27// 1. add a new setup script suitable for the device at:
28//    platform_testing/scripts/perf-setup/
29// 2. modify BoardConfig.mk of the corresponding device under:
30//    device/<OEM name>/<device name/
31// 3. add variable "BOARD_PERFSETUP_SCRIPT", and point it at the path to the new
32//    perf setup script; the path should be relative to the build root
33// 4. add below soong config setting below the line added on step 3:
34//    $(call soong_config_set,perf,board_perfsetup_script,$(notdir $(BOARD_PERFSETUP_SCRIPT)))
35
36package {
37    // See: http://go/android-license-faq
38    default_applicable_licenses: [
39        "Android-Apache-2.0",
40    ],
41    default_team: "trendy_team_performance",
42}
43
44soong_config_module_type {
45    name: "perf_script_filegroup",
46    module_type: "filegroup",
47    config_namespace: "perf",
48    value_variables: [
49        "board_perfsetup_script",
50    ],
51    properties: [
52        "srcs",
53    ],
54}
55
56perf_script_filegroup {
57    name: "perf-setup-script",
58    soong_config_variables: {
59        board_perfsetup_script: {
60            srcs: ["%s"],
61            conditions_default: {
62                srcs: ["empty-setup.sh"],
63            },
64        },
65    },
66}
67
68sh_test {
69    name: "perf-setup",
70    src: ":perf-setup-script",
71    filename: "perf-setup.sh",
72    test_suites: [
73        "device-tests",
74        "device-pixel-tests",
75    ],
76    auto_gen_config: false,
77    product_variables: {
78        debuggable: {
79            required: [
80                "perf-setup-sh",
81            ],
82        },
83    },
84}
85
86sh_binary {
87    name: "perf-setup-sh",
88    src: ":perf-setup-script",
89    filename: "perf-setup.sh",
90    soc_specific: true,
91}
92