1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-30 16:33:41 +02:00

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>
This commit is contained in:
Anastasia Klimchuk 2022-09-02 17:12:06 +10:00 committed by Thomas Heijligen
parent 75d327c550
commit 73c0a1d878

View File

@ -24,7 +24,7 @@
void *not_null(void) void *not_null(void)
{ {
return (void *)NON_ZERO; return (void *)MOCK_FD;
} }
/* Workaround for https://github.com/clibs/cmocka/issues/17 */ /* Workaround for https://github.com/clibs/cmocka/issues/17 */
@ -253,7 +253,7 @@ int __wrap_fflush(FILE *fp)
int __wrap_fileno(FILE *fp) int __wrap_fileno(FILE *fp)
{ {
LOG_ME; LOG_ME;
return NON_ZERO; return MOCK_FD;
} }
int __wrap_fsync(int fd) int __wrap_fsync(int fd)