blob: e8fb74f5b689a49a9cf6abb7068dee14553a7f04 [file] [log] [blame]
// Copyright 2020 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.
#include <fidl/fuchsia.device/cpp/wire.h>
#include <lib/devmgr-integration-test/fixture.h>
#include <zircon/processargs.h>
#include <zircon/syscalls.h>
#include <vector>
#include <zxtest/zxtest.h>
namespace {
using devmgr_integration_test::IsolatedDevmgr;
TEST(BindFailTest, BindFail) {
const char kDriver[] = "";
auto args = IsolatedDevmgr::DefaultArgs();
args.root_device_driver = "/boot/meta/";
// NB: this loop is never run. RealmBuilder::Build is in the call stack, and insists on a non-null
// dispatcher.
// TODO( Remove this.
async::Loop loop(&kAsyncLoopConfigNeverAttachToThread);
zx::result devmgr = IsolatedDevmgr::Create(std::move(args), loop.dispatcher());
fidl::ClientEnd<fuchsia_device::Controller> client_end;
zx::result channel = device_watcher::RecursiveWaitForFile(devmgr.value().devfs_root().get(),
ASSERT_OK(channel); = std::move(channel.value());
fidl::WireSyncClient controller(std::move(client_end));
const fidl::WireResult result = controller->Bind(fidl::StringView{kDriver});
const fit::result response = result.value();
// The driver will run its tests in its bind routine, and return ZX_OK on success.
ASSERT_STATUS(ZX_ERR_NOT_SUPPORTED, response.error_value());
} // namespace