Files
u-boot/include/test/fs.h
Simon Glass 72aeb4a2e2 test: fs: add C-based filesystem tests
Add C implementations of filesystem tests that can be called via
the 'ut fs' command. These tests use UTF_MANUAL flag since they require
external setup, i.e. creation of filesystem images.

This covers the existing TestFsBasic tests.

The tests use typed arguments (fs_type, fs_image, md5 values) passed
via the command line.

Add a few helpers to make the code easier to read.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-14 09:52:56 -07:00

40 lines
1004 B
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2025 Google LLC
*/
#ifndef __TEST_FS_H
#define __TEST_FS_H
#include <test/test.h>
#include <test/ut.h>
/**
* FS_TEST() - Define a new filesystem test
*
* @name: Name of test function
* @flags: Flags for the test (see enum ut_flags)
*/
#define FS_TEST(_name, _flags) UNIT_TEST(_name, UTF_DM | (_flags), fs)
/**
* FS_TEST_ARGS() - Define a filesystem test with inline arguments
*
* Like FS_TEST() but for tests that take arguments.
* The test can access arguments via uts->args[].
* The NULL terminator is added automatically.
*
* Example:
* FS_TEST_ARGS(my_test, UTF_MANUAL,
* { "fs_type", UT_ARG_STR },
* { "fs_image", UT_ARG_STR });
*
* @name: Name of test function
* @flags: Flags for the test (see enum ut_flags)
* @...: Argument definitions (struct ut_arg_def initializers)
*/
#define FS_TEST_ARGS(_name, _flags, ...) \
UNIT_TEST_ARGS(_name, UTF_DM | (_flags), fs, __VA_ARGS__)
#endif /* __TEST_FS_H */