diff options
author | Simon Glass | 2023-08-24 13:55:37 -0600 |
---|---|---|
committer | Tom Rini | 2023-08-25 17:55:19 -0400 |
commit | e2d22f782297bcec8b0b55d15b9a04e92bd4ea83 (patch) | |
tree | 3e23633bfe4f55378e48764ca1fd03ff3fbaec08 /include/os.h | |
parent | 8d6337e69147557fb3c4b89a27156ac468a20500 (diff) |
sandbox: Add a way to access persistent test files
Some pytests create files in the persistent-data directory. It is useful
to be able to access these files in C tests. Add a function which can
locate a file given its leaf name, using the environment variable set
up in test/py/conftest.py
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/os.h')
-rw-r--r-- | include/os.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/os.h b/include/os.h index 968412b0a82..fc8a1b15cbf 100644 --- a/include/os.h +++ b/include/os.h @@ -98,6 +98,16 @@ int os_close(int fd); */ int os_unlink(const char *pathname); +/** os_persistent_fname() - Find the path to a test file + * + * @buf: Buffer to hold path + * @maxsize: Maximum size of buffer + * @fname: Leaf filename to find + * Returns: 0 on success, -ENOENT if file is not found, -ENOSPC if the buffer is + * too small + */ +int os_persistent_file(char *buf, int maxsize, const char *fname); + /** * os_exit() - access to the OS exit() system call * |