mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +02:00
tests: Add NON_ZERO macro and not_null function instead of MOCK_HANDLE
This patch adds NON_ZERO macro and not_null function into io_mock.h, so that they can be used anywhere in tests. Common usage for not_null is to indicate a valid pointer, where it doesn't matter what the pointer is, only matters it is not null. Common usage of NON_ZERO is to indicate a valid file descriptor, where it only matters the descriptor is non-zero integer. New features replace all usages of previous MOCK_HANDLE. This patch corrects return value from __wrap_ioctl to be successful by default. It used to be MOCK_HANDLE, but should be 0. Included in this patch because this is also a replacement of MOCK_HANDLE. BUG=b:181803212 TEST=builds and ninja test Change-Id: I5ad6ee4aa9091447c6c9108c92bf7f6e755fca48 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/57269 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:

committed by
Nico Huber

parent
f42d2f72cc
commit
d23613cf66
@ -19,8 +19,6 @@
|
||||
#include "io_mock.h"
|
||||
#include "programmer.h"
|
||||
|
||||
#define NOT_NULL ((void *)0xf000baaa)
|
||||
|
||||
static void run_lifecycle(void **state, const struct programmer_entry *prog, const char *param)
|
||||
{
|
||||
(void) state; /* unused */
|
||||
@ -100,7 +98,7 @@ FILE *linux_mtd_fopen(void *state, const char *pathname, const char *mode)
|
||||
|
||||
io_state->fopen_path = strdup(pathname);
|
||||
|
||||
return NOT_NULL;
|
||||
return not_null();
|
||||
}
|
||||
|
||||
size_t linux_mtd_fread(void *state, void *buf, size_t size, size_t len, FILE *fp)
|
||||
|
Reference in New Issue
Block a user