summaryrefslogtreecommitdiffstats
path: root/tests/tests.c
diff options
context:
space:
mode:
authorEvan Benn <evanbenn@chromium.org>2022-11-14 10:31:22 +1100
committerAnastasia Klimchuk <aklm@chromium.org>2022-12-09 00:16:44 +0000
commitda6d28f2d18c54cf88c2d6a4b098b1f1e15ac085 (patch)
tree764f32d139755503268905a3f8411981c93dd3da /tests/tests.c
parent67a393b88a96c03b7f7fd555de68e56d2de03e9e (diff)
downloadflashrom-da6d28f2d18c54cf88c2d6a4b098b1f1e15ac085.tar.gz
flashrom-da6d28f2d18c54cf88c2d6a4b098b1f1e15ac085.tar.bz2
flashrom-da6d28f2d18c54cf88c2d6a4b098b1f1e15ac085.zip
tests: Add fwrite and fdopen to io_mock
BUG=None BRANCH=None TEST=None Change-Id: I4dff96c264b3ada354538b434b2808fb66c7ef59 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69538 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'tests/tests.c')
-rw-r--r--tests/tests.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/tests.c b/tests/tests.c
index b517898f7..41972ba25 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -184,6 +184,8 @@ FILE *__wrap_fopen64(const char *pathname, const char *mode)
FILE *__wrap_fdopen(int fd, const char *mode)
{
LOG_ME;
+ if (get_io() && get_io()->iom_fdopen)
+ return get_io()->iom_fdopen(get_io()->state, fd, mode);
return not_null();
}
@@ -254,6 +256,8 @@ size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *fp)
size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *fp)
{
LOG_ME;
+ if (get_io() && get_io()->iom_fwrite)
+ return get_io()->iom_fwrite(get_io()->state, ptr, size, nmemb, fp);
return nmemb;
}