Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2394?usp=email

to review the following change.


Change subject: unit_tests: Fix build with CMocka 2.0.3
......................................................................

unit_tests: Fix build with CMocka 2.0.3

As seen in Fedora Rawhide builds.

- mock_assert type for line argument changed, make sure
  we avoid sign conversion errors.
- fail_msg doesn't seem to work without and VA_ARGS anymore.
  This might or might not be a bug (the documentation hasn't
  changed, but work around it either way).

Change-Id: Ifaebb8f5e7245c505a29c87f917f92bf16fa8027
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_provider.c
3 files changed, 16 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/2394/1

diff --git a/tests/unit_tests/openvpn/mock_msg.c 
b/tests/unit_tests/openvpn/mock_msg.c
index 3e73d19..b3b00a0 100644
--- a/tests/unit_tests/openvpn/mock_msg.c
+++ b/tests/unit_tests/openvpn/mock_msg.c
@@ -37,6 +37,7 @@
 #include "errlevel.h"
 #include "error.h"
 #include "mock_msg.h"
+#include "test_common.h"

 msglvl_t x_debug_level = 0; /* Default to (almost) no debugging output */
 msglvl_t print_x_debug_level = 0;
@@ -115,7 +116,7 @@
 void
 assert_failed(const char *filename, int line, const char *condition)
 {
-    mock_assert(false, condition ? condition : "", filename, line);
+    mock_assert(false, condition ? condition : "", filename, 
(ovpn_cmocka_line_t)line);
     /* Keep compiler happy.  Should not happen, mock_assert() does not return 
*/
     exit(1);
 }
diff --git a/tests/unit_tests/openvpn/test_common.h 
b/tests/unit_tests/openvpn/test_common.h
index 85e099f..33dbbc0 100644
--- a/tests/unit_tests/openvpn/test_common.h
+++ b/tests/unit_tests/openvpn/test_common.h
@@ -50,6 +50,18 @@
 #define cast_ptr_to_cmocka_value(x)           (x)
 #define assert_int_in_range(value, min, max)  assert_in_range((value), (min), 
(max))
 #define assert_uint_in_range(value, min, max) assert_in_range((value), (min), 
(max))
+
+#else
+
+#include <cmocka_version.h>
+
+/* handle differences in different 2.x versions */
+#if CMOCKA_VERSION_INT >= CM_VERSION_INT(2, 0, 3)
+typedef size_t ovpn_cmocka_line_t;
+#else
+typedef int ovpn_cmocka_line_t;
+#endif
+
 #endif

 /**
diff --git a/tests/unit_tests/openvpn/test_provider.c 
b/tests/unit_tests/openvpn/test_provider.c
index 5d31da3..c2c0a41 100644
--- a/tests/unit_tests/openvpn/test_provider.c
+++ b/tests/unit_tests/openvpn/test_provider.c
@@ -256,7 +256,7 @@
 
     if (!mctx || EVP_DigestSignInit_ex(mctx, &pctx, mdname, NULL, NULL, pkey, 
params) <= 0)
     {
-        fail_msg("Failed to initialize EVP_DigestSignInit_ex()");
+        fail_msg("%s", "Failed to initialize EVP_DigestSignInit_ex()");
         goto done;
     }

@@ -266,7 +266,7 @@

     if ((sig = test_calloc(1, siglen)) == NULL)
     {
-        fail_msg("Out of memory");
+        fail_msg("%s", "Out of memory");
     }
     assert_int_equal(EVP_DigestSign(mctx, sig, &siglen, (uint8_t *)test_msg, 
strlen(test_msg)), 1);


--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2394?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifaebb8f5e7245c505a29c87f917f92bf16fa8027
Gerrit-Change-Number: 2394
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Lichtenheld <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to