Skip to content

Commit 4fd6112

Browse files
committed
test: add global context discovery test case
The discovery code wants to access the global context, thus initial the pointer in the mock setup. Signed-off-by: Daniel Wagner <[email protected]>
1 parent e3140b0 commit 4fd6112

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

libnvme/test/ioctl/discovery.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,10 @@ static void test_genctr_error(nvme_ctrl_t c)
401401
check(!log, "unexpected log page returned");
402402
}
403403

404-
static void run_test(const char *test_name, void (*test_fn)(nvme_ctrl_t))
404+
static void run_test(struct nvme_global_ctx *ctx, const char *test_name,
405+
void (*test_fn)(nvme_ctrl_t))
405406
{
406-
struct nvme_ctrl c = { .hdl = test_hdl };
407+
struct nvme_ctrl c = { .ctx = ctx, .hdl = test_hdl };
407408

408409
printf("Running test %s...", test_name);
409410
fflush(stdout);
@@ -413,7 +414,7 @@ static void run_test(const char *test_name, void (*test_fn)(nvme_ctrl_t))
413414
puts(" OK");
414415
}
415416

416-
#define RUN_TEST(name) run_test(#name, test_ ## name)
417+
#define RUN_TEST(name) run_test(ctx, #name, test_ ## name)
417418

418419
int main(void)
419420
{

0 commit comments

Comments
 (0)