Skip to contentSkip to conversation

openssl: fix ptest

PATCH New Ross Burton 1 participant 2 messages Oct 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 openssl: fix ptest

Previously the ptest installation was simply a copy of the entire build tree, which is terribly ugly.

Instead copy just the pieces we need, symlink to /usr as appropriate, and add missing dependencies. Remove PRIVATE_LIBS as we don't ship copies of the libraries now.

Also remember to do 'set -x' in run-ptest, so if the tests fail the runner knows!

[ YOCTO #12965 ]
[ YOCTO #12967 ]

---
 meta/recipes-connectivity/openssl/openssl/run-ptest | 14 +++++++++++---
 meta/recipes-connectivity/openssl/openssl_1.1.1.bb  | 20 ++++++++++++++++----
 2 files changed, 27 insertions(+), 7 deletions(-)
meta/recipes-connectivity/openssl/openssl/run-ptest +11 -3
index 65c6cc7b862..0a620dea74a 100644
@@ -1,4 +1,12 @@
 #!/bin/sh
-cd test
-OPENSSL_ENGINES=../engines BLDTOP=.. SRCTOP=.. perl run_tests.pl
-cd ..
+
+set -e
+
+# Optional arguments are 'list' to lists all tests, or the test name (base name
+# ie test_evp, not 03_test_evp.t).
+
+export TOP=.
+# OPENSSL_ENGINES is relative from the test binaries
+export OPENSSL_ENGINES=../engines
+
+perl ./test/run_tests.pl $*
meta/recipes-connectivity/openssl/openssl_1.1.1.bb +16 -4
index 0d80aba64d7..4516f610217 100644
@@ -151,10 +151,22 @@ do_install_append_class-nativesdk () {
 }
 
 do_install_ptest () {
-	cp -r * ${D}${PTEST_PATH}
-}
+	cp ${B}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
+	# TODO fuzz needs to be pruned of non-binaries
+	cp -r ${B}/external ${B}/test ${B}/fuzz ${B}/util ${D}${PTEST_PATH}
+
+	# For test_shlibload
+	ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/libcrypto.so
+	ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/libssl.so
 
-PRIVATE_LIBS_${PN}-ptest = "libcrypto.so.1.1 libssl.so.1.1"
+	install -d ${D}${PTEST_PATH}/apps
+	ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
+	install -m644 ${B}/apps/*.pem ${B}/apps/*.srl ${B}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
+	install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
+
+	install -d ${D}${PTEST_PATH}/engines
+	install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
+}
 
 # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
 # package RRECOMMENDS on this package. This will enable the configuration
@@ -176,7 +188,7 @@ CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
 RRECOMMENDS_libcrypto += "openssl-conf"
 RDEPENDS_${PN}-bin = "perl"
 RDEPENDS_${PN}-misc = "perl"
-RDEPENDS_${PN}-ptest += "perl-module-file-spec-functions bash python"
+RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash python"
 
 RPROVIDES_openssl-conf = "openssl10-conf"
 RREPLACES_openssl-conf = "openssl10-conf"
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/2 openssl: do an out-of-tree build

OpenSSL supports out-of-tree builds so we should use them. This makes builds more reliable, and makes it easier to reduce the size of the ptest package.

---
 meta/recipes-connectivity/openssl/openssl_1.1.1.bb | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta/recipes-connectivity/openssl/openssl_1.1.1.bb +10 -5
index 4516f610217..af9038abd5f 100644
@@ -26,6 +26,9 @@ SRC_URI[sha256sum] = "2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d
 
 inherit lib_package multilib_header ptest
 
+B = "${WORKDIR}/build"
+do_configure[cleandirs] = "${B}"
+
 #| ./libcrypto.so: undefined reference to `getcontext'
 #| ./libcrypto.so: undefined reference to `setcontext'
 #| ./libcrypto.so: undefined reference to `makecontext'
@@ -107,7 +110,7 @@ do_configure () {
 	# WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
 	# environment variables set by bitbake. Adjust the environment variables instead.
 	PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
-	perl ./Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
+	perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
 }
 
 do_install () {
@@ -151,9 +154,11 @@ do_install_append_class-nativesdk () {
 }
 
 do_install_ptest () {
-	cp ${B}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
-	# TODO fuzz needs to be pruned of non-binaries
-	cp -r ${B}/external ${B}/test ${B}/fuzz ${B}/util ${D}${PTEST_PATH}
+	# Prune the build tree
+	rm -f ${B}/fuzz/*.* ${B}/test/*.*
+
+	cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
+	cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH}
 
 	# For test_shlibload
 	ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/libcrypto.so
@@ -161,7 +166,7 @@ do_install_ptest () {
 
 	install -d ${D}${PTEST_PATH}/apps
 	ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
-	install -m644 ${B}/apps/*.pem ${B}/apps/*.srl ${B}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
+	install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
 	install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
 
 	install -d ${D}${PTEST_PATH}/engines
Signature · 1 line
2.11.0