blob: dc5fd9cf6a76b71766a4d1d978244a6e1d0e9f10 [file] [log] [blame]
// 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.
#include "src/sys/fuzzing/framework/testing/module.h"
#include <lib/syslog/cpp/macros.h>
#include <zircon/status.h>
namespace fuzzing {
FakeFrameworkModule::FakeFrameworkModule(uint32_t seed) : FakeModule(seed) {
module_ = std::make_unique<Module>();
auto status = module_->Import(counters(), pcs(), num_pcs());
FX_CHECK(status == ZX_OK) << zx_status_get_string(status);
}
FakeFrameworkModule::FakeFrameworkModule(std::vector<ModulePC>&& pc_table) noexcept
: FakeModule(std::move(pc_table)) {
module_ = std::make_unique<Module>();
auto status = module_->Import(counters(), pcs(), num_pcs());
FX_CHECK(status == ZX_OK) << zx_status_get_string(status);
}
FakeFrameworkModule& FakeFrameworkModule::operator=(FakeFrameworkModule&& other) noexcept {
module_ = std::move(other.module_);
FakeModule::operator=(std::move(other));
return *this;
}
zx_status_t FakeFrameworkModule::Share(uint64_t target_id, zx::vmo* out) const {
return module_->Share(target_id, out);
}
} // namespace fuzzing