From d23613cf6668b677264e5e02d4f4ac02873d307b Mon Sep 17 00:00:00 2001 From: Anastasia Klimchuk Date: Thu, 14 Oct 2021 12:21:02 +1100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/57269 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- tests/include/test.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/include') diff --git a/tests/include/test.h b/tests/include/test.h index 24fa963b4..ee7b4cf1c 100644 --- a/tests/include/test.h +++ b/tests/include/test.h @@ -27,4 +27,12 @@ #include #include +#define NON_ZERO (0xf000baaa) + +/* + * Having this as function allows to set a breakpoint on the address, + * as it has a named symbol associated with the address number. + */ +void *not_null(void); + #endif /* _TESTS_TEST_H */ -- cgit v1.2.3