---
name: "libnvme_set_test_base_dir-libnvme3"
section: "2"
platform: "linux"
package: "nvme-cli"
version: "3.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libnvme_set_test_base_dir-libnvme3"
---

# libnvme\_set\_test\_base\_dir-libnvme3(2)

Reroot libnvme's on-disk files for testing

## NAME

libnvme\_set\_test\_base\_dir - Reroot libnvme's on-disk files for testing

## SYNOPSIS

**int libnvme\_set\_test\_base\_dir** **(struct libnvme\_global\_ctx \*ctx** *,* **const char \*path** *);*

## ARGUMENTS

- ctx

  *struct libnvme\_global\_ctx* object

- path

  Sandbox directory under /tmp, or NULL to restore defaults

## DESCRIPTION

Redirects the files libnvme reads and writes (the exclusion list, the ownership registry, ...) under *path* instead of their production locations, so a test can run against a throwaway directory.  For safety *path* must be confined to /tmp and contain no ".." component; anything else is rejected. Passing NULL clears a previously set override.

## RETURN

0 on success, -EINVAL if *ctx* is NULL or *path* is not a valid sandbox path, -ENOMEM on allocation failure.
