summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-08-16 17:24:07 -0400
committerPeter Jones <pjones@redhat.com>2021-09-07 17:05:04 -0400
commite5a406b4655f75bb1a691acc73a18ac69cc87cb0 (patch)
tree7a8c28e2285263e989b320b4e2a02e52281005ce
parent11080efc7416c342b8f26ddb6ea1e8ef21026ddc (diff)
downloadefi-boot-shim-e5a406b4655f75bb1a691acc73a18ac69cc87cb0.tar.gz
efi-boot-shim-e5a406b4655f75bb1a691acc73a18ac69cc87cb0.zip
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 <pjones@redhat.com>
-rw-r--r--include/console.h4
-rw-r--r--include/hexdump.h7
2 files changed, 11 insertions, 0 deletions
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