1// Copyright 2018 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_test {
25    name: "libsurfaceflinger_unittest",
26    defaults: ["surfaceflinger_defaults"],
27    test_suites: ["device-tests"],
28    sanitize: {
29        // Using the address sanitizer not only helps uncover issues in the code
30        // covered by the tests, but also covers some of the tricky injection of
31        // fakes the unit tests currently do.
32        //
33        // Note: If you get an runtime link error like:
34        //
35        //   CANNOT LINK EXECUTABLE "/data/local/tmp/libsurfaceflinger_unittest": library "libclang_rt.asan-aarch64-android.so" not found
36        //
37        // it is because the address sanitizer shared objects are not installed
38        // by default in the system image.
39        //
40        // You can either "make dist tests" before flashing, or set this
41        // option to false temporarily.
42        address: true,
43    },
44    srcs: [
45        ":libsurfaceflinger_sources",
46        "libsurfaceflinger_unittest_main.cpp",
47        "CachingTest.cpp",
48        "CompositionTest.cpp",
49        "DispSyncSourceTest.cpp",
50        "DisplayIdentificationTest.cpp",
51        "DisplayIdGeneratorTest.cpp",
52        "DisplayTransactionTest.cpp",
53        "DisplayDevice_GetBestColorModeTest.cpp",
54        "DisplayDevice_InitiateModeChange.cpp",
55        "DisplayDevice_SetProjectionTest.cpp",
56        "EventThreadTest.cpp",
57        "FpsReporterTest.cpp",
58        "FpsTest.cpp",
59        "FramebufferSurfaceTest.cpp",
60        "FrameTimelineTest.cpp",
61        "GameModeTest.cpp",
62        "HWComposerTest.cpp",
63        "OneShotTimerTest.cpp",
64        "LayerHistoryTest.cpp",
65        "LayerInfoTest.cpp",
66        "LayerMetadataTest.cpp",
67        "MessageQueueTest.cpp",
68        "SurfaceFlinger_CreateDisplayTest.cpp",
69        "SurfaceFlinger_DestroyDisplayTest.cpp",
70        "SurfaceFlinger_GetDisplayNativePrimariesTest.cpp",
71        "SurfaceFlinger_HandleTransactionLockedTest.cpp",
72        "SurfaceFlinger_NotifyPowerBoostTest.cpp",
73        "SurfaceFlinger_HotplugTest.cpp",
74        "SurfaceFlinger_OnInitializeDisplaysTest.cpp",
75        "SurfaceFlinger_SetDisplayStateTest.cpp",
76        "SurfaceFlinger_SetPowerModeInternalTest.cpp",
77        "SurfaceFlinger_SetupNewDisplayDeviceInternalTest.cpp",
78        "SchedulerTest.cpp",
79        "SchedulerUtilsTest.cpp",
80        "SetFrameRateTest.cpp",
81        "RefreshRateConfigsTest.cpp",
82        "RefreshRateSelectionTest.cpp",
83        "RefreshRateStatsTest.cpp",
84        "RegionSamplingTest.cpp",
85        "TimeStatsTest.cpp",
86        "FrameTracerTest.cpp",
87        "TimerTest.cpp",
88        "TransactionApplicationTest.cpp",
89        "TransactionFrameTracerTest.cpp",
90        "TransactionSurfaceFrameTest.cpp",
91        "TunnelModeEnabledReporterTest.cpp",
92        "StrongTypingTest.cpp",
93        "VSyncDispatchTimerQueueTest.cpp",
94        "VSyncDispatchRealtimeTest.cpp",
95        "VsyncModulatorTest.cpp",
96        "VSyncPredictorTest.cpp",
97        "VSyncReactorTest.cpp",
98        "VsyncConfigurationTest.cpp",
99        "mock/DisplayHardware/MockComposer.cpp",
100        "mock/DisplayHardware/MockHWC2.cpp",
101        "mock/DisplayHardware/MockPowerAdvisor.cpp",
102        "mock/MockEventThread.cpp",
103        "mock/MockFrameTimeline.cpp",
104        "mock/MockFrameTracer.cpp",
105        "mock/MockMessageQueue.cpp",
106        "mock/MockNativeWindowSurface.cpp",
107        "mock/MockSurfaceInterceptor.cpp",
108        "mock/MockTimeStats.cpp",
109        "mock/MockVsyncController.cpp",
110        "mock/MockVSyncTracker.cpp",
111        "mock/system/window/MockNativeWindow.cpp",
112    ],
113    static_libs: [
114        "android.hardware.graphics.composer@2.1",
115        "android.hardware.graphics.composer@2.2",
116        "android.hardware.graphics.composer@2.3",
117        "android.hardware.graphics.composer@2.4",
118        "android.hardware.power@1.0",
119        "android.hardware.power@1.1",
120        "android.hardware.power@1.2",
121        "android.hardware.power@1.3",
122        "android.hardware.power-V1-cpp",
123        "libcompositionengine_mocks",
124        "libcompositionengine",
125        "libframetimeline",
126        "libgmock",
127        "libgui_mocks",
128        "liblayers_proto",
129        "libperfetto_client_experimental",
130        "librenderengine_mocks",
131        "librenderengine",
132        "libserviceutils",
133        "libtimestats",
134        "libtimestats_atoms_proto",
135        "libtimestats_proto",
136        "libtrace_proto",
137        "perfetto_trace_protos",
138    ],
139    shared_libs: [
140        "android.hardware.configstore-utils",
141        "android.hardware.configstore@1.0",
142        "android.hardware.configstore@1.1",
143        "android.hardware.graphics.allocator@2.0",
144        "android.hardware.graphics.allocator@3.0",
145        "android.hardware.graphics.common@1.2",
146        "libbase",
147        "libbinder",
148        "libcutils",
149        "libEGL",
150        "libfmq",
151        "libGLESv1_CM",
152        "libGLESv2",
153        "libgui",
154        "libhidlbase",
155        "libinput",
156        "liblog",
157        "libnativewindow",
158        "libprocessgroup",
159        "libprotobuf-cpp-lite",
160        "libSurfaceFlingerProp",
161        "libsync",
162        "libui",
163        "libutils",
164    ],
165    header_libs: [
166        "android.hardware.graphics.composer@2.1-command-buffer",
167        "android.hardware.graphics.composer@2.2-command-buffer",
168        "android.hardware.graphics.composer@2.3-command-buffer",
169        "android.hardware.graphics.composer@2.4-command-buffer",
170        "libsurfaceflinger_headers",
171    ],
172}
173