| # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/config/fuchsia/rules.gni") |
| import("//build/fuzzing/fuzzer.gni") |
| import("//build/test.gni") |
| |
| driver_bind_rules("goldfish_sensor-bind") { |
| rules = "goldfish_sensor.bind" |
| tests = "bind_tests.json" |
| deps = [ |
| "//src/devices/bind/fuchsia.goldfish", |
| "//src/devices/bind/fuchsia.google.platform", |
| ] |
| } |
| |
| common_deps = [ |
| ":goldfish_sensor-bind", |
| "//sdk/banjo/fuchsia.hardware.goldfish.pipe:fuchsia.hardware.goldfish.pipe_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.goldfish:fuchsia.hardware.goldfish_llcpp", |
| "//sdk/fidl/fuchsia.input.report:fuchsia.input.report_llcpp", |
| "//sdk/lib/syslog/cpp:backend_legacy", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/goldfish/pipe_io", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//src/lib/fsl", |
| "//src/ui/input/lib/input-report-reader", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fidl-llcpp", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zx", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| |
| driver_module("sensor_driver") { |
| output_name = "goldfish_sensor" |
| |
| configs += [ "//build/config/fuchsia:enable_zircon_asserts" ] |
| configs += [ "//build/config:all_source" ] |
| |
| sources = [ |
| "input_device.cc", |
| "input_device.h", |
| "input_device_dispatcher.cc", |
| "input_device_dispatcher.h", |
| "parser.cc", |
| "parser.h", |
| "root_device.cc", |
| "root_device.h", |
| ] |
| |
| deps = common_deps |
| } |
| |
| fuchsia_system_package("goldfish_sensor") { |
| deps = [ ":sensor_driver" ] |
| allowed_in_extra_deps = true |
| } |
| |
| test("goldfish-sensor-unittest") { |
| output_name = "goldfish-sensor-unittest" |
| sources = [ |
| "input_device.cc", |
| "input_device.h", |
| "input_device_dispatcher.cc", |
| "input_device_dispatcher.h", |
| "parser.cc", |
| "parser.h", |
| "root_device.cc", |
| "root_device.h", |
| "tests/input_device_test.cc", |
| "tests/parser_test.cc", |
| "tests/root_device_test.cc", |
| ] |
| deps = common_deps + [ |
| "//src/devices/testing/goldfish/fake_pipe", |
| "//src/devices/testing/fake_ddk", |
| "//third_party/googletest:gtest", |
| "//third_party/googletest:gtest_main", |
| "//zircon/system/ulib/mmio-ptr:mmio-ptr-fake", |
| "//src/devices/testing/fake-bti", |
| "//src/devices/testing/fake-object", |
| "//src/lib/testing/loop_fixture", |
| "//src/ui/input/lib/input-report-reader", |
| "//zircon/public/lib/mock-function", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zx", |
| ] |
| |
| configs += [ "//build/config:all_source" ] |
| } |
| |
| fuzzer("goldfish-sensor-parser-fuzzer") { |
| sources = [ |
| "parser.cc", |
| "parser.h", |
| "tests/parser_fuzztest.cc", |
| ] |
| deps = [ |
| "//zircon/public/lib/fbl", |
| "//zircon/system/ulib/hid-parser", |
| ] |
| } |
| |
| fuzzers_package("goldfish-sensor-parser-fuzzer-package") { |
| package_name = "goldfish-sensor-parser-fuzzer" |
| |
| cpp_fuzzers = [ ":goldfish-sensor-parser-fuzzer" ] |
| } |
| |
| fuchsia_unittest_package("goldfish-sensor-test-package") { |
| package_name = "goldfish-sensor-test" |
| deps = [ ":goldfish-sensor-unittest" ] |
| |
| # TODO(fxbug.dev/76529): Switch to v2 when this no longer depends on both gtest and zxtest. |
| v2 = false |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":goldfish-sensor-parser-fuzzer-package", |
| ":goldfish-sensor-test-package", |
| ":goldfish_sensor-bind_test", |
| ] |
| } |