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>
| ... | ... |
@@ -654,6 +654,7 @@ if (BUILD_TESTING) |
| 654 | 654 |
endif () |
| 655 | 655 |
|
| 656 | 656 |
set(unit_tests |
| 657 |
+ "test_argv" |
|
| 657 | 658 |
"test_auth_token" |
| 658 | 659 |
"test_buffer" |
| 659 | 660 |
"test_crypto" |
| ... | ... |
@@ -684,7 +685,6 @@ if (BUILD_TESTING) |
| 684 | 684 |
# Clang-cl (which is also MSVC) is wrongly detected to support wrap |
| 685 | 685 |
if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
|
| 686 | 686 |
list(APPEND unit_tests |
| 687 |
- "test_argv" |
|
| 688 | 687 |
"test_tls_crypt" |
| 689 | 688 |
) |
| 690 | 689 |
endif () |
| ... | ... |
@@ -887,13 +887,10 @@ if (BUILD_TESTING) |
| 887 | 887 |
src/openvpn/list.c |
| 888 | 888 |
) |
| 889 | 889 |
|
| 890 |
- if (TARGET test_argv) |
|
| 891 |
- target_link_options(test_argv PRIVATE -Wl,--wrap=parse_line) |
|
| 892 |
- target_sources(test_argv PRIVATE |
|
| 893 |
- tests/unit_tests/openvpn/mock_get_random.c |
|
| 894 |
- src/openvpn/argv.c |
|
| 895 |
- ) |
|
| 896 |
- endif () |
|
| 890 |
+ target_sources(test_argv PRIVATE |
|
| 891 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 892 |
+ src/openvpn/argv.c |
|
| 893 |
+ ) |
|
| 897 | 894 |
|
| 898 | 895 |
if (TARGET test_cryptoapi) |
| 899 | 896 |
target_sources(test_cryptoapi PRIVATE |
| ... | ... |
@@ -4,12 +4,11 @@ EXTRA_DIST = input |
| 4 | 4 |
|
| 5 | 5 |
AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' |
| 6 | 6 |
|
| 7 |
-test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ |
|
| 7 |
+test_binaries = argv_testdriver buffer_testdriver crypto_testdriver packet_id_testdriver auth_token_testdriver \ |
|
| 8 | 8 |
ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ |
| 9 | 9 |
user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver |
| 10 | 10 |
|
| 11 | 11 |
if HAVE_LD_WRAP_SUPPORT |
| 12 |
-test_binaries += argv_testdriver buffer_testdriver |
|
| 13 | 12 |
if !WIN32 |
| 14 | 13 |
test_binaries += tls_crypt_testdriver |
| 15 | 14 |
endif |
| ... | ... |
@@ -36,7 +35,7 @@ check_PROGRAMS += networking_testdriver |
| 36 | 36 |
endif |
| 37 | 37 |
|
| 38 | 38 |
argv_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@ |
| 39 |
-argv_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl,--wrap=parse_line |
|
| 39 |
+argv_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn |
|
| 40 | 40 |
argv_testdriver_SOURCES = test_argv.c \ |
| 41 | 41 |
mock_msg.c mock_msg.h test_common.h \ |
| 42 | 42 |
mock_get_random.c \ |
| ... | ... |
@@ -46,7 +45,7 @@ argv_testdriver_SOURCES = test_argv.c \ |
| 46 | 46 |
$(top_srcdir)/src/openvpn/argv.c |
| 47 | 47 |
|
| 48 | 48 |
buffer_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@ |
| 49 |
-buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn -Wl,--wrap=parse_line |
|
| 49 |
+buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn |
|
| 50 | 50 |
buffer_testdriver_SOURCES = test_buffer.c \ |
| 51 | 51 |
mock_msg.c mock_msg.h test_common.h \ |
| 52 | 52 |
mock_get_random.c \ |
| ... | ... |
@@ -22,8 +22,8 @@ |
| 22 | 22 |
#define SCRIPT_CMD "\"" PATH1 PATH2 "\"" PARAM1 "\"" PARAM2 "\"" |
| 23 | 23 |
|
| 24 | 24 |
int |
| 25 |
-__wrap_parse_line(const char *line, char **p, const int n, const char *file, const int line_num, |
|
| 26 |
- msglvl_t msglevel, struct gc_arena *gc) |
|
| 25 |
+parse_line(const char *line, char **p, const int n, const char *file, const int line_num, |
|
| 26 |
+ msglvl_t msglevel, struct gc_arena *gc) |
|
| 27 | 27 |
{
|
| 28 | 28 |
p[0] = PATH1 PATH2; |
| 29 | 29 |
p[1] = PARAM1; |