From 3df8dc58b2b5b1f60d45793e6a7c1f51a2fd2383 Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Thu, 27 Jun 2019 12:18:08 -0700 Subject: Checks each interface in an init_rc file is a known hidl_interface. Test: Adding a misspelling to an init_rc's interface line and observing build failure. Bug: 77646540 Change-Id: I58f66d73f0bd9b4203e8259161843b56ad428d73 --- init/service_parser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'init/service_parser.cpp') diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 33ed05097..ba351046a 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -152,6 +152,12 @@ Result ServiceParser::ParseInterface(std::vector&& args) { return Error() << "Interface name must not be a value name '" << interface_name << "'"; } + if (known_interfaces_ && known_interfaces_->count(interface_name) == 0) { + return Error() << "Interface is not in the known set of hidl_interfaces: '" + << interface_name << "'. Please ensure the interface is built " + << "by a hidl_interface target."; + } + const std::string fullname = interface_name + "/" + instance_name; for (const auto& svc : *service_list_) { -- cgit v1.2.3