Skip to contentSkip to conversation

Conditionally add subdir-objects option to automake

PATCH In review [email protected]... 4 participants 21 messages Feb 4, 2023 – Mar 8, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Conditionally add subdir-objects option to automake

From: Selva Nair <[email protected]...>

- Eliminates repeated warnings such as
warning: source file '$(openvpn_srcdir)/env_set.c' is in a subdirectory, but option 'subdir-objects' is disabled
- Enabled only for automake >= 1.16 as older versions have a buggy implementation of this option

Main side effect of this option is that object files like openvpnserv-blockdns.o are now created in src/openvpn where block-dns.c resides instead of in src/openvpnserv. Same for object files for sources from $(openvpn_srcdir) compiled into test executables.

See also past discussion on this topic:
https://www.mail-archive.com/[email protected]/msg00013.html

---
 configure.ac | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
configure.ac +14 -1
index 91500087..95d795c3 100644
@@ -54,9 +54,22 @@ m4_define([serial_tests], [
                 awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
     ])
 ])
+
+dnl Automake 1.14+ warns if sources are in sub-directories but subdir-objects
+dnl options is not enabled. However, automake before 1.15a has a bug that causes
+dnl variable expansion to fail in foo_SOURCES when this option is used.
+dnl As most of our build systems are now likely to use automake 1.16+ add a
+dnl work around to conditionally add subdir-objects option.
+m4_define([subdir_objects], [
+    m4_esyscmd([automake --version |
+                head -1 |
+                awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 16) { print "subdir-objects" }}'
+    ])
+])
+
 # This foreign option prevents autoreconf from overriding our COPYING and
 # INSTALL targets:
-AM_INIT_AUTOMAKE(foreign serial_tests 1.9) dnl NB: Do not [quote] this parameter.
+AM_INIT_AUTOMAKE(foreign serial_tests subdir_objects 1.9) dnl NB: Do not [quote] this parameter.
 AC_CANONICAL_HOST
 AC_USE_SYSTEM_EXTENSIONS
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 Build unit tests in mingw Windows build

From: Selva Nair <[email protected]...>

- Minor changes to the build system to include some dependencies for Windows build

- test_tls_crypt not built as it will pull in win32.c and its dependencies

- If cross-compiling, "make check" will only build the tests but not run any. Copy to Windows and run manually. Executables are in <buid-dir>/tests/unit_tests/openvpn/.libs/ and these depend on cmocka.dll in addition to openssl libs that some tests link to.

Building with mingw on Windows should run the tests (untested).

---
 configure.ac                              |  2 ++
 tests/Makefile.am                         |  2 ++
 tests/unit_tests/example_test/Makefile.am |  2 ++
 tests/unit_tests/openvpn/Makefile.am      | 35 +++++++++++++++++------
 4 files changed, 33 insertions(+), 8 deletions(-)
configure.ac +2 -0
index 95d795c3..66ba6f38 100644
@@ -364,6 +364,8 @@ case "$host" in
 		;;
 esac
 
+AM_CONDITIONAL([CROSS_COMPILING], test "${cross_compiling}" = "yes")
+
 PKG_PROG_PKG_CONFIG
 AC_PROG_CPP
 AC_PROG_INSTALL
tests/Makefile.am +2 -0
index 87dd7e17..a46f2573 100644
@@ -14,10 +14,12 @@ MAINTAINERCLEANFILES = \
 
 SUBDIRS = unit_tests
 
+if !WIN32
 test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh
 if HAVE_SITNL
 test_scripts += t_net.sh
 endif
+endif
 
 TESTS_ENVIRONMENT = top_srcdir="$(top_srcdir)"
 TESTS = $(test_scripts)
tests/unit_tests/example_test/Makefile.am +2 -0
index 04a5ad35..24eb0ba1 100644
@@ -2,7 +2,9 @@ AUTOMAKE_OPTIONS = foreign
 
 check_PROGRAMS = example_testdriver example2_testdriver
 
+if !CROSS_COMPILING
 TESTS = $(check_PROGRAMS)
+endif
 
 example_testdriver_CFLAGS  = @TEST_CFLAGS@
 example_testdriver_LDFLAGS = @TEST_LDFLAGS@
tests/unit_tests/openvpn/Makefile.am +27 -8
index 7720a85d..909ac4e2 100644
@@ -7,20 +7,29 @@ test_binaries += argv_testdriver buffer_testdriver
 endif
 
 test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \
-    pkt_testdriver
+pkt_testdriver
 if HAVE_LD_WRAP_SUPPORT
+if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
+endif
 
 test_binaries += provider_testdriver
 
-TESTS = $(test_binaries)
-check_PROGRAMS = $(test_binaries)
+if WIN32
+test_binaries += cryptoapi_testdriver
+LDADD = -lws2_32
+endif
 
 if HAVE_SITNL
-check_PROGRAMS += networking_testdriver
+test_binaries += networking_testdriver
 endif
 
+if !CROSS_COMPILING
+TESTS = $(test_binaries)
+endif
+check_PROGRAMS = $(test_binaries)
+
 openvpn_includedir = $(top_srcdir)/include
 openvpn_srcdir = $(top_srcdir)/src/openvpn
 compat_srcdir = $(top_srcdir)/src/compat
@@ -31,12 +40,14 @@ argv_testdriver_SOURCES = test_argv.c mock_msg.c mock_msg.h \
 	mock_get_random.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/buffer.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/argv.c
 
 buffer_testdriver_CFLAGS  = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
 buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(openvpn_srcdir) -Wl,--wrap=parse_line
 buffer_testdriver_SOURCES = test_buffer.c mock_msg.c mock_msg.h \
 	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
 crypto_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -51,6 +62,7 @@ crypto_testdriver_SOURCES = test_crypto.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/mtu.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/mss.c
 
 packet_id_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -63,14 +75,14 @@ packet_id_testdriver_SOURCES = test_packet_id.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/reliable.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/session_id.c
 
-
 pkt_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir)
 pkt_testdriver_LDFLAGS = @TEST_LDFLAGS@
 pkt_testdriver_SOURCES = test_pkt.c mock_msg.c mock_msg.h \
-$(openvpn_srcdir)/argv.c \
+	$(openvpn_srcdir)/argv.c \
 	$(openvpn_srcdir)/base64.c \
 	$(openvpn_srcdir)/buffer.c \
 	$(openvpn_srcdir)/crypto.c \
@@ -84,9 +96,10 @@ $(openvpn_srcdir)/argv.c \
 	$(openvpn_srcdir)/run_command.c \
 	$(openvpn_srcdir)/session_id.c \
 	$(openvpn_srcdir)/ssl_pkt.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/tls_crypt.c
 
-
+if !WIN32
 tls_crypt_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir)
 tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
@@ -106,6 +119,7 @@ tls_crypt_testdriver_SOURCES = test_tls_crypt.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/run_command.c
+endif
 
 if HAVE_SITNL
 networking_testdriver_CFLAGS = @TEST_CFLAGS@ \
@@ -136,6 +150,7 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \
 	$(openvpn_srcdir)/buffer.c \
 	$(openvpn_srcdir)/base64.c \
 	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
 auth_token_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -152,6 +167,7 @@ auth_token_testdriver_SOURCES = test_auth_token.c mock_msg.c \
 	$(openvpn_srcdir)/otime.c \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/base64.c
 
 
@@ -169,6 +185,8 @@ ncp_testdriver_SOURCES = test_ncp.c mock_msg.c \
 	$(openvpn_srcdir)/otime.c \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
+	$(openvpn_srcdir)/win32-util.c \
+	$(compat_srcdir)/compat-strsep.c \
 	$(openvpn_srcdir)/ssl_util.c
 
 misc_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -177,8 +195,9 @@ misc_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 misc_testdriver_LDFLAGS = @TEST_LDFLAGS@
 
 misc_testdriver_SOURCES = test_misc.c mock_msg.c \
-    mock_get_random.c \
+	mock_get_random.c \
 	$(openvpn_srcdir)/buffer.c \
 	$(openvpn_srcdir)/options_util.c \
 	$(openvpn_srcdir)/ssl_util.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/3 Build unit tests in mingw Windows build

From: Selva Nair <[email protected]...>

- Minor changes to the build system to include some dependencies for Windows build

- test_tls_crypt not built as it will pull in win32.c and its dependencies

- If cross-compiling, "make check" will only build the tests but not run any. Copy to Windows and run manually. Executables are in <buid-dir>/tests/unit_tests/openvpn/.libs/ and these depend on cmocka.dll in addition to openssl libs that some tests link to.

Building with mingw on Windows should run the tests (untested).

v2: networking_testdriver was mistakenly enabled to run, while originally it was only set to build. Corrected.

---
 configure.ac                              |  2 ++
 tests/Makefile.am                         |  2 ++
 tests/unit_tests/example_test/Makefile.am |  2 ++
 tests/unit_tests/openvpn/Makefile.am      | 28 +++++++++++++++++++----
 4 files changed, 29 insertions(+), 5 deletions(-)
configure.ac +2 -0
index 95d795c3..66ba6f38 100644
@@ -364,6 +364,8 @@ case "$host" in
 		;;
 esac
 
+AM_CONDITIONAL([CROSS_COMPILING], test "${cross_compiling}" = "yes")
+
 PKG_PROG_PKG_CONFIG
 AC_PROG_CPP
 AC_PROG_INSTALL
tests/Makefile.am +2 -0
index 87dd7e17..a46f2573 100644
@@ -14,10 +14,12 @@ MAINTAINERCLEANFILES = \
 
 SUBDIRS = unit_tests
 
+if !WIN32
 test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh
 if HAVE_SITNL
 test_scripts += t_net.sh
 endif
+endif
 
 TESTS_ENVIRONMENT = top_srcdir="$(top_srcdir)"
 TESTS = $(test_scripts)
tests/unit_tests/example_test/Makefile.am +2 -0
index 04a5ad35..24eb0ba1 100644
@@ -2,7 +2,9 @@ AUTOMAKE_OPTIONS = foreign
 
 check_PROGRAMS = example_testdriver example2_testdriver
 
+if !CROSS_COMPILING
 TESTS = $(check_PROGRAMS)
+endif
 
 example_testdriver_CFLAGS  = @TEST_CFLAGS@
 example_testdriver_LDFLAGS = @TEST_LDFLAGS@
tests/unit_tests/openvpn/Makefile.am +23 -5
index 7720a85d..8d2386e0 100644
@@ -7,14 +7,22 @@ test_binaries += argv_testdriver buffer_testdriver
 endif
 
 test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \
-    pkt_testdriver
+	pkt_testdriver
 if HAVE_LD_WRAP_SUPPORT
+if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
+endif
 
 test_binaries += provider_testdriver
 
+if WIN32
+LDADD = -lws2_32
+endif
+
+if !CROSS_COMPILING
 TESTS = $(test_binaries)
+endif
 check_PROGRAMS = $(test_binaries)
 
 if HAVE_SITNL
@@ -31,12 +39,14 @@ argv_testdriver_SOURCES = test_argv.c mock_msg.c mock_msg.h \
 	mock_get_random.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/buffer.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/argv.c
 
 buffer_testdriver_CFLAGS  = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
 buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(openvpn_srcdir) -Wl,--wrap=parse_line
 buffer_testdriver_SOURCES = test_buffer.c mock_msg.c mock_msg.h \
 	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
 crypto_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -51,6 +61,7 @@ crypto_testdriver_SOURCES = test_crypto.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/mtu.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/mss.c
 
 packet_id_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -63,14 +74,14 @@ packet_id_testdriver_SOURCES = test_packet_id.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/reliable.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/session_id.c
 
-
 pkt_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir)
 pkt_testdriver_LDFLAGS = @TEST_LDFLAGS@
 pkt_testdriver_SOURCES = test_pkt.c mock_msg.c mock_msg.h \
-$(openvpn_srcdir)/argv.c \
+	$(openvpn_srcdir)/argv.c \
 	$(openvpn_srcdir)/base64.c \
 	$(openvpn_srcdir)/buffer.c \
 	$(openvpn_srcdir)/crypto.c \
@@ -84,9 +95,10 @@ $(openvpn_srcdir)/argv.c \
 	$(openvpn_srcdir)/run_command.c \
 	$(openvpn_srcdir)/session_id.c \
 	$(openvpn_srcdir)/ssl_pkt.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/tls_crypt.c
 
-
+if !WIN32
 tls_crypt_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir)
 tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
@@ -106,6 +118,7 @@ tls_crypt_testdriver_SOURCES = test_tls_crypt.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/run_command.c
+endif
 
 if HAVE_SITNL
 networking_testdriver_CFLAGS = @TEST_CFLAGS@ \
@@ -136,6 +149,7 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \
 	$(openvpn_srcdir)/buffer.c \
 	$(openvpn_srcdir)/base64.c \
 	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
 auth_token_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -152,6 +166,7 @@ auth_token_testdriver_SOURCES = test_auth_token.c mock_msg.c \
 	$(openvpn_srcdir)/otime.c \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/base64.c
 
 
@@ -169,6 +184,8 @@ ncp_testdriver_SOURCES = test_ncp.c mock_msg.c \
 	$(openvpn_srcdir)/otime.c \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c \
+	$(openvpn_srcdir)/win32-util.c \
+	$(compat_srcdir)/compat-strsep.c \
 	$(openvpn_srcdir)/ssl_util.c
 
 misc_testdriver_CFLAGS  = @TEST_CFLAGS@ \
@@ -177,8 +194,9 @@ misc_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 misc_testdriver_LDFLAGS = @TEST_LDFLAGS@
 
 misc_testdriver_SOURCES = test_misc.c mock_msg.c \
-    mock_get_random.c \
+	mock_get_random.c \
 	$(openvpn_srcdir)/buffer.c \
 	$(openvpn_srcdir)/options_util.c \
 	$(openvpn_srcdir)/ssl_util.c \
+	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/3 Add a unit test for functions in cryptoapi.c

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More tests coming..

v2: a line that belongs here was mistakenly included in the previous commit. Corrected.

---
 tests/unit_tests/openvpn/Makefile.am      |  16 +++
 tests/unit_tests/openvpn/test_cryptoapi.c | 126 ++++++++++++++++++++++
 2 files changed, 142 insertions(+)
 create mode 100644 tests/unit_tests/openvpn/test_cryptoapi.c
tests/unit_tests/openvpn/Makefile.am +16 -0
index 8d2386e0..ee0a3d8a 100644
@@ -17,6 +17,7 @@ endif
 test_binaries += provider_testdriver
 
 if WIN32
+test_binaries += cryptoapi_testdriver
 LDADD = -lws2_32
 endif
 
@@ -152,6 +153,21 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \
 	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
+if WIN32
+cryptoapi_testdriver_CFLAGS  = @TEST_CFLAGS@ \
+	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
+	$(OPTIONAL_CRYPTO_CFLAGS)
+cryptoapi_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
+	$(OPTIONAL_CRYPTO_LIBS) -lcrypt32 -lncrypt
+cryptoapi_testdriver_SOURCES = test_cryptoapi.c mock_msg.c \
+	$(openvpn_srcdir)/xkey_helper.c \
+	$(openvpn_srcdir)/buffer.c \
+	$(openvpn_srcdir)/base64.c \
+	$(openvpn_srcdir)/platform.c \
+	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c
+endif
+
 auth_token_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
 	$(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_cryptoapi.c new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [Openvpn-devel] [PATCH v2 3/3] Add a unit test for functions in cryptoapi.c

Am 04.02.23 um 07:40 schrieb [email protected]...:

Quoted 10 lines

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More tests coming..

v2: a line that belongs here was mistakenly included in the previous commit. Corrected.

While a good step, this still has problems. With OpenSSL 1.1.1 it still tries to run the check-engine.sh script and unsurprisingly fails:

---- begin log.txt ----
./check_engine_keys.sh: 25: ../../../src/openvpn/openvpn: not found --- end log.txt ---
Key mismatch not detected
FAIL: check_engine_keys.sh

This can be fixed by:

tests/unit_tests/engine-key/Makefile.am +2 -0
@@ -12,7 +12,9 @@ TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
        top_srcdir="$(top_srcdir)"; \
        export srcdir builddir top_builddir top_srcdir;
 
+if !CROSS_COMPILING
 TESTS = check_engine_keys.sh
+endif
 check_engine_keys.sh: $(conffiles)
 
 CLEANFILES = \

I have working github actions for this running which was a real pain to get working. I will send this after we get a v3 of the patch with that patch above included.

Then my mingw seems to be more pendantic then every other compiler. I will send a separate patch for that on the mailing list.

Also libtool is utterly broken on my mingw cross building on the mac:

libtool:   error: Could not determine the host path corresponding to
libtool:   error: '/Users/arne/ovpn/mingw64/lib:/Users/arne/ovpn/mingw64/bin:/Users/arne/ovpn/deps-mingw64/lib:/Users/arne/ovpn/deps-mingw64/bin'
libtool:   error: Continuing, but uninstalled executables may not work.
./.libs/lt-provider_testdriver.c:41:5: warning: '_putenv' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
   41 | int _putenv (const char *);
      |     ^~~~~~~

./.libs/lt-provider_testdriver.c: In function 'lt_dump_script':
./.libs/lt-provider_testdriver.c:837:10: warning: missing terminating " character
837 | fputs ("# provider_testdriver - temporary wrapper script for
.libs/provider_testdriver.
| ^
./.libs/lt-provider_testdriver.c:837:10: error: missing terminating " character
837 | fputs ("# provider_testdriver - temporary wrapper script for
.libs/provider_testdriver.

      | 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./.libs/lt-provider_testdriver.c:838:4: warning: missing terminating " character
  838 | exe", f);
      |    ^

From the lt-provider_testdriver.c:

void lt_dump_script (FILE* f)
{
fputs ("#! /bi", f);
fputs ("", f);
fputs ("# packet_id_testdriver - temporary wrapper script for
.libs/packet_id_testdrive
r.exe", f);
fputs ("r.exe", f);
fputs ("# Ge", f);
fputs ("#", f);
fputs ("#", f);
fputs ("# This wrapper script should ", f);
fputs ("# If it is, it will ", f);
fputs ("", f);
fputs ("# Sed substitutio", f);
fputs ("# metacharacters that are still active withi", f); fputs ("sed_quote_subst='s|", f);
fputs ("", f);
fputs ("# Be Bour", f);
fputs ("if test -", f);

  fputs ("  emulate sh", f);
  fputs ("  NULLCMD=:", f);
  fputs ("  # Zsh 3.x a", f);
  fputs ("  # is co", f);

I have to say the autoconf/libtool/automake is pretty broken here and I absolutely no idea how to fix it. Any idea or help would be appricated.

Arne

author
#5 lore raw

Re: [Openvpn-devel] [PATCH v2 3/3] Add a unit test for functions in cryptoapi.c

Hi,

Quoted 27 lines · Arne Schwabe

Am 04.02.23 um 07:40 schrieb [email protected]...:

Quoted 10 lines

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More tests coming..

v2: a line that belongs here was mistakenly included in the previous commit. Corrected.

While a good step, this still has problems. With OpenSSL 1.1.1 it still tries to run the check-engine.sh script and unsurprisingly fails:

---- begin log.txt ----
./check_engine_keys.sh: 25: ../../../src/openvpn/openvpn: not found --- end log.txt ---
Key mismatch not detected
FAIL: check_engine_keys.sh

This can be fixed by:

tests/unit_tests/engine-key/Makefile.am TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \ · line 20

Quoted 9 lines
tests/unit_tests/engine-key/Makefile.am +2 -0
@@ -12,7 +12,9 @@ TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
         top_srcdir="$(top_srcdir)"; \
         export srcdir builddir top_builddir top_srcdir;
 
+if !CROSS_COMPILING
  TESTS = check_engine_keys.sh
+endif
  check_engine_keys.sh: $(conffiles)
 
  CLEANFILES = \

Thanks for this. I added this to 2/3 where it belongs and submitted it as v3 2/3. With that, this patch should be okay as is.

For those not following closely, this patch should be applied after the cryptoapi patch set where the function being tested here is introduced.

Selva

#6 lore raw

Re: [Openvpn-devel] [PATCH v2 3/3] Add a unit test for functions in cryptoapi.c

Am 08.02.23 um 02:05 schrieb Selva Nair:

Quoted 43 lines

Hi,

On Tue, Feb 7, 2023 at 7:18 PM Arne Schwabe <[email protected]... <mailto:[email protected]...>> wrote:

    Am 04.02.23 um 07:40 schrieb [email protected]...
    <mailto:[email protected]...>:
     > From: Selva Nair <[email protected]... <mailto:[email protected]...>>
     >
     > - Though named cryptoapi_testdriver, right now this only tests
     >    parsing of thumbprint specified as a selector for --cryptioapicert
     >    option. More tests coming..
     >
     > v2: a line that belongs here was mistakenly included in the previous
     > commit. Corrected.
     >
     > Signed-off-by: Selva Nair <[email protected]...
    <mailto:[email protected]...>>

    While a good step, this still has problems. With OpenSSL 1.1.1 it still
    tries to run the check-engine.sh script and unsurprisingly fails:

    ---- begin log.txt ----
    ./check_engine_keys.sh: 25: ../../../src/openvpn/openvpn: not found
    --- end log.txt ---
    Key mismatch not detected
    FAIL: check_engine_keys.sh

    This can be fixed by:

    --- a/tests/unit_tests/engine-key/Makefile.am
    +++ b/tests/unit_tests/engine-key/Makefile.am
    @@ -12,7 +12,9 @@ TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
              top_srcdir="$(top_srcdir)"; \
              export srcdir builddir top_builddir top_srcdir;

    +if !CROSS_COMPILING
       TESTS = check_engine_keys.sh
    +endif
       check_engine_keys.sh: $(conffiles)

       CLEANFILES = \
Quoted 5 lines

Thanks for this. I added this to 2/3 where it belongs and submitted it as v3 2/3. With that, this patch should be okay as is.

For those not following closely, this patch  should be applied after the cryptoapi patch set where the function being tested here is introduced.

Selva

No, I think this that is independent. This is about the engine keys support added by James Bottomley. I needed and tested this patch without the cryptoapi patch.

Arne

author
#7 lore raw

Re: [Openvpn-devel] [PATCH v2 3/3] Add a unit test for functions in cryptoapi.c

Quoted 52 lines · Arne Schwabe

Am 08.02.23 um 02:05 schrieb Selva Nair:

Quoted 8 lines

Hi,

On Tue, Feb 7, 2023 at 7:18 PM Arne Schwabe <[email protected]... <mailto:[email protected]...>> wrote:

    Am 04.02.23 um 07:40 schrieb [email protected]...
    <mailto:[email protected]...>:
     > From: Selva Nair <[email protected]... <mailto:

[email protected]...>>

Quoted 3 lines

>
> - Though named cryptoapi_testdriver, right now this only tests
> parsing of thumbprint specified as a selector for

--cryptioapicert

Quoted 3 lines

> option. More tests coming..
>
> v2: a line that belongs here was mistakenly included in the

previous

Quoted 6 lines
     > commit. Corrected.
     >
     > Signed-off-by: Selva Nair <[email protected]...
    <mailto:[email protected]...>>

    While a good step, this still has problems. With OpenSSL 1.1.1 it

still

Quoted 27 lines
    tries to run the check-engine.sh script and unsurprisingly fails:

    ---- begin log.txt ----
    ./check_engine_keys.sh: 25: ../../../src/openvpn/openvpn: not found
    --- end log.txt ---
    Key mismatch not detected
    FAIL: check_engine_keys.sh

    This can be fixed by:

    --- a/tests/unit_tests/engine-key/Makefile.am
    +++ b/tests/unit_tests/engine-key/Makefile.am
    @@ -12,7 +12,9 @@ TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
              top_srcdir="$(top_srcdir)"; \
              export srcdir builddir top_builddir top_srcdir;

    +if !CROSS_COMPILING
       TESTS = check_engine_keys.sh
    +endif
       check_engine_keys.sh: $(conffiles)

       CLEANFILES = \

Thanks for this. I added this to 2/3 where it belongs and submitted it as v3 2/3. With that, this patch should be okay as is.

Quoted 9 lines
Quoted 4 lines

For those not following closely, this patch should be applied after the cryptoapi patch set where the function being tested here is introduced.

Selva

No, I think this that is independent. This is about the engine keys support added by James Bottomley. I needed and tested this patch without the cryptoapi patch.

Got that. I think gmail is messing up my thread view -- this email appear for me as linked to my original 3/3 which is on the test for cryptoapi. That's why I wrote "this patch should be okay as is." Anyway...

Will look into your patches later today.

Selva

#8 lore raw

Re: [Openvpn-devel] [PATCH v2 3/3] Add a unit test for functions in cryptoapi.c

In reply to [email protected]...

Hi,

Quoted 8 lines · On Sat, Feb 04, 2023 at 01:40:10AM -0500, [email protected]... wrote:

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More tests coming..

v2: a line that belongs here was mistakenly included in the previous commit. Corrected.

So, unit test are good, especially for the Windows bits that could really use more testing - so thanks for that.

OTOH, having the test here without adding it to .github/workflows/build.yaml means "it not run automatically". How do we want to do that, do you want to send a v3 with build.yaml extended, or shall I merge this as is, and we do a separate patch "... and now run the unit test"?

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#9 lore raw

PATCH v3 3/3 Add a unit test for functions in cryptoapi.c

In reply to [email protected]...

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More tests coming..

v2: a line that belongs here was mistakenly included in the previous commit. Corrected.
v3: add to list of tests run in github actions

fixup

---
 .github/workflows/build.yaml              |   3 +
 tests/unit_tests/openvpn/Makefile.am      |  16 +++
 tests/unit_tests/openvpn/test_cryptoapi.c | 126 ++++++++++++++++++++++
 3 files changed, 145 insertions(+)
 create mode 100644 tests/unit_tests/openvpn/test_cryptoapi.c
.github/workflows/build.yaml +3 -0
index 699964fd..5bd6da89 100644
@@ -243,6 +243,9 @@ jobs:
       - name: Run bufferunit test
         run: ./unittests/buffer_testdriver.exe
 
+      - name: Run cryptoapi unit test
+        run: ./unittests/cryptoapi_testdriver.exe
+
       - name: Run cryptounit test
         run: ./unittests/crypto_testdriver.exe
 
tests/unit_tests/openvpn/Makefile.am +16 -0
index 8d2386e0..ee0a3d8a 100644
@@ -17,6 +17,7 @@ endif
 test_binaries += provider_testdriver
 
 if WIN32
+test_binaries += cryptoapi_testdriver
 LDADD = -lws2_32
 endif
 
@@ -152,6 +153,21 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \
 	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
+if WIN32
+cryptoapi_testdriver_CFLAGS  = @TEST_CFLAGS@ \
+	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
+	$(OPTIONAL_CRYPTO_CFLAGS)
+cryptoapi_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
+	$(OPTIONAL_CRYPTO_LIBS) -lcrypt32 -lncrypt
+cryptoapi_testdriver_SOURCES = test_cryptoapi.c mock_msg.c \
+	$(openvpn_srcdir)/xkey_helper.c \
+	$(openvpn_srcdir)/buffer.c \
+	$(openvpn_srcdir)/base64.c \
+	$(openvpn_srcdir)/platform.c \
+	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c
+endif
+
 auth_token_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
 	$(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_cryptoapi.c new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
2.34.1
#10 lore raw

PATCH v4 3/3 Add a unit test for functions in cryptoapi.c

In reply to [email protected]...

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More tests coming..

v2: a line that belongs here was mistakenly included in the previous commit. Corrected.
v3: add to list of tests run in github actions
v4: - correct comment above invalid strings (copy paste error)
- make invalid strings differ from correct value only in the explicitly introduced invalid characters/separators (one had two distinct errors which is not a robust test).

---
Sorry for not noticing these earlier...

 .github/workflows/build.yaml              |   3 +
 tests/unit_tests/openvpn/Makefile.am      |  16 +++
 tests/unit_tests/openvpn/test_cryptoapi.c | 126 ++++++++++++++++++++++
 3 files changed, 145 insertions(+)
 create mode 100644 tests/unit_tests/openvpn/test_cryptoapi.c
.github/workflows/build.yaml +3 -0
index 699964fd..5bd6da89 100644
@@ -243,6 +243,9 @@ jobs:
       - name: Run bufferunit test
         run: ./unittests/buffer_testdriver.exe
 
+      - name: Run cryptoapi unit test
+        run: ./unittests/cryptoapi_testdriver.exe
+
       - name: Run cryptounit test
         run: ./unittests/crypto_testdriver.exe
 
tests/unit_tests/openvpn/Makefile.am +16 -0
index 8d2386e0..ee0a3d8a 100644
@@ -17,6 +17,7 @@ endif
 test_binaries += provider_testdriver
 
 if WIN32
+test_binaries += cryptoapi_testdriver
 LDADD = -lws2_32
 endif
 
@@ -152,6 +153,21 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \
 	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
+if WIN32
+cryptoapi_testdriver_CFLAGS  = @TEST_CFLAGS@ \
+	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
+	$(OPTIONAL_CRYPTO_CFLAGS)
+cryptoapi_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
+	$(OPTIONAL_CRYPTO_LIBS) -lcrypt32 -lncrypt
+cryptoapi_testdriver_SOURCES = test_cryptoapi.c mock_msg.c \
+	$(openvpn_srcdir)/xkey_helper.c \
+	$(openvpn_srcdir)/buffer.c \
+	$(openvpn_srcdir)/base64.c \
+	$(openvpn_srcdir)/platform.c \
+	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c
+endif
+
 auth_token_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
 	$(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_cryptoapi.c new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on v4 3/3
#11 lore raw

[Openvpn-devel] [PATCH applied] Re: Add a unit test for functions in cryptoapi.c

Thanks for the v4. This enabled me to just push to GH to have to build and run the tests, without having to bother myself with copying binaries around :-)

OTOH, there might be a bit of polishing needed - the other tests print out what they are doing ("Running 7 test(s)"), while the cryptoapi unit test "just succeeds". Is there something missing wrt cmocka initalization?

https://github.com/cron2/openvpn/actions/runs/4270790193/jobs/7434873211

I also did do a MinGW "make check" and it built the new test binary just fine, and succeeded otherwise.

298368 704 -rwxrwxr-x 1 gert gert 718042 Feb 25 16:10 ./tests/unit_tests/openvpn/.libs/cryptoapi_testdriver.exe

The unit test itself looks reasonably complete in testing expected and error-handling behaviour (v3->v4). Not much coverage beyond "parse_hexstring()", but it's a good start to build upon :-)

Your patch has been applied to the master and release/2.6 branch.

commit 8aff5655a51d9f9f67ca31b363d4ebaf5342d410 (master) commit 094aea56ce20d0bb6fe79e6e14a3dfe68ea11786 (release/2.6)

Author: Selva Nair
Date:   Tue Feb 14 15:08:04 2023 -0500
     Add a unit test for functions in cryptoapi.c

     Signed-off-by: Selva Nair <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26268.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

author
#12 lore raw

Re: [Openvpn-devel] [PATCH applied] Re: Add a unit test for functions in cryptoapi.c

Hi

Quoted 6 lines · Gert Doering

Thanks for the v4. This enabled me to just push to GH to have to build and run the tests, without having to bother myself with copying binaries around :-)

Quoted 7 lines

OTOH, there might be a bit of polishing needed - the other tests print out what they are doing ("Running 7 test(s)"), while the cryptoapi unit test "just succeeds". Is there something missing wrt cmocka initalization?

https://github.com/cron2/openvpn/actions/runs/4270790193/jobs/7434873211

That one is for OpenSSL 1.1.1 while this test is built only for OpenSSL3, so nothing to run. Do we need to continue testing Windows builds of 2.6 for OpenSSL 1.1?

Logs for OpenSSL 3 build look okay:

Quoted 1 line

https://github.com/OpenVPN/openvpn/actions/runs/4270860888/jobs/7434989645#logs

Quoted 1 line

Run ./unittests/cryptoapi_testdriver.exe

Quoted 9 lines

4[==========] Running 1 test(s).

5[ RUN ] test_parse_hexstring

6[ OK ] test_parse_hexstring

7[ PASSED ] 1 test(s).

8[==========] 1 test(s) run.

Selva

#13 lore raw

Re: [Openvpn-devel] [PATCH applied] Re: Add a unit test for functions in cryptoapi.c

Hi,

Quoted 4 lines · Selva Nair
Quoted 4 lines

OTOH, there might be a bit of polishing needed - the other tests print out what they are doing ("Running 7 test(s)"), while the cryptoapi unit test "just succeeds". Is there something missing wrt cmocka initalization?

[..]

Quoted 3 lines

That one is for OpenSSL 1.1.1 while this test is built only for OpenSSL3, so nothing to run. Do we need to continue testing Windows builds of 2.6 for OpenSSL 1.1?

Ah. Indeed, I saw the #ifdef in the code, but then looked in the wrong test result.

Thanks for enlightening me (again).

Arne, indeed, this sounds as if we shouldn't run these test units on mingw + 1.1.1 builds. Just confusing people, like, me.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#14 lore raw

Re: [Openvpn-devel] [PATCH v2 2/3] Build unit tests in mingw Windows build

In reply to [email protected]...

Am 04.02.23 um 07:40 schrieb [email protected]...:

Quoted 13 lines

From: Selva Nair <[email protected]...>

- Minor changes to the build system to include some dependencies for Windows build

- test_tls_crypt not built as it will pull in win32.c and its dependencies

- If cross-compiling, "make check" will only build the tests but not run any. Copy to Windows and run manually. Executables are in <buid-dir>/tests/unit_tests/openvpn/.libs/ and these depend on cmocka.dll in addition to openssl libs that some tests link to.

Quoted 5 lines

Building with mingw on Windows should run the tests (untested).

v2: networking_testdriver was mistakenly enabled to run, while originally it was only set to build. Corrected.

I am currently testing this and also trying to add this to the Github actions. This patch seems fine but I get other weird errors and cmocka builds fine crosscompiling on my own machine but breaks for some reason in Github Actions. I am looking into these problems and will give a full review after I solved those issues.

Arne

author
#15 lore raw

Re: [Openvpn-devel] [PATCH v2 2/3] Build unit tests in mingw Windows build

Hi,

Quoted 20 lines · Arne Schwabe

Am 04.02.23 um 07:40 schrieb [email protected]...:

Quoted 13 lines

From: Selva Nair <[email protected]...>

- Minor changes to the build system to include some dependencies for Windows build

- test_tls_crypt not built as it will pull in win32.c and its dependencies

- If cross-compiling, "make check" will only build the tests but not run any. Copy to Windows and run manually. Executables are in <buid-dir>/tests/unit_tests/openvpn/.libs/ and these depend on cmocka.dll in addition to openssl libs that some tests link to.

Quoted 5 lines

Building with mingw on Windows should run the tests (untested).

v2: networking_testdriver was mistakenly enabled to run, while originally it was only set to build. Corrected.

Quoted 6 lines

I am currently testing this and also trying to add this to the Github actions. This patch seems fine but I get other weird errors and cmocka builds fine crosscompiling on my own machine but breaks for some reason in Github Actions. I am looking into these problems and will give a full review after I solved those issues.

That would be nice. I was not sure how to copy the artifacts into a Windows instance and add a job for testing them in GHA.

Regarding "weird errors" an obvious thing easy to overlook is that the exe's are in .libs/ -- the wrapper that libtool generates is only useful for running native builds in-place with uninstalled shared libraries.

Also, I just noticed that I had locally disabled the example test because of some missing header warning -- it needs an include <stdint.h> to build.

Regards,

Selva

#16 lore raw

PATCH 3/3 Add a unit test for functions in cryptoapi.c

In reply to [email protected]...

From: Selva Nair <[email protected]...>

- Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More cryptoapi tests coming..

---

As requested during review of the 4/4 patch of cryptoapi series. Note that this doesn't currently build with MSVC -- either cross compile on Linux and run the binary on Windows or use mingw to compile on Windows.

 tests/unit_tests/openvpn/Makefile.am      |  15 +++
 tests/unit_tests/openvpn/test_cryptoapi.c | 126 ++++++++++++++++++++++
 2 files changed, 141 insertions(+)
 create mode 100644 tests/unit_tests/openvpn/test_cryptoapi.c
tests/unit_tests/openvpn/Makefile.am +15 -0
index 909ac4e2..0a1ad439 100644
@@ -153,6 +153,21 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \
 	$(openvpn_srcdir)/win32-util.c \
 	$(openvpn_srcdir)/platform.c
 
+if WIN32
+cryptoapi_testdriver_CFLAGS  = @TEST_CFLAGS@ \
+	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
+	$(OPTIONAL_CRYPTO_CFLAGS)
+cryptoapi_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
+	$(OPTIONAL_CRYPTO_LIBS) -lcrypt32 -lncrypt
+cryptoapi_testdriver_SOURCES = test_cryptoapi.c mock_msg.c \
+	$(openvpn_srcdir)/xkey_helper.c \
+	$(openvpn_srcdir)/buffer.c \
+	$(openvpn_srcdir)/base64.c \
+	$(openvpn_srcdir)/platform.c \
+	mock_get_random.c \
+	$(openvpn_srcdir)/win32-util.c
+endif
+
 auth_token_testdriver_CFLAGS  = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
 	$(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_cryptoapi.c new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on v1 1/3
#17 lore raw
In reply to [email protected]...

Am 04.02.23 um 01:45 schrieb [email protected]...:

Quoted 8 lines

From: Selva Nair <[email protected]...>

- Eliminates repeated warnings such as
warning: source file '$(openvpn_srcdir)/env_set.c' is in a subdirectory, but option 'subdir-objects' is disabled
- Enabled only for automake >= 1.16 as older versions have a buggy implementation of this option

Quoted 8 lines

Main side effect of this option is that object files like openvpnserv-blockdns.o are now created in src/openvpn where block-dns.c resides instead of in src/openvpnserv. Same for object files for sources from $(openvpn_srcdir) compiled into test executables.

See also past discussion on this topic:
https://www.mail-archive.com/[email protected]/msg00013.html

#18 lore raw
In reply to [email protected]...

This warning has been quite an annoyance for some time - thanks for taking care of it, and also figuring out what caveats apply. I do not understand autoconf intricacies, but I have fed this to github and to the buildbots, and they all seem to agree "things still build fine" :-) (the oldest buildbot is FreeBSD 7.4 with automake-1.11, and then there's the OpenIndiana buildbot with automake-1.15.1, so we have everything in the mix... the "current" OSes in the zoo all have 1.16.2 or later)

Your patch has been applied to the master and release/2.6 branch.

commit 8b915c48252da81b96041de66847272b0902c755 (master) commit 7f72abcf8a56bb35a510a3409e03a4e2aaba50da (release/2.6)

Author: Selva Nair
Date:   Fri Feb 3 19:45:10 2023 -0500
     Conditionally add subdir-objects option to automake

     Signed-off-by: Selva Nair <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26147.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#19 lore raw

Hi,

Quoted 8 lines · Gert Doering

This warning has been quite an annoyance for some time - thanks for taking care of it, and also figuring out what caveats apply. I do not understand autoconf intricacies, but I have fed this to github and to the buildbots, and they all seem to agree "things still build fine" :-) (the oldest buildbot is FreeBSD 7.4 with automake-1.11, and then there's the OpenIndiana buildbot with automake-1.15.1, so we have everything in the mix... the "current" OSes in the zoo all have 1.16.2 or later)

Quoted 8 lines

Your patch has been applied to the master and release/2.6 branch.

commit 8b915c48252da81b96041de66847272b0902c755 (master) commit 7f72abcf8a56bb35a510a3409e03a4e2aaba50da (release/2.6)

Author: Selva Nair
Date:   Fri Feb 3 19:45:10 2023 -0500

Conditionally add subdir-objects option to automake

This patch brought with it a somewhat unexpected and unexplainable (to me and Frank, that is) side effect - "make distcheck" explodes:

[email protected]... ~/openvpn-26.git $ git pull --rebase
Already up to date.
[email protected]... ~/openvpn-26.git $ make distcheck
...
config.status: creating config.h
config.status: creating include/openvpn-plugin.h
config.status: executing depfiles commands
config.status: error: in `/home/gert/openvpn-26.git/openvpn-2.6.1/_build/sub':
config.status: error: Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).
See `config.log' for more details
make: *** [Makefile:834: distcheck] Error 1

the relevant "config.log" is hiding, but there are some errors that look relevant:

[email protected]... ~/openvpn-26.git/openvpn-2.6.1/_build/sub $ less config.log
...
config.status:1694: cd tests/unit_tests/plugins/auth-pam && sed -e '/# am-
-include-marker/d' Makefile | make -f - am--depfiles
make[1]: Entering directory '/home/gert/openvpn-26.git/openvpn-2.6.1/_build/sub/ tests/unit_tests/plugins/auth-pam'
/bin/mkdir: cannot create directory '../../../../../../src/plugins/auth-pam/.dep s': Permission denied

(many of them)

Not sure what to do about it... for now we've decided to move onwards with the 2.6.1 release, as the "make dist" built tarball passes all the tests - including "out of tree" builds - so it's not crucially urgent ("yesterday" urgent), but it would be good to get this fixed again.

Anyone who understands autoconf...?

(This is on Gentoo, with automake 1.16.5, autoconf 2.71, libtool 2.4.7)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#20 lore raw
Quoted 6 lines · Gert Doering

Not sure what to do about it... for now we've decided to move onwards with the 2.6.1 release, as the "make dist" built tarball passes all the tests - including "out of tree" builds - so it's not crucially urgent ("yesterday" urgent), but it would be good to get this fixed again.

Anyone who understands autoconf...?

So I have a fix %)

Turns out one needs to read the automake release notes *very* carefully. When they fixed the issues with subdir-objects in 1.16.1 they wrote:

The 'subdir-object' option no longer causes object files corresponding to source files specified with an explicit '$(srcdir)' component to be placed in the source tree rather than in the build tree.

And they wrote

Automatic dependency tracking has been fixed to work also when the 'subdir-object' option is used and some 'foo_SOURCES' definition contains unexpanded references to make variables, as in, e.g.:

  a_src = sources/libs/aaa
  b_src = sources/bbb
  foo_SOURCES = $(a_src)/bar.c $(b_src)/baz.c

With such a setup, the created makefile fragment containing dependency tracking information will be correctly placed under the directories named 'sources/libs/aaa/.deps' and 'sources/bbb/.deps', rather than mistakenly under directories named (literally!) '$(src_a)/.deps' and '$(src_b)/.deps'

What they did not explicitely mention is that the fixes do not work *together*. So if you have $(a_src) in foo_SOURCES the .deps directory will be created in the *source* tree, not the *build* tree. Only if you have literally srcdir or top_srcdir in SOURCES, then it puts them in the build tree.

That breaks make distcheck.

So we need to apply fixes like this:
-auth_pam_testdriver_SOURCES = test_search_and_replace.c $(sut_sourcedir)/utils.h $(sut_sourcedir)/utils.c +auth_pam_testdriver_SOURCES = test_search_and_replace.c $(top_srcdir)/src/plugins/auth-pam/utils.h $(top_srcdir)/src/plugins/auth-pam/utils.c

Will send a patch.

Regards,

Signature · 1 line
  Frank Lichtenheld