1// Build the unit tests.
2package {
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "frameworks_native_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["frameworks_native_license"],
9}
10
11cc_test {
12    name: "libinput_tests",
13    cpp_std: "c++20",
14    host_supported: true,
15    srcs: [
16        "BlockingQueue_test.cpp",
17        "IdGenerator_test.cpp",
18        "InputChannel_test.cpp",
19        "InputDevice_test.cpp",
20        "InputEvent_test.cpp",
21        "InputPublisherAndConsumer_test.cpp",
22        "InputPublisherAndConsumerNoResampling_test.cpp",
23        "InputVerifier_test.cpp",
24        "MotionPredictor_test.cpp",
25        "MotionPredictorMetricsManager_test.cpp",
26        "RingBuffer_test.cpp",
27        "TfLiteMotionPredictor_test.cpp",
28        "TouchResampling_test.cpp",
29        "TouchVideoFrame_test.cpp",
30        "VelocityControl_test.cpp",
31        "VelocityTracker_test.cpp",
32        "VerifiedInputEvent_test.cpp",
33    ],
34    header_libs: [
35        "flatbuffer_headers",
36        "tensorflow_headers",
37    ],
38    static_libs: [
39        "libflagtest",
40        "libgmock",
41        "libgui_window_info_static",
42        "libinput",
43        "libkernelconfigs",
44        "libtflite_static",
45        "libui-types",
46        "libz", // needed by libkernelconfigs
47    ],
48    cflags: [
49        "-Wall",
50        "-Wextra",
51        "-Werror",
52        "-Wno-unused-parameter",
53    ],
54    sanitize: {
55        hwaddress: true,
56        undefined: true,
57        all_undefined: true,
58        diag: {
59            undefined: true,
60        },
61    },
62    shared_libs: [
63        "libbase",
64        "libbinder",
65        "libcutils",
66        "liblog",
67        "libPlatformProperties",
68        "libstatslog",
69        "libtinyxml2",
70        "libutils",
71        "server_configurable_flags",
72    ],
73    data: [
74        "data/*",
75        ":motion_predictor_model",
76    ],
77    test_options: {
78        unit_test: true,
79    },
80    test_suites: ["device-tests"],
81    target: {
82        android: {
83            static_libs: [
84                "libstatslog_libinput",
85                "libstatssocket_lazy",
86            ],
87        },
88        host: {
89            sanitize: {
90                address: true,
91            },
92        },
93    },
94}
95
96// NOTE: This is a compile time test, and does not need to be
97// run. All assertions are static_asserts and will fail during
98// buildtime if something's wrong.
99cc_library_static {
100    name: "StructLayout_test",
101    srcs: ["StructLayout_test.cpp"],
102    compile_multilib: "both",
103    cflags: [
104        "-Wall",
105        "-Werror",
106        "-Wextra",
107    ],
108    shared_libs: [
109        "libinput",
110        "libcutils",
111        "libutils",
112        "libbinder",
113        "libbase",
114    ],
115}
116