Skip to content

Commit

Permalink
rq_test: make test independent of the core library
Browse files Browse the repository at this point in the history
Drop the dependency on core sources and mock the iommu functionality.

Signed-off-by: Klaus Jensen <[email protected]>
  • Loading branch information
birkelund committed May 31, 2024
1 parent 3a4c8e7 commit 9ca7fc8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvme/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nvme_sources = files(
)

# tests
rq_test = executable('rq_test', [gen_sources, vfn_sources, nvme_sources, 'rq_test.c'],
rq_test = executable('rq_test', [gen_sources, support_sources, trace_sources, 'queue.c', 'util.c', 'rq_test.c'],
link_with: [ccan_lib],
include_directories: [ccan_inc, core_inc, vfn_inc],
)
Expand Down
18 changes: 18 additions & 0 deletions src/nvme/rq_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@

#define __max_prps 513

bool iommu_translate_vaddr(struct iommu_ctx *ctx UNUSED, void *vaddr, uint64_t *iova)
{
*iova = (uint64_t)vaddr;

return true;
}

int iommu_map_vaddr(struct iommu_ctx *ctx UNUSED, void *vaddr UNUSED, size_t len UNUSED,
uint64_t *iova UNUSED, unsigned long flags UNUSED)
{
return 0;
}

int iommu_unmap_vaddr(struct iommu_ctx *ctx UNUSED, void *vaddr UNUSED, size_t *len UNUSED)
{
return 0;
}

int main(void)
{
struct nvme_ctrl ctrl = {
Expand Down

0 comments on commit 9ca7fc8

Please sign in to comment.