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>
This commit is contained in:
Simon Glass
2023-08-24 13:55:37 -06:00
committed by Tom Rini
parent 8d6337e691
commit e2d22f7822
2 changed files with 34 additions and 0 deletions

View File

@@ -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
*