From 73c0a1d8785f846bb2586a96a3f0a4808456791d Mon Sep 17 00:00:00 2001 From: Anastasia Klimchuk Date: Fri, 2 Sep 2022 17:12:06 +1000 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/67310 Reviewed-by: Felix Singer Reviewed-by: Angel Pons Reviewed-by: Alexander Goncharov Reviewed-by: Thomas Heijligen Tested-by: build bot (Jenkins) --- tests/tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/tests.c b/tests/tests.c index 7a448d4fb..8e3fdde0c 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_fflush(FILE *fp) int __wrap_fileno(FILE *fp) { LOG_ME; - return NON_ZERO; + return MOCK_FD; } int __wrap_fsync(int fd) -- cgit v1.2.3