From: "cron2 (Code Review)"
Date: Mon, 3 Nov 2025 15:33:25 +0000
In-Reply-To:
References:
Reply-To: gert@...1296..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...,
antonio@...2726...
Message-ID: <71892ff514226dc76f186085f67537f33bdeac87-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="h+R1d/PnKkI="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: test_networking: use
appropriate assert helpers
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos , flichtenheld
Cc: openvpn-devel
--h+R1d/PnKkI=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
cron2 has uploaded a new patch set (#2) to the change originally created by=
ordex. ( http://gerrit.openvpn.net/c/openvpn/+/1342?usp=3Demail )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: test_networking: use appropriate assert helpers
......................................................................
test_networking: use appropriate assert helpers
In all unit tests we rely on CMocka's provided assert helpers.
However, test_networking.c was still on the default assert() call,
which we try to avoid in favour of more appropriate helpers.
Substitute them all with assert_*() from CMocka.
Change-Id: Ie153b3d5bf19200f225cd09131de8583645110be
Reported-by: Marc Heuse
Signed-off-by: Antonio Quartulli
Acked-by: Frank Lichtenheld
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1342
Message-Id: <20251103145842.22969-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34=
155.html
Signed-off-by: Gert Doering
---
M tests/unit_tests/openvpn/test_networking.c
1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1342/2
diff --git a/tests/unit_tests/openvpn/test_networking.c b/tests/unit_tests/=
openvpn/test_networking.c
index 6a2d09f..1c9cac1 100644
--- a/tests/unit_tests/openvpn/test_networking.c
+++ b/tests/unit_tests/openvpn/test_networking.c
@@ -2,7 +2,8 @@
#include "syshead.h"
#include "networking.h"
-#include
+#include
+#include
static char *iface =3D "ovpn-dummy0";
@@ -27,7 +28,7 @@
int ret =3D net_iface_type(NULL, name, ret_type);
if (ret =3D=3D 0)
{
- assert(strcmp(type, ret_type) =3D=3D 0);
+ assert_string_equal(type, ret_type);
}
return ret;
@@ -265,10 +266,10 @@
/* following tests are standalone and do not print any CMD=3D */
case 8:
- assert(net__iface_new("dummy0815", "dummy") =3D=3D 0);
- assert(net__iface_type("dummy0815", "dummy") =3D=3D 0);
- assert(net__iface_del("dummy0815") =3D=3D 0);
- assert(net__iface_type("dummy0815", NULL) =3D=3D -ENODEV);
+ assert_int_equal(net__iface_new("dummy0815", "dummy"), 0);
+ assert_int_equal(net__iface_type("dummy0815", "dummy"), 0);
+ assert_int_equal(net__iface_del("dummy0815"), 0);
+ assert_int_equal(net__iface_type("dummy0815", NULL), -ENODEV);
return 0;
default:
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1342?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie153b3d5bf19200f225cd09131de8583645110be
Gerrit-Change-Number: 1342
Gerrit-PatchSet: 2
Gerrit-Owner: ordex
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
--h+R1d/PnKkI=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
cron2 upl=
oaded patch set #2 to the change originally created by ordex.
<=
p>View C=
hange
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
test_networking: use appropr=
iate assert helpers
In all unit tests we rely on CMocka's provid=
ed assert helpers.
However, test_networking.c was still on the defau=
lt assert() call,
which we try to avoid in favour of more appropriate he=
lpers.
Substitute them all with assert_*() from CMocka.
Chang=
e-Id: Ie153b3d5bf19200f225cd09131de8583645110be
Reported-by: Marc Heuse =
<marc@...2953...>
Signed-off-by: Antonio Quartulli <antonio@...493...=
2726...>
Acked-by: Frank Lichtenheld <frank@...2641...>
Gerr=
it URL: https://gerrit.openvpn.net/c/openvpn/+/1342
Message-Id: <2025=
1103145842.22969-1-gert@...1296...>
URL: https://www.mail-archive.com=
/openvpn-devel@lists.sourceforge.net/msg34155.html
Signed-off-by: Gert D=
oering <gert@...1296...>
---
M tests/unit_tests/openvpn/test_ne=
tworking.c
1 file changed, 7 insertions(+), 6 deletions(-)
=
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/=
42/1342/2
diff --git a/tests/unit_tests/openvpn/test_networking.c b=
/tests/unit_tests/openvpn/test_networking.c
index 6a2d09f..=
1c9cac1 100644
--- a/tests/unit_tests/openvpn/test_networki=
ng.c
+++ b/tests/unit_tests/openvpn/test_networking.c
@@ -2,7 +2,8 @@
#include "syshead.h"<=
/span>
#include "networking.h"
=
-#include <assert.h>
+#include <setjmp.h&=
gt;
+#include <cmo=
cka.h>
static char *iface =3D "o=
vpn-dummy0";
@@ -27,7 +28,7 @@
int ret =3D net_iface_type(NULL, name, ret_type);
if (ret =3D=3D 0)
{
- assert(strcmp(type, ret_type) =3D=
=3D 0);
+ asse=
rt_string_equal(type, ret_type);
}
=
span>
return ret;
@@ -265,10 +266,10 @@
/* following tests are standalone and=
do not print any CMD=3D */
case 8:
- assert(net__iface_new(&q=
uot;dummy0815", "dummy") =3D=3D 0);
- assert(net__iface_type("dummy=
0815", "dummy") =3D=3D 0);
- assert(net__iface_del("dummy0815"=
) =3D=3D 0);
- =
assert(net__iface_type("dummy0815", NULL) =3D=3D -ENODEV);
+ assert_int_=
equal(net__iface_new("dummy0815", "dummy"), 0);<=
br>+ assert_int_equa=
l(net__iface_type("dummy0815", "dummy"), 0);
=
+ assert_int_equal(n=
et__iface_del("dummy0815"), 0);
+ assert_int_equal(net__iface_type("du=
mmy0815", NULL), -ENODEV);
return 0;
default:
=
To view, visit change 1342. To unsubscribe, or for help writing mail f=
ilters, visit se=
ttings.
<=
div itemscope itemprop=3D"action" itemtype=3D"http://schema.org/ViewAction"=
>
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie153b3d5bf19200f225cd09131d=
e8583645110be
Gerrit-Change-Number: 1342
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <antonio@...2726...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...=
1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
=
--h+R1d/PnKkI=--