From patchwork Mon Nov 3 14:58:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4561 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:a40d:b0:72f:f16c:e055 with SMTP id vo13csp1458572mab; Mon, 3 Nov 2025 06:59:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVTmkwMJjru6KDKgdvAxKQygfPzuvnbkOeznOaKXo3hDMQ9sRv9kSlqzaCqW7RHRGlyWryk8kbj21U=@openvpn.net X-Google-Smtp-Source: AGHT+IF6xNyHlYqPpxPc71uguhlp3l+yAUv9oVbjxRUa3imP5C3YSM4cuwLk9N30F24fOHDHlByN X-Received: by 2002:a05:6808:178f:b0:441:8f74:f15 with SMTP id 5614622812f47-44f95ff8c04mr5425513b6e.63.1762181942226; Mon, 03 Nov 2025 06:59:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762181942; cv=none; d=google.com; s=arc-20240605; b=JAM5c3pmzoXlRhEMZd7AypKaedVfjnC0pH0jrUmu5WsHMGfTtqvjei46xPkc4GMh6q 61r8qRgiIpZ3JH2U/CVEqZxzCbHboLg6gcPBnhFd4HPEhUfhLFyHlpYS9vnqHXF0QoTi Y4AYSUZrA+AcxBtPdWO+0RTo1mwVOcEdXWHC+zUo8mZRiRZHEo9yY/aIE3h6P60MBw2/ I4debQYLyGBdjYj2nZUE5bDANgalAG34Yh7DzOTzRHaRl59wSOD4ued5ug9nPTK8pblG hpzf9p+tVK791mzlGc1M3ajUhOEksHP5TQYc8a72sZrnMAX2sVzAOecT+rixdqw06M+V BkUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=YGpiwFdb4fX/R8k+r55xODU7se9iLf4RZBIVMuZsN3w=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=J9QK4GJ2M77xK5X0JC3WgUMQ6GI/lPJ2c6GH+hlDvwhc8FErD0Ke9qGw+yWtyo62GG SkATECbyZxKH2bfuB1HEwu1KeORAT8jYhfA336+AGb/H3xmR66O7ZH2MgSDFrWmMcZUS 7Z1iZKg2bS29fnwYLNsk1qjkXkmQuRSljDX8MsKCC/l9oXwsriaYSpm+qUYIJWQ5kS7b wtT6lJwlGudIDYTRupOaCfWHJ+zW73nei7xrvBX5cDF3RJ2gUJHzGIuIAGZB3yT5mc0N zf/MxdDAhbj64wigZxgcIrn9M/qiT5msG/1NtEvGQF8+Z/YFHcu9dyfxpa9XxhuYLp7v 2IrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=c0ntmpsk; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=luBkSrLX; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=a7AqSlZy; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-44f9d9e6b8bsi2974898b6e.303.2025.11.03.06.59.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Nov 2025 06:59:02 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=c0ntmpsk; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=luBkSrLX; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=a7AqSlZy; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YGpiwFdb4fX/R8k+r55xODU7se9iLf4RZBIVMuZsN3w=; b=c0ntmpsk88Rh/k94QPPShHIim3 rt23wEipg3+nYFYqLrxNy2kt6fR+AtnsIQ40nmuhsjnFcbuRc9EpD14J9cQ2lPRBuVkyrwabznoXj K6cg/XncGD5HP/2foDp1XGxB3yqQt+9davlQf5RAGA6tFoUVxqIHLP3Py2UZvMRacfQ0=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vFw1K-0005oE-9n; Mon, 03 Nov 2025 14:58:58 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vFw1I-0005o4-DH for openvpn-devel@lists.sourceforge.net; Mon, 03 Nov 2025 14:58:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qe/gMHkvALvBJg7EHXtBh/zSXK5nIPl3Tq4YAzXHjO4=; b=luBkSrLXHz/jvrqJkBh6JfnTRn 8oxi0sulWfTzpdTFmkJewB5hVtmkAEBRKe5z5K20Q1lkW6yjSmD0Yyix+tHJ9MrMm/4nVxnqcrQtE j54GtN0KDfSh+pLc6l6gygiEzFep50IAeFFFP4zK5o0yTxlXmuUbIUZeTLnwWrDBul/U=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=qe/gMHkvALvBJg7EHXtBh/zSXK5nIPl3Tq4YAzXHjO4=; b=a7AqSlZyGX+7OlFagyBGngjD/o 2LjRk1TauatfX1iad4HVLmPPF0W5LObizYHywJU/uELfxEw09xc+xzWVeWSvnG+uXQ/rJU0BiC33l 73XdsXuN2OyB0M4ScQdHKO1CEyKJWN+R9cgHS3juf5NMcQHa/mZmXDm117p4dPhnmEEk=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vFw1H-00046W-5D for openvpn-devel@lists.sourceforge.net; Mon, 03 Nov 2025 14:58:56 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 5A3EwhGY022985 for ; Mon, 3 Nov 2025 15:58:43 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5A3Ewhrs022984 for openvpn-devel@lists.sourceforge.net; Mon, 3 Nov 2025 15:58:43 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 3 Nov 2025 15:58:37 +0100 Message-ID: <20251103145842.22969-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Antonio Quartulli Inall 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. Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1vFw1H-00046W-5D Subject: [Openvpn-devel] [PATCH v1] test_networking: use appropriate assert helpers X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1847781692294816264?= X-GMAIL-MSGID: =?utf-8?q?1847781692294816264?= From: Antonio Quartulli Inall 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 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1342 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld 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 = "ovpn-dummy0"; @@ -27,7 +28,7 @@ int ret = net_iface_type(NULL, name, ret_type); if (ret == 0) { - assert(strcmp(type, ret_type) == 0); + assert_string_equal(type, ret_type); } return ret; @@ -265,10 +266,10 @@ /* following tests are standalone and do not print any CMD= */ case 8: - assert(net__iface_new("dummy0815", "dummy") == 0); - assert(net__iface_type("dummy0815", "dummy") == 0); - assert(net__iface_del("dummy0815") == 0); - assert(net__iface_type("dummy0815", NULL) == -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: