From: "cron2 (Code Review)" Date: Tue, 7 Oct 2025 20:17:40 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <45c700056c580c0b5e36bb1b22f8b3310632401c-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="42A/DmPMwUM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: unit_tests: Remove useless wrapping for argv/buffer tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --42A/DmPMwUM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1243?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: unit_tests: Remove useless wrapping for argv/buffer tests ...................................................................... unit_tests: Remove useless wrapping for argv/buffer tests If not using mock() or check_expected(), and not linking the original function, then there is no need for wrapping support. Change-Id: I937105abeb5e8f796bf6bbe8432972adb60b3e2a Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1243 Message-Id: <20251007185217.19381-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59243508/ Signed-off-by: Gert Doering --- M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am M tests/unit_tests/openvpn/test_argv.c 3 files changed, 10 insertions(+), 14 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/43/1243/3 diff --git a/CMakeLists.txt b/CMakeLists.txt index be66357..aeef480 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -654,6 +654,7 @@ endif () set(unit_tests + "test_argv" "test_auth_token" "test_buffer" "test_crypto" @@ -684,7 +685,6 @@ # Clang-cl (which is also MSVC) is wrongly detected to support wrap if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests - "test_argv" "test_tls_crypt" ) endif () @@ -887,13 +887,10 @@ src/openvpn/list.c ) - if (TARGET test_argv) - target_link_options(test_argv PRIVATE -Wl,--wrap=3Dparse_line) - target_sources(test_argv PRIVATE - tests/unit_tests/openvpn/mock_get_random.c - src/openvpn/argv.c - ) - endif () + target_sources(test_argv PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + src/openvpn/argv.c + ) if (TARGET test_cryptoapi) target_sources(test_cryptoapi PRIVATE diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvp= n/Makefile.am index ec8cc69..f7b1bc8 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -4,12 +4,11 @@ AM_TESTSUITE_SUMMARY_HEADER =3D ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries =3D crypto_testdriver packet_id_testdriver auth_token_testdr= iver \ +test_binaries =3D argv_testdriver buffer_testdriver crypto_testdriver pack= et_id_testdriver auth_token_testdriver \ ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ user_pass_testdriver push_update_msg_testdriver provider_testdriver socke= t_testdriver if HAVE_LD_WRAP_SUPPORT -test_binaries +=3D argv_testdriver buffer_testdriver if !WIN32 test_binaries +=3D tls_crypt_testdriver endif @@ -36,7 +35,7 @@ endif argv_testdriver_CFLAGS =3D -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/sr= c/compat @TEST_CFLAGS@ -argv_testdriver_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl= ,--wrap=3Dparse_line +argv_testdriver_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn argv_testdriver_SOURCES =3D test_argv.c \ mock_msg.c mock_msg.h test_common.h \ mock_get_random.c \ @@ -46,7 +45,7 @@ $(top_srcdir)/src/openvpn/argv.c buffer_testdriver_CFLAGS =3D -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/= src/compat @TEST_CFLAGS@ -buffer_testdriver_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -= Wl,--wrap=3Dparse_line +buffer_testdriver_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn buffer_testdriver_SOURCES =3D test_buffer.c \ mock_msg.c mock_msg.h test_common.h \ mock_get_random.c \ diff --git a/tests/unit_tests/openvpn/test_argv.c b/tests/unit_tests/openvp= n/test_argv.c index a04fabc..25c0371 100644 --- a/tests/unit_tests/openvpn/test_argv.c +++ b/tests/unit_tests/openvpn/test_argv.c @@ -22,8 +22,8 @@ #define SCRIPT_CMD "\"" PATH1 PATH2 "\"" PARAM1 "\"" PARAM2 "\"" int -__wrap_parse_line(const char *line, char **p, const int n, const char *fil= e, const int line_num, - msglvl_t msglevel, struct gc_arena *gc) +parse_line(const char *line, char **p, const int n, const char *file, cons= t int line_num, + msglvl_t msglevel, struct gc_arena *gc) { p[0] =3D PATH1 PATH2; p[1] =3D PARAM1; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1243?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: I937105abeb5e8f796bf6bbe8432972adb60b3e2a Gerrit-Change-Number: 1243 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --42A/DmPMwUM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #3 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

unit_tests: Remove useless wrapping=
 for argv/buffer tests

If not using mock() or check_expected(), and<= br>not linking the original function, then there
is no need for wrapping= support.

Change-Id: I937105abeb5e8f796bf6bbe8432972adb60b3e2a
Si= gned-off-by: Frank Lichtenheld <frank@...2641...>
Acked-by: Gert D= oering <gert@...1296...>
Gerrit URL: https://gerrit.openvpn.net/c/= openvpn/+/1243
Message-Id: <20251007185217.19381-1-gert@...1296...>= ;
URL: https://sourceforge.net/p/openvpn/mailman/message/59243508/
Si= gned-off-by: Gert Doering <gert@...1296...>
---
M CMakeLists.tx= t
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/t= est_argv.c
3 files changed, 10 insertions(+), 14 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chang=
es/43/1243/3
diff --git a/CMakeLists.txt b/CMakeLists.txtindex be66357..aeef480 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -654,6 +654,7 @@
endif ()

set(unit_= tests
+ "= test_argv"
"test_auth_token"=
"test_buffer"
"t= est_crypto"
@@ -684,7 +685,6 @@
#= Clang-cl (which is also MSVC) is wrongly detected to support wrap if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
list(APPEND unit_tests

- "test_argv"
= "test_tls_crypt"
)
endif ()

@@ -887,13 +887,10 @@
= src/openvpn/list.c
)
- if (TARGET test_argv)
- target_link_option= s(test_argv PRIVATE -Wl,--wrap=3Dparse_line)
- target_sources(test_argv PRIVATE
<= span style=3D"color: hsl(0, 100%, 40%);">- tests/unit_tests/open= vpn/mock_get_random.c

-= src/openvpn/argv.c
- )
= - endif ()
+ ta= rget_sources(test_argv PRIVATE
+ tests/unit_tests/openvpn/mock_get_random.c
+ src/openvpn/argv.c=
+ )
=
if (TARGET test_cryptoapi)
= target_sources(test_cryptoapi PRIVATE
diff --git a/tests/un= it_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am<= br>index ec8cc69..f7b1bc8 100644
--- a/tests/unit_tes= ts/openvpn/Makefile.am
+++ b/tests/unit_tests/openvpn/Makef= ile.am
@@ -4,12 +4,11 @@

= AM_TESTSUITE_SUMMARY_HEADER =3D ' for $(PACKAGE_STRING) Unit-Tests'= ;

-te= st_binaries =3D crypto_testdriver packet_id_testdriver auth_token_testdrive= r \
+test_binaries = =3D argv_testdriver buffer_testdriver crypto_testdriver packet_id_testdrive= r auth_token_testdriver \
ncp_testdriver misc_testdriver = pkt_testdriver ssl_testdriver \
user_pass_testdriver push= _update_msg_testdriver provider_testdriver socket_testdriver

if HAVE_LD_WRAP_SUPPORT
-test_binaries +=3D argv_testdriver buffer_testdriver=
if !WIN32
test_binaries +=3D tls_crypt_t= estdriver
endif
@@ -36,7 +35,7 @@ endif

argv_testdriver_CFLAGS = =3D -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
-argv_testdriver_LDFLAGS = =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl,--wrap=3Dparse_line

+argv_testdriver_LDFLAGS = =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn
argv_testdr= iver_SOURCES =3D test_argv.c \
mock_msg.c mock_msg.h test= _common.h \
mock_get_random.c \
@@ -46,7 = +45,7 @@
$(top_srcdir)/src/openvpn/argv.c

buffer_testdriver_CFLAGS =3D -I$(top_srcdir)/src/openv= pn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
-buffer_testdriver_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_= srcdir)/src/openvpn -Wl,--wrap=3Dparse_line
+buffer_testdriver_LDFLAGS =3D @TEST_LDFLAGS@ -L$(to= p_srcdir)/src/openvpn
buffer_testdriver_SOURCES =3D test_b= uffer.c \
mock_msg.c mock_msg.h test_common.h \ mock_get_random.c \
diff --git a/tests/unit_tests/= openvpn/test_argv.c b/tests/unit_tests/openvpn/test_argv.c
= index a04fabc..25c0371 100644
--- a/tests/unit_tests/openvp= n/test_argv.c
+++ b/tests/unit_tests/openvpn/test_argv.c
@@ -22,8 +22,8 @@
#define SCRIPT_CMD "\= "" PATH1 PATH2 "\"" PARAM1 "\"" PAR= AM2 "\""

int
-__wrap_parse_line(const char *line= , char **p, const int n, const char *file, const int line_num,

- msglvl_t msgleve= l, struct gc_arena *gc)
+parse_line(const char *line, char **p, const int n, const char *file, c= onst int line_num,
+ = msglvl_t msglevel, struct gc_arena *gc)
{=
p[0] =3D PATH1 PATH2;
p[1] =3D PARAM1;<= /span>

To view, visit change 1243. To unsubscribe,= or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I937105abeb5e8f796bf6bbe8432= 972adb60b3e2a
Gerrit-Change-Number: 1243
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --42A/DmPMwUM=--