[no-relnote] Also validate CDI management spec

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2024-11-01 14:50:58 +01:00
parent 8d869acce5
commit 0c687be794
4 changed files with 90 additions and 9 deletions

View File

@@ -28,9 +28,15 @@ const (
// NewCharDeviceLocator creates a Locator that can be used to find char devices at the specified root. A logger is
// also specified.
func NewCharDeviceLocator(opts ...Option) Locator {
filter := assertCharDevice
// TODO: We should have a better way to inject this logic than this envvar.
if os.Getenv("__NVCT_TESTING_DEVICES_ARE_FILES") == "true" {
filter = assertFile
}
opts = append(opts,
WithSearchPaths("", devRoot),
WithFilter(assertCharDevice),
WithFilter(filter),
)
return NewFileLocator(
opts...,