]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
unit_tests: Remove useless wrapping for argv/buffer tests
authorFrank Lichtenheld <frank@lichtenheld.com>
Tue, 7 Oct 2025 18:52:09 +0000 (20:52 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 7 Oct 2025 20:16:11 +0000 (22:16 +0200)
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 <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1243
Message-Id: <20251007185217.19381-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243508/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
CMakeLists.txt
tests/unit_tests/openvpn/Makefile.am
tests/unit_tests/openvpn/test_argv.c

index be6635734734ef6b56120aa7690418fc8e74c9b3..aeef480ea749ac7d5b06b1c9f04dc979cf9eb644 100644 (file)
@@ -654,6 +654,7 @@ if (BUILD_TESTING)
     endif ()
 
     set(unit_tests
+        "test_argv"
         "test_auth_token"
         "test_buffer"
         "test_crypto"
@@ -684,7 +685,6 @@ if (BUILD_TESTING)
     # 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 @@ if (BUILD_TESTING)
         src/openvpn/list.c
         )
 
-    if (TARGET test_argv)
-        target_link_options(test_argv PRIVATE -Wl,--wrap=parse_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
index ec8cc69a0acb4218ee827be50b9da03ee6558f0e..f7b1bc82483a519a6f6a23113f09fd1a26b46794 100644 (file)
@@ -4,12 +4,11 @@ EXTRA_DIST = input
 
 AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests'
 
-test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \
+test_binaries = argv_testdriver buffer_testdriver crypto_testdriver packet_id_testdriver 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 += argv_testdriver buffer_testdriver
 if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
@@ -36,7 +35,7 @@ check_PROGRAMS += networking_testdriver
 endif
 
 argv_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
-argv_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl,--wrap=parse_line
+argv_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn
 argv_testdriver_SOURCES = test_argv.c \
        mock_msg.c mock_msg.h test_common.h \
        mock_get_random.c \
@@ -46,7 +45,7 @@ argv_testdriver_SOURCES = test_argv.c \
        $(top_srcdir)/src/openvpn/argv.c
 
 buffer_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
-buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl,--wrap=parse_line
+buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn
 buffer_testdriver_SOURCES = test_buffer.c \
        mock_msg.c mock_msg.h test_common.h \
        mock_get_random.c \
index a04fabcbac37e4ae559c0e585fd0c3cf02944d38..25c03713e47443a4c50dbc42cbf5abaa13c5094c 100644 (file)
@@ -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 *file, const int line_num,
-                  msglvl_t msglevel, struct gc_arena *gc)
+parse_line(const char *line, char **p, const int n, const char *file, const int line_num,
+           msglvl_t msglevel, struct gc_arena *gc)
 {
     p[0] = PATH1 PATH2;
     p[1] = PARAM1;