mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 22:43:17 +02:00
tests: use MOCK_FD instead of NON_ZERO
With this change the mocks are able to return a non-negative value for the file descriptor expected from open operations. This avoid issues with subsequent error checks of the form `if (fd < 0)` BUG=b:227404721 TEST=./test_build.sh; FEATURES=test emerge-amd64-generic flashrom BRANCH=none Signed-off-by: Daniel Campello <campello@chromium.org> Change-Id: Ib6bac051852aea2465665a6fd669b7f5e3772985 Reviewed-on: https://review.coreboot.org/c/flashrom/+/63193 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
bd2d070f9f
commit
9454336970
@ -79,7 +79,7 @@ int __wrap_open(const char *pathname, int flags)
|
||||
LOG_ME;
|
||||
if (get_io() && get_io()->open)
|
||||
return get_io()->open(get_io()->state, pathname, flags);
|
||||
return NON_ZERO;
|
||||
return MOCK_FD;
|
||||
}
|
||||
|
||||
int __wrap_open64(const char *pathname, int flags)
|
||||
@ -87,7 +87,7 @@ int __wrap_open64(const char *pathname, int flags)
|
||||
LOG_ME;
|
||||
if (get_io() && get_io()->open)
|
||||
return get_io()->open(get_io()->state, pathname, flags);
|
||||
return NON_ZERO;
|
||||
return MOCK_FD;
|
||||
}
|
||||
|
||||
int __wrap___open64_2(const char *pathname, int flags)
|
||||
@ -95,7 +95,7 @@ int __wrap___open64_2(const char *pathname, int flags)
|
||||
LOG_ME;
|
||||
if (get_io() && get_io()->open)
|
||||
return get_io()->open(get_io()->state, pathname, flags);
|
||||
return NON_ZERO;
|
||||
return MOCK_FD;
|
||||
}
|
||||
|
||||
int __wrap_ioctl(int fd, unsigned long int request, ...)
|
||||
|
Reference in New Issue
Block a user