From e5a406b4655f75bb1a691acc73a18ac69cc87cb0 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 16 Aug 2021 17:24:07 -0400 Subject: tests: Disable some logging when SHIM_UNIT_TEST is enabled None of this should ever actually get called when we're running any of the unit tests we've got, but some older compilers (i.e. Centos 7's gcc) fail to remove some of the intermediate functions, and that causes a link error with the functions they call. This patch makes the top level call go away as well, so that the intermediates never have linkage to the underlying implementation functions. Signed-off-by: Peter Jones --- include/console.h | 4 ++++ include/hexdump.h | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'include') diff --git a/include/console.h b/include/console.h index f56b1231..c832b20e 100644 --- a/include/console.h +++ b/include/console.h @@ -109,8 +109,12 @@ extern UINT32 verbose; extern EFI_STATUS EFIAPI vdprint_(const CHAR16 *fmt, const char *file, int line, const char *func, ms_va_list args); +#if defined(SHIM_UNIT_TEST) +#define vdprint(fmt, ...) +#else #define vdprint(fmt, ...) \ vdprint_(fmt, __FILE__, __LINE__ - 1, __func__, ##__VA_ARGS__) +#endif extern EFI_STATUS print_crypto_errors(EFI_STATUS rc, char *file, const char *func, int line); #define crypterr(rc) print_crypto_errors((rc), __FILE__, __func__, __LINE__) diff --git a/include/hexdump.h b/include/hexdump.h index 381e1a68..1a20339b 100644 --- a/include/hexdump.h +++ b/include/hexdump.h @@ -137,12 +137,19 @@ hexdumpat(const char *file, int line, const char *func, const void *data, unsign hexdumpf(file, line, func, L"", data, size, at); } +#if defined(SHIM_UNIT_TEST) +#define LogHexDump(data, ...) +#define dhexdump(data, ...) +#define dhexdumpat(data, ...) +#define dhexdumpf(fmt, ...) +#else #define LogHexdump(data, sz) LogHexdump_(__FILE__, __LINE__, __func__, data, sz) #define dhexdump(data, sz) hexdump(__FILE__, __LINE__, __func__, data, sz) #define dhexdumpat(data, sz, at) \ hexdumpat(__FILE__, __LINE__ - 1, __func__, data, sz, at) #define dhexdumpf(fmt, data, sz, at, ...) \ hexdumpf(__FILE__, __LINE__ - 1, __func__, fmt, data, sz, at, ##__VA_ARGS__) +#endif #endif /* STATIC_HEXDUMP_H */ // vim:fenc=utf-8:tw=75:noet -- cgit v1.2.3