]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
unit-tests: Prefix imported testable functions with TEST_
authorTobias Brunner <tobias@strongswan.org>
Fri, 28 Feb 2014 16:13:33 +0000 (17:13 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 20 Mar 2014 14:29:27 +0000 (15:29 +0100)
This avoids any clashes with existing functions in the monolithic build.

src/libstrongswan/utils/test.h

index b43a92b1fe19672e9b484ad4d753642079142e76..38887946d9899739be0ed28cabf0f5ae8a8785b1 100644 (file)
@@ -65,8 +65,8 @@ static void testable_function_unregister_##fn() \
 /**
  * Import a registered function so that it can be called from tests.
  *
- * @note If the imported function is static (or no conflicting header files
- * are included) ret can be prefixed with static to declare the function static.
+ * The function name is prefixed with TEST_ to avoid clashes when building
+ * monolithically.
  *
  * @note We allocate an arbitrary amount of stack space, hopefully enough for
  * all arguments.
@@ -77,7 +77,7 @@ static void testable_function_unregister_##fn() \
  * @param ...          arguments of the function
  */
 #define IMPORT_FUNCTION_FOR_TESTS(ns, name, ret, ...) \
-ret name(__VA_ARGS__) \
+static ret TEST_##name(__VA_ARGS__) \
 { \
        void (*fn)() = NULL; \
        if (testable_functions) \