]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
openssl: rewrite ptest installation
authorRoss Burton <ross.burton@arm.com>
Thu, 18 Jul 2024 14:48:29 +0000 (15:48 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 19 Jul 2024 16:50:28 +0000 (17:50 +0100)
Rewrite (again) the openssl test suite installation.

Depend on and reuse already installed libraries and modules instead of
installing them twice.

Be more selective when installing from the build tree so we don't install
intermediate .c .d .o files.

This further reduces the size of openssl-dbg from ~120MB to ~18MB.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-connectivity/openssl/openssl/run-ptest
meta/recipes-connectivity/openssl/openssl_3.3.1.bb

index c89ec5afa1bd924845da5a72a22ca3c2090be744..cd29bb144612ad35e1ed146216579ef6ce72134e 100644 (file)
@@ -1,12 +1,19 @@
 #!/bin/sh
 
-set -e
+set -eu
 
-# Optional arguments are 'list' to lists all tests, or the test name (base name
-# ie test_evp, not 03_test_evp.t).
+# Optional arguments are 'list' to lists the tests, or the test name (base name
+# ie test_evp, not 03_test_evp.t). Without any arguments we run all tests.
+
+if test $# -gt 0; then
+    TESTS=$*
+else
+    # Skip test_symbol_presence as this is for developers
+    TESTS="alltests -test_symbol_presence"
+fi
 
 export TOP=.
-# OPENSSL_ENGINES is relative from the test binaries
-export OPENSSL_ENGINES=../engines
+# Run four jobs in parallel
+export HARNESS_JOBS=4
 
-{ HARNESS_JOBS=4 perl ./test/run_tests.pl $* || echo "FAIL: openssl" ; } | sed -u -r -e '/(.*) \.*.ok/ s/^/PASS: /g' -r -e '/Dubious(.*)/ s/^/FAIL: /g' -e '/(.*) \.*.skipped: (.*)/ s/^/SKIP: /g'
+{ perl ./test/run_tests.pl $TESTS || echo "FAIL: openssl" ; } | sed -u -r -e '/(.*) \.*.ok/ s/^/PASS: /g' -r -e '/Dubious(.*)/ s/^/FAIL: /g' -e '/(.*) \.*.skipped: (.*)/ s/^/SKIP: /g'
index 36d2f87c26545ceabd62dcfb25c8abca98772c55..3bc0153429da8a8f1992d4fb0422b501859063aa 100644 (file)
@@ -191,44 +191,43 @@ do_install:append:class-nativesdk () {
 
 PTEST_BUILD_HOST_FILES += "configdata.pm"
 PTEST_BUILD_HOST_PATTERN = "perl_version ="
-do_install_ptest () {
-       install -d ${D}${PTEST_PATH}/test
-       install -m755 ${B}/test/p_test.so ${D}${PTEST_PATH}/test
-       install -m755 ${B}/test/p_minimal.so ${D}${PTEST_PATH}/test
-       install -m755 ${B}/test/provider_internal_test.cnf ${D}${PTEST_PATH}/test
-
-       # Prune the build tree
-       rm -f ${B}/fuzz/*.* ${B}/test/*.*
-
-       cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
-       sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/configdata.pm
-       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}/
-       ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/
+do_install_ptest() {
+       install -m644 ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
+       cp -rf ${S}/Configurations ${S}/external ${D}${PTEST_PATH}/
 
        install -d ${D}${PTEST_PATH}/apps
        ln -s ${bindir}/openssl ${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
-       install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines
-       install -m755 ${B}/engines/loader_attic.so ${D}${PTEST_PATH}/engines
-       install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
-
-       install -d ${D}${PTEST_PATH}/providers
-       install -m755 ${B}/providers/legacy.so ${D}${PTEST_PATH}/providers
 
-       install -d ${D}${PTEST_PATH}/Configurations
-       cp -rf ${S}/Configurations/* ${D}${PTEST_PATH}/Configurations/
+       cd ${S}
+       find test/certs test/ct test/d2i-tests test/recipes test/ocsp-tests test/ssl-tests test/smime-certs -type f -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       find apps test -name \*.cnf -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       find apps test -name \*.der -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       find apps test -name \*.pem -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       find util -name \*.p[lm] -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+
+       cd ${B}
+       # Everything but .? (.o and .d)
+       find test -type f -name \*[^.]? -exec install -m755 -D {} ${D}${PTEST_PATH}/{} \;
+       find apps test -name \*.cnf -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       find apps test -name \*.pem -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       find apps test -name \*.srl -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
+       install -m755 ${B}/util/*wrap.* ${D}${PTEST_PATH}/util/
+
+       install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps/
+       install -m755 ${S}/test/*.pl ${D}${PTEST_PATH}/test/
+       install -m755 ${S}/test/shibboleth.pfx ${D}${PTEST_PATH}/test/
+       install -m755 ${S}/test/*.bin ${D}${PTEST_PATH}/test/
+       install -m755 ${S}/test/dane*.in ${D}${PTEST_PATH}/test/
+       install -m755 ${S}/test/smcont*.txt ${D}${PTEST_PATH}/test/
+       install -m755 ${S}/test/ssl_test.tmpl ${D}${PTEST_PATH}/test/
+
+       sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/configdata.pm ${D}${PTEST_PATH}/util/wrap.pl
 
-       # seems to be needed with perl 5.32.1
-       install -d ${D}${PTEST_PATH}/util/perl/recipes
-       cp ${D}${PTEST_PATH}/test/recipes/tconversion.pl ${D}${PTEST_PATH}/util/perl/recipes/
-
-       sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/util/wrap.pl
+       install -d ${D}${PTEST_PATH}/engines
+       install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines/
+       install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines/
+       ln -s ${libdir}/engines-3/loader_attic.so ${D}${PTEST_PATH}/engines/
+       ln -s ${libdir}/ossl-modules/ ${D}${PTEST_PATH}/providers
 }
 
 # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
@@ -255,7 +254,7 @@ CONFFILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
 
 RRECOMMENDS:libcrypto += "openssl-conf ${PN}-ossl-module-legacy"
 RDEPENDS:${PN}-misc = "perl"
-RDEPENDS:${PN}-ptest += "openssl-bin perl perl-modules bash sed"
+RDEPENDS:${PN}-ptest += "openssl-bin perl perl-modules bash sed openssl-engines openssl-ossl-module-legacy"
 
 RDEPENDS:${PN}-bin += "openssl-conf"