Fix mbedtls unit tests
PATCH 1/1 Fix mbedtls unit tests
Commit 674b166 ("Fix build warnings related to get_random()") broke the unit tests for mbedtls, because <mbedtls/cipher.h> was now included via platform.c -> crypto.h -> crypto_backend.h, but the crypto cflags were not included for that unit tests.
Since we got rid of --disable-crypto, we can now fix this by simply always including the CRYPTO_CFLAGS in the TEST_CFLAGS (and the CRYPTO_LIBS in the TEST_LDFLAGS). This should not only fix this occurrence, but also prevent similar problems in the future.
# Conflicts:
# tests/unit_tests/openvpn/Makefile.am
--- configure.ac | 4 ++-- tests/unit_tests/openvpn/Makefile.am | 24 ++++++++---------------- 2 files changed, 10 insertions(+), 18 deletions(-)
configure.ac +2 -2
@@ -1360,8 +1360,8 @@ AC_SUBST([VENDOR_SRC_ROOT]) AC_SUBST([VENDOR_BUILD_ROOT]) AC_SUBST([VENDOR_DIST_ROOT]) -TEST_LDFLAGS="-lcmocka -L\$(abs_top_builddir)/vendor/dist/lib -Wl,-rpath,\$(abs_top_builddir)/vendor/dist/lib" -TEST_CFLAGS="-I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include" +TEST_LDFLAGS="${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_LIBS} -lcmocka -L\$(abs_top_builddir)/vendor/dist/lib -Wl,-rpath,\$(abs_top_builddir)/vendor/dist/lib" +TEST_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_CFLAGS} -I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include" AC_SUBST([TEST_LDFLAGS]) AC_SUBST([TEST_CFLAGS])
tests/unit_tests/openvpn/Makefile.am +8 -16
@@ -14,10 +14,8 @@ openvpn_includedir = $(top_srcdir)/include openvpn_srcdir = $(top_srcdir)/src/openvpn compat_srcdir = $(top_srcdir)/src/compat -argv_testdriver_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir) \ - $(OPTIONAL_CRYPTO_CFLAGS) -argv_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(openvpn_srcdir) -Wl,--wrap=parse_line \ - $(OPTIONAL_CRYPTO_LIBS) +argv_testdriver_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir) +argv_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(openvpn_srcdir) -Wl,--wrap=parse_line argv_testdriver_SOURCES = test_argv.c mock_msg.c \ mock_get_random.c \ $(openvpn_srcdir)/platform.c \
@@ -31,10 +29,8 @@ buffer_testdriver_SOURCES = test_buffer.c mock_msg.c \ $(openvpn_srcdir)/platform.c crypto_testdriver_CFLAGS = @TEST_CFLAGS@ \ - -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \ - $(OPTIONAL_CRYPTO_CFLAGS) -crypto_testdriver_LDFLAGS = @TEST_LDFLAGS@ \ - $(OPTIONAL_CRYPTO_LIBS) + -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) +crypto_testdriver_LDFLAGS = @TEST_LDFLAGS@ crypto_testdriver_SOURCES = test_crypto.c mock_msg.c \ $(openvpn_srcdir)/buffer.c \ $(openvpn_srcdir)/crypto.c \
@@ -45,10 +41,8 @@ crypto_testdriver_SOURCES = test_crypto.c mock_msg.c \ $(openvpn_srcdir)/platform.c packet_id_testdriver_CFLAGS = @TEST_CFLAGS@ \ - -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \ - $(OPTIONAL_CRYPTO_CFLAGS) -packet_id_testdriver_LDFLAGS = @TEST_LDFLAGS@ \ - $(OPTIONAL_CRYPTO_LIBS) + -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) +packet_id_testdriver_LDFLAGS = @TEST_LDFLAGS@ packet_id_testdriver_SOURCES = test_packet_id.c mock_msg.c \ mock_get_random.c \ $(openvpn_srcdir)/buffer.c \
@@ -57,10 +51,8 @@ packet_id_testdriver_SOURCES = test_packet_id.c mock_msg.c \ $(openvpn_srcdir)/platform.c tls_crypt_testdriver_CFLAGS = @TEST_CFLAGS@ \ - -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \ - $(OPTIONAL_CRYPTO_CFLAGS) -tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ \ - $(OPTIONAL_CRYPTO_LIBS) + -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) +tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ tls_crypt_testdriver_SOURCES = test_tls_crypt.c mock_msg.c \ $(openvpn_srcdir)/base64.c \ $(openvpn_srcdir)/buffer.c \
Signature · 1 line
2.7.4
Am 10.10.18 um 08:44 schrieb Steffan Karger:
Quoted 10 lines
Commit 674b166 ("Fix build warnings related to
get_random()") broke the unit tests for mbedtls, because <mbedtls/cipher.h> was now included viaplatform.c->crypto.h->crypto_backend.h, but the crypto cflags were not included for that unit tests.Since we got rid of --disable-crypto, we can now fix this by simply always including the
CRYPTO_CFLAGSin theTEST_CFLAGS(and theCRYPTO_LIBSin theTEST_LDFLAGS). This should not only fix this occurrence, but also prevent similar problems in the future.
Quoted 4 lines
Signed-off-by Steffan Karger <[email protected]...># Conflicts:
# tests/unit_tests/openvpn/Makefile.am
This should not be in the commit message.
Otherwise this looks good. It also passes the travis build for me.
Your patch has been applied to the master branch.
I haven't fully tested this because it needs "mbedtls in a non-default location" to break in the first place, which I was too lazy to set up now. So I trust travis to check this case now :-)
commit b081038c7464f7a916560b4a71ebc83537a84b9d
Author: Steffan Karger Date: Wed Oct 10 08:44:43 2018 +0200
Fix mbedtls unit tests
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg17687.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering