From: Olivier Houchard Date: Tue, 4 Mar 2025 16:46:18 +0000 (+0100) Subject: DEBUG: init: Add a macro to register unit tests X-Git-Tag: v3.2-dev7~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=335ef3264b8c5ebb5bd8f0e327da90d7107e853b;p=thirdparty%2Fhaproxy.git DEBUG: init: Add a macro to register unit tests Add a new macro, REGISTER_UNITTEST(), that will automatically make sure we call hap_register_unittest(), instead of having to create a function that will do so. --- diff --git a/include/haproxy/init.h b/include/haproxy/init.h index ca059e376..382e7a142 100644 --- a/include/haproxy/init.h +++ b/include/haproxy/init.h @@ -35,8 +35,12 @@ void hap_register_per_thread_free(void (*fct)()); #ifdef DEBUG_UNIT void hap_register_unittest(const char *name, int (*fct)()); +/* Simplified way to register a unit test */ +#define REGISTER_UNITTEST(name, fct) \ + INITCALL2(STG_REGISTER, hap_register_unittest, name, (fct)) #else #define hap_register_unittest(a,b) ({}) +#define REGISTER_UNITTEST(name, fct) #endif /* simplified way to declare a pre-check callback in a file */