Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69266 )
Change subject: tests: Detect gcov file io and unmock io functions ......................................................................
Patch Set 9:
(4 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/69266/comment/4e6d1646_5a55fd70 PS6, Line 9: atexit
missing space: atexit -> at exit
atexit is the name of the functionality through which code coverage writes data to disk. I will reword it.
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/69266/comment/82153d1d_f07d844b PS6, Line 110: size_t (*iom_fwrite)(void *state, const void *buf, size_t size, size_t len, FILE *fp);
Adding these (iom_fwrite and iom_fdopen) two can go into a separate patch, together with their calls […]
Done
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/69266/comment/f89ee844_f8e7ea91 PS6, Line 52: real_io_mock
I think you can drop _mock, this is just real_io
Done
https://review.coreboot.org/c/flashrom/+/69266/comment/f34f982a_73674cc4 PS6, Line 29: static int unwrap_open(void *state, const char *pathname, int flags, mode_t mode) : { : LOG_ME; : (void)state; : return __real_open(pathname, flags, mode); : } : : static FILE *unwrap_fdopen(void *state, int fd, const char *mode) : { : LOG_ME; : (void)state; : return __real_fdopen(fd, mode); : } : : static size_t unwrap_fwrite(void *state, const void *ptr, size_t size, size_t nmemb, FILE *fp) : { : LOG_ME; : (void)state; : return __real_fwrite(ptr, size, nmemb, fp); : } : : // Mock ios that defer to the real io functions. : // These exist so that code coverage can print to real files on disk. : static const struct io_mock real_io_mock = { : .iom_open = unwrap_open, : .iom_fwrite = unwrap_fwrite, : .iom_fdopen = unwrap_fdopen, : };
Ideally, if this could go to a separate file for example `coverage. […]
named it unmock_io as its what it does, I think it will be useful for more than just coverage.