Skip to contentSkip to conversation

libssh2: enable ptest

PATCH In review Sakib Sajal 2 participants 2 messages Sep 22, 2020 – Sep 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libssh2: enable ptest

---
 meta-oe/recipes-support/libssh2/files/run-ptest |  7 +++++++
 .../recipes-support/libssh2/libssh2_1.9.0.bb    | 17 ++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/libssh2/files/run-ptest
meta-oe/recipes-support/libssh2/files/run-ptest new file +7 -0
new file mode 100644
index 000000000..2a7922f1a
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+for test in $(ls $ptestdir/tests)
+do
+	./test-driver --test-name $test --log-file $test.log --trs-file $test.trs --color-tests no --enable-hard-errors yes --expect-failure no -- ./tests/$test
+done
meta-oe/recipes-support/libssh2/libssh2_1.9.0.bb +16 -1
index c1f337a44..a1d85617a 100644
@@ -9,11 +9,12 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c5cf34fc0acb44b082ef50ef5e4354ca"
 
 SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
            file://CVE-2019-17498.patch \
+           file://run-ptest \
 "
 SRC_URI[md5sum] = "1beefafe8963982adc84b408b2959927"
 SRC_URI[sha256sum] = "d5fb8bd563305fd1074dda90bd053fb2d29fc4bce048d182f96eaa466dfadafd"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig ptest
 
 EXTRA_OECONF += "\
                  --with-libz \
@@ -26,3 +27,17 @@ PACKAGECONFIG[openssl] = "--with-crypto=openssl --with-libssl-prefix=${STAGING_L
 PACKAGECONFIG[gcrypt] = "--with-crypto=libgcrypt --with-libgcrypt-prefix=${STAGING_EXECPREFIXDIR}, , libgcrypt"
 
 BBCLASSEXTEND = "native nativesdk"
+
+RDEPENDS_${PN}-ptest = "bash"
+
+do_compile_ptest() {
+	sed -i "/\$(MAKE) \$(AM_MAKEFLAGS) check-TESTS/d" tests/Makefile
+	oe_runmake check
+}
+
+do_install_ptest() {
+	install -d ${D}${PTEST_PATH}/tests
+	install -m 0755 ${B}/tests/.libs/simple ${D}${PTEST_PATH}/tests/
+	install -m 0755 ${S}/tests/mansyntax.sh ${D}${PTEST_PATH}/tests/
+	install -m 0755 ${S}/test-driver ${D}${PTEST_PATH}/
+}
Signature · 1 line
2.27.0
#1 lore raw
Quoted 39 lines · Sakib Sajal
---
  meta-oe/recipes-support/libssh2/files/run-ptest |  7 +++++++
  .../recipes-support/libssh2/libssh2_1.9.0.bb    | 17 ++++++++++++++++-
  2 files changed, 23 insertions(+), 1 deletion(-)

create mode 100644 meta-oe/recipes-support/libssh2/files/run-ptest

meta-oe/recipes-support/libssh2/files/run-ptest new file +7 -0
new file mode 100644
index 000000000..2a7922f1a
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+for test in $(ls $ptestdir/tests)
+do
+	./test-driver --test-name $test --log-file $test.log --trs-file $test.trs --color-tests no --enable-hard-errors yes --expect-failure no -- ./tests/$test
+done
meta-oe/recipes-support/libssh2/libssh2_1.9.0.bb +2 -1
index c1f337a44..a1d85617a 100644
@@ -9,11 +9,12 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c5cf34fc0acb44b082ef50ef5e4354ca"
 
  SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
             file://CVE-2019-17498.patch \
+           file://run-ptest \
  "
  SRC_URI[md5sum] = "1beefafe8963982adc84b408b2959927"
  SRC_URI[sha256sum] = "d5fb8bd563305fd1074dda90bd053fb2d29fc4bce048d182f96eaa466dfadafd"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig ptest
 
  EXTRA_OECONF += "\
                   --with-libz \

meta-oe/recipes-support/libssh2/libssh2_1.9.0.bb PACKAGECONFIG[openssl] = "--with-crypto=openssl --with-libssl-prefix=${STAGING_L · line 31

Quoted 5 lines
meta-oe/recipes-support/libssh2/libssh2_1.9.0.bb +2 -0
@@ -26,3 +27,17 @@ PACKAGECONFIG[openssl] = "--with-crypto=openssl --with-libssl-prefix=${STAGING_L
  PACKAGECONFIG[gcrypt] = "--with-crypto=libgcrypt --with-libgcrypt-prefix=${STAGING_EXECPREFIXDIR}, , libgcrypt"
 
  BBCLASSEXTEND = "native nativesdk"
+
+RDEPENDS_${PN}-ptest = "bash"

Your long log should explain why you need bash specifically rather than any old shell?

Have you tried to fix the shell script(s) to make it work with any /bin/sh?

Also, there were some useful examples that we talked about packaging up, can you do that as a follow-up commit?

../Randy

Quoted 15 lines
meta-oe/recipes-support/libssh2/libssh2_1.9.0.bb +12 -0
+
+do_compile_ptest() {
+	sed -i "/\$(MAKE) \$(AM_MAKEFLAGS) check-TESTS/d" tests/Makefile
+	oe_runmake check
+}
+
+do_install_ptest() {
+	install -d ${D}${PTEST_PATH}/tests
+	install -m 0755 ${B}/tests/.libs/simple ${D}${PTEST_PATH}/tests/
+	install -m 0755 ${S}/tests/mansyntax.sh ${D}${PTEST_PATH}/tests/
+	install -m 0755 ${S}/test-driver ${D}${PTEST_PATH}/
+}
Signature · 2 lines
# Randy MacLeod
# Wind River Linux