Skip to contentSkip to conversation

libssh2: enhance ptest

PATCH New Changqing Li 1 participant 1 message Dec 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libssh2: enhance ptest

support testcase ssh2.sh

---
 ...nviroment-to-decide-if-a-test-is-bui.patch | 46 +++++++++++++++++++
 .../recipes-support/libssh2/files/run-ptest   |  2 +-
 .../recipes-support/libssh2/libssh2_1.9.0.bb  | 11 +++--
 3 files changed, 55 insertions(+), 4 deletions(-)
 create mode 100644 meta-oe/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch
meta-oe/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch new file +46 -0
new file mode 100644
index 000000000..5ff9bf846
@@ -0,0 +1,46 @@
+From f9e3e2ee7b18ba5bb8efe083171f3e701eb0a663 Mon Sep 17 00:00:00 2001
+From: Your Name <[email protected]>
+Date: Mon, 28 Dec 2020 02:08:03 +0000
+Subject: [PATCH] Don't let host enviroment to decide if a test is build
+
+test ssh2.sh need sshd, for cross compile, we need it on target, so
+don't use SSHD on host to decide weither to build a test
+
+Upstream-Status: Inappropriate[oe specific]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ tests/Makefile.am | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index dc0922f..6cbc35d 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -1,16 +1,12 @@
+ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_builddir)/src
+ LDADD = ../src/libssh2.la
+ 
+-if SSHD
+ noinst_PROGRAMS = ssh2
+ ssh2_SOURCES = ssh2.c
+-endif
+ 
+ ctests = simple$(EXEEXT)
+ TESTS = $(ctests) mansyntax.sh
+-if SSHD
+ TESTS += ssh2.sh
+-endif
+ check_PROGRAMS = $(ctests)
+ 
+ TESTS_ENVIRONMENT = SSHD=$(SSHD) EXEEXT=$(EXEEXT)
+@@ -38,4 +34,4 @@ if OPENSSL
+ # EXTRA_DIST += test_public_key_auth_succeeds_with_correct_encrypted_ed25519_key.c
+ # EXTRA_DIST += test_public_key_auth_succeeds_with_correct_ed25519_key_from_mem.c
+ EXTRA_DIST += test_public_key_auth_succeeds_with_correct_rsa_openssh_key.c
+-endif
+\ No newline at end of file
++endif
+-- 
+2.20.1
+
meta-oe/recipes-support/libssh2/files/run-ptest +1 -1
index c213b32e5..5fd7ec65f 100644
@@ -2,7 +2,7 @@
 
 ptestdir=$(dirname "$(readlink -f "$0")")
 cd tests
-for test in $(ls)
+for test in simple ssh2.sh mansyntax.sh
 do
 	./../test-driver --test-name $test --log-file ../$test.log --trs-file ../$test.trs --color-tests no --enable-hard-errors yes --expect-failure no -- ./$test
 done
meta-oe/recipes-support/libssh2/libssh2_1.9.0.bb +8 -3
index 38f162693..4a5a05060 100644
@@ -11,6 +11,9 @@ SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
            file://CVE-2019-17498.patch \
            file://run-ptest \
 "
+
+SRC_URI_append_ptest = " file://0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch"
+
 SRC_URI[md5sum] = "1beefafe8963982adc84b408b2959927"
 SRC_URI[sha256sum] = "d5fb8bd563305fd1074dda90bd053fb2d29fc4bce048d182f96eaa466dfadafd"
 
@@ -29,7 +32,7 @@ PACKAGECONFIG[gcrypt] = "--with-crypto=libgcrypt --with-libgcrypt-prefix=${STAGI
 BBCLASSEXTEND = "native nativesdk"
 
 # required for ptest on documentation
-RDEPENDS_${PN}-ptest = "man-db"
+RDEPENDS_${PN}-ptest = "man-db openssh"
 RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-en-us"
 
 do_compile_ptest() {
@@ -39,9 +42,11 @@ do_compile_ptest() {
 
 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}/
+	cp -rf ${B}/tests/.libs/* ${D}${PTEST_PATH}/tests/
+	cp -rf ${S}/tests/mansyntax.sh  ${D}${PTEST_PATH}/tests/
+	cp -rf ${S}/tests/ssh2.sh  ${D}${PTEST_PATH}/tests/
+	cp -rf ${S}/tests/etc ${D}${PTEST_PATH}/tests/
 	mkdir -p ${D}${PTEST_PATH}/docs
 	cp -r ${S}/docs/* ${D}${PTEST_PATH}/docs/
 }
Signature · 1 line
2.17.1