mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix fpga.cpp unit test failing due to changed DeviceList interface
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
654ee84e9e
commit
2967fb8ac9
4 changed files with 19 additions and 13 deletions
|
@ -7,8 +7,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <villas/fpga/pcie_card.hpp>
|
||||
#include <villas/fpga/ips/aurora_xilinx.hpp>
|
||||
#include <villas/fpga/ips/dma.hpp>
|
||||
#include <villas/fpga/pcie_card.hpp>
|
||||
|
||||
namespace villas {
|
||||
namespace fpga {
|
||||
|
|
|
@ -28,7 +28,7 @@ static const kernel::pci::Device defaultFilter((kernel::pci::Id(FPGA_PCI_VID_XIL
|
|||
std::shared_ptr<PCIeCard>
|
||||
PCIeCardFactory::make(json_t *json_card, std::string card_name,
|
||||
std::shared_ptr<kernel::vfio::Container> vc,
|
||||
const std::filesystem::path &searchPath) {
|
||||
const std::filesystem::path &searchPath) {
|
||||
auto logger = getStaticLogger();
|
||||
|
||||
json_t *json_ips = nullptr;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
*
|
||||
* Author: Steffen Vogel <post@steffenvogel.de>
|
||||
* SPDX-FileCopyrightText: 2018 Steffen Vogel <post@steffenvogel.de>
|
||||
* Author: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
|
||||
* SPDX-FileCopyrightText: 2023 Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
@ -9,8 +11,8 @@
|
|||
|
||||
#include <villas/fpga/core.hpp>
|
||||
#include <villas/fpga/pcie_card.hpp>
|
||||
#include <villas/fpga/utils.hpp>
|
||||
#include <villas/fpga/vlnv.hpp>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
#include "global.hpp"
|
||||
|
||||
|
@ -25,7 +27,7 @@
|
|||
|
||||
using namespace villas;
|
||||
|
||||
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
|
||||
static kernel::pci::DeviceList *pciDevices;
|
||||
|
||||
FpgaState state;
|
||||
|
||||
|
@ -39,12 +41,12 @@ static void init()
|
|||
|
||||
plugin::registry->dump();
|
||||
|
||||
pciDevices = std::make_shared<kernel::pci::DeviceList>();
|
||||
pciDevices = kernel::pci::DeviceList::getInstance();
|
||||
|
||||
auto vfioContainer = std::make_shared<kernel::vfio::Container>();
|
||||
auto vfioContainer = std::make_shared<kernel::vfio::Container>();
|
||||
|
||||
// Parse FPGA configuration
|
||||
char *fn = getenv("TEST_CONFIG");
|
||||
// Parse FPGA configuration
|
||||
char *fn = getenv("TEST_CONFIG");
|
||||
f = fopen(fn ? fn : TEST_CONFIG, "r");
|
||||
cr_assert_not_null(f, "Cannot open config file");
|
||||
|
||||
|
@ -62,11 +64,14 @@ static void init()
|
|||
cr_assert_not_null(fpgaCardFactory, "No plugin for FPGA card found");
|
||||
|
||||
// Create all FPGA card instances using the corresponding plugin
|
||||
state.cards = fpgaCardFactory->make(fpgas, pciDevices, vfioContainer);
|
||||
auto configDir = std::filesystem::path(fn).parent_path();
|
||||
auto cards = std::list<std::shared_ptr<fpga::Card>>();
|
||||
fpga::createCards(json, cards, configDir);
|
||||
state.cards = cards;
|
||||
|
||||
cr_assert(state.cards.size() != 0, "No FPGA cards found!");
|
||||
cr_assert(state.cards.size() != 0, "No FPGA cards found!");
|
||||
|
||||
json_decref(json);
|
||||
json_decref(json);
|
||||
}
|
||||
|
||||
static void fini()
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#include <cstdlib>
|
||||
|
||||
#include <villas/fpga/pcie_card.hpp>
|
||||
#include <villas/fpga/card.hpp>
|
||||
|
||||
class FpgaState {
|
||||
public:
|
||||
// List of all available FPGA cards, only first will be tested at the moment
|
||||
std::list<std::shared_ptr<villas::fpga::PCIeCard>> cards;
|
||||
std::list<std::shared_ptr<villas::fpga::Card>> cards;
|
||||
};
|
||||
|
||||
// Global state to be shared by unittests
|
||||
|
|
Loading…
Add table
Reference in a new issue