Thomas Heijligen has submitted this change. ( https://review.coreboot.org/c/flashrom/+/67310 )
(
4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: tests: Use MOCK_FD instead of NON_ZERO for file operations ......................................................................
tests: Use MOCK_FD instead of NON_ZERO for file operations
NON_ZERO can be a negative number, so MOCK_FD is safer option to use as a mock file descriptor. Also it is more readable.
BUG=b:237606255 TEST=ninja test (on linux)
Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b TICKET: https://ticket.coreboot.org/issues/411 Signed-off-by: Anastasia Klimchuk aklm@chromium.org Reviewed-on: https://review.coreboot.org/c/flashrom/+/67310 Reviewed-by: Felix Singer felixsinger@posteo.net Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Alexander Goncharov chat@joursoir.net Reviewed-by: Thomas Heijligen src@posteo.de Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M tests/tests.c 1 file changed, 25 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Thomas Heijligen: Looks good to me, approved Angel Pons: Looks good to me, approved Alexander Goncharov: Looks good to me, but someone else must approve
diff --git a/tests/tests.c b/tests/tests.c index 7a448d4..8e3fdde 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -24,7 +24,7 @@
void *not_null(void) { - return (void *)NON_ZERO; + return (void *)MOCK_FD; }
/* Workaround for https://github.com/clibs/cmocka/issues/17 */ @@ -253,7 +253,7 @@ int __wrap_fileno(FILE *fp) { LOG_ME; - return NON_ZERO; + return MOCK_FD; }
int __wrap_fsync(int fd)