diff options
| author | Virendra Thakur <virendrak@kpit.com> | 2025-02-03 13:26:10 +0530 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2025-02-09 07:58:19 -0800 |
| commit | 6ca163ed3e1269c44889ba972ceeab8e61f293ff (patch) | |
| tree | 6335169e334bef1e45a157cce5f0e3fd59aca28d | |
| parent | e80164edccb6d3722ba04243c44fea06b44ae880 (diff) | |
| download | meta-openembedded-6ca163ed3e1269c44889ba972ceeab8e61f293ff.tar.gz | |
libssh: Add ptest
Enable ptest for libssh , this change is backported from upstream
scarthgap.
Reference: https://git.openembedded.org/meta-openembedded/commit/?h=scarthgap&id=bf49bdea290ba8cf18f3fd6b47d1d71dfe499948
~ # ptest-runner libssh
START: ptest-runner
2025-01-28T14:28
BEGIN: /usr/lib/libssh/ptest
PASS: torture_buffer
PASS: torture_callbacks
PASS: torture_channel
PASS: torture_config
PASS: torture_crypto
PASS: torture_hashes
PASS: torture_init
PASS: torture_isipaddr
PASS: torture_keyfiles
PASS: torture_knownhosts_parsing
PASS: torture_list
PASS: torture_misc
PASS: torture_options
PASS: torture_packet
PASS: torture_packet_filter
PASS: torture_pki
PASS: torture_pki_ecdsa
PASS: torture_pki_ed25519
PASS: torture_pki_rsa
PASS: torture_rand
PASS: torture_threads_buffer
PASS: torture_threads_crypto
PASS: torture_threads_init
PASS: torture_threads_pki_rsa
DURATION: 119
END: /usr/lib/libssh/ptest
2025-01-28T14:29
STOP: ptest-runner
TOTAL: 1 FAIL: 0
Signed-off-by: Virendra Thakur <virendrak@kpit.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
3 files changed, 99 insertions, 3 deletions
diff --git a/meta-oe/recipes-support/libssh/libssh/0001-tests-CMakeLists.txt-do-not-search-ssh-sshd-commands.patch b/meta-oe/recipes-support/libssh/libssh/0001-tests-CMakeLists.txt-do-not-search-ssh-sshd-commands.patch new file mode 100644 index 0000000000..91355d0c88 --- /dev/null +++ b/meta-oe/recipes-support/libssh/libssh/0001-tests-CMakeLists.txt-do-not-search-ssh-sshd-commands.patch | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | From d2525ba0bc7b11de12c54ea1a3d1eb862537136d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
| 3 | Date: Wed, 15 Mar 2023 16:51:58 +0800 | ||
| 4 | Subject: [PATCH] tests/CMakeLists.txt: do not search ssh/sshd commands on host | ||
| 5 | |||
| 6 | It will search ssh/sshd commands on host when configure. Since they are | ||
| 7 | not required by unittests, we can skip the search. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [embedded specific] | ||
| 10 | |||
| 11 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
| 12 | Signed-off-by: Virendra Thakur <virendrak@kpit.com> | ||
| 13 | --- | ||
| 14 | tests/CMakeLists.txt | 2 ++ | ||
| 15 | 1 file changed, 2 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | ||
| 18 | index 22a36f37..aa32ca2e 100644 | ||
| 19 | --- a/tests/CMakeLists.txt | ||
| 20 | +++ b/tests/CMakeLists.txt | ||
| 21 | @@ -48,6 +48,7 @@ set(TEST_TARGET_LIBRARIES | ||
| 22 | |||
| 23 | add_subdirectory(unittests) | ||
| 24 | |||
| 25 | +if (CLIENT_TESTING OR SERVER_TESTING) | ||
| 26 | if (CLIENT_TESTING) | ||
| 27 | find_package(socket_wrapper 1.1.5 REQUIRED) | ||
| 28 | find_package(nss_wrapper 1.1.2 REQUIRED) | ||
| 29 | @@ -152,6 +153,7 @@ if (WITH_SERVER AND SERVER_TESTING) | ||
| 30 | add_subdirectory(pkd) | ||
| 31 | endif (WITH_SERVER AND SERVER_TESTING) | ||
| 32 | |||
| 33 | +endif () | ||
| 34 | if (FUZZ_TESTING) | ||
| 35 | add_subdirectory(fuzz) | ||
| 36 | endif() | ||
| 37 | -- | ||
| 38 | 2.25.1 | ||
diff --git a/meta-oe/recipes-support/libssh/libssh/run-ptest b/meta-oe/recipes-support/libssh/libssh/run-ptest new file mode 100644 index 0000000000..4ab3e5d141 --- /dev/null +++ b/meta-oe/recipes-support/libssh/libssh/run-ptest | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Valid tests to run | ||
| 4 | tests="torture_buffer \ | ||
| 5 | torture_callbacks \ | ||
| 6 | torture_channel \ | ||
| 7 | torture_config \ | ||
| 8 | torture_crypto \ | ||
| 9 | torture_hashes \ | ||
| 10 | torture_init \ | ||
| 11 | torture_isipaddr \ | ||
| 12 | torture_keyfiles \ | ||
| 13 | torture_knownhosts_parsing \ | ||
| 14 | torture_list \ | ||
| 15 | torture_misc \ | ||
| 16 | torture_options \ | ||
| 17 | torture_packet \ | ||
| 18 | torture_packet_filter \ | ||
| 19 | torture_pki \ | ||
| 20 | torture_pki_ecdsa \ | ||
| 21 | torture_pki_ed25519 \ | ||
| 22 | torture_pki_rsa \ | ||
| 23 | torture_rand \ | ||
| 24 | torture_threads_buffer \ | ||
| 25 | torture_threads_crypto \ | ||
| 26 | torture_threads_init \ | ||
| 27 | torture_threads_pki_rsa \ | ||
| 28 | " | ||
| 29 | |||
| 30 | ptestdir=$(dirname "$(readlink -f "$0")") | ||
| 31 | cd "$ptestdir"/tests || exit | ||
| 32 | |||
| 33 | # Run specified tests | ||
| 34 | for f in $tests | ||
| 35 | do | ||
| 36 | if test -e ./"$f"; then | ||
| 37 | if ./"$f" > ./"$f".out 2> ./"$f".err; then | ||
| 38 | echo "PASS: $f" | ||
| 39 | else | ||
| 40 | echo "FAIL: $f" | ||
| 41 | fi | ||
| 42 | else | ||
| 43 | echo "SKIP: $f" | ||
| 44 | fi | ||
| 45 | done | ||
diff --git a/meta-oe/recipes-support/libssh/libssh_0.8.9.bb b/meta-oe/recipes-support/libssh/libssh_0.8.9.bb index 98910d3068..7d0fc2d32f 100644 --- a/meta-oe/recipes-support/libssh/libssh_0.8.9.bb +++ b/meta-oe/recipes-support/libssh/libssh_0.8.9.bb | |||
| @@ -18,17 +18,19 @@ SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable | |||
| 18 | file://004_CVE-2023-6004.patch \ | 18 | file://004_CVE-2023-6004.patch \ |
| 19 | file://005_CVE-2023-6004.patch \ | 19 | file://005_CVE-2023-6004.patch \ |
| 20 | file://006_CVE-2023-6004.patch \ | 20 | file://006_CVE-2023-6004.patch \ |
| 21 | file://0001-tests-CMakeLists.txt-do-not-search-ssh-sshd-commands.patch \ | ||
| 22 | file://run-ptest \ | ||
| 21 | " | 23 | " |
| 22 | SRCREV = "04685a74df9ce1db1bc116a83a0da78b4f4fa1f8" | 24 | SRCREV = "04685a74df9ce1db1bc116a83a0da78b4f4fa1f8" |
| 23 | 25 | ||
| 24 | S = "${WORKDIR}/git" | 26 | S = "${WORKDIR}/git" |
| 25 | 27 | ||
| 26 | inherit cmake | 28 | inherit cmake ptest |
| 27 | 29 | ||
| 28 | PACKAGECONFIG ??= "gcrypt" | 30 | PACKAGECONFIG ??= "gcrypt ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" |
| 29 | PACKAGECONFIG[gssapi] = "-DWITH_GSSAPI=1, -DWITH_GSSAPI=0, krb5, " | 31 | PACKAGECONFIG[gssapi] = "-DWITH_GSSAPI=1, -DWITH_GSSAPI=0, krb5, " |
| 30 | PACKAGECONFIG[gcrypt] = "-DWITH_GCRYPT=1, -DWITH_GCRYPT=0, libgcrypt, " | 32 | PACKAGECONFIG[gcrypt] = "-DWITH_GCRYPT=1, -DWITH_GCRYPT=0, libgcrypt, " |
| 31 | 33 | PACKAGECONFIG[tests] = "-DUNIT_TESTING=1, -DUNIT_TESTING=0, cmocka" | |
| 32 | ARM_INSTRUCTION_SET:armv5 = "arm" | 34 | ARM_INSTRUCTION_SET:armv5 = "arm" |
| 33 | 35 | ||
| 34 | EXTRA_OECMAKE = " \ | 36 | EXTRA_OECMAKE = " \ |
| @@ -44,6 +46,17 @@ do_configure:prepend () { | |||
| 44 | || bbfatal "Failed to disable examples" | 46 | || bbfatal "Failed to disable examples" |
| 45 | } | 47 | } |
| 46 | 48 | ||
| 49 | do_compile:prepend () { | ||
| 50 | if [ ${PTEST_ENABLED} = "1" ]; then | ||
| 51 | sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/config.h | ||
| 52 | fi | ||
| 53 | } | ||
| 54 | |||
| 55 | do_install_ptest () { | ||
| 56 | install -d ${D}${PTEST_PATH}/tests | ||
| 57 | cp -f ${B}/tests/unittests/torture_* ${D}${PTEST_PATH}/tests/ | ||
| 58 | } | ||
| 59 | |||
| 47 | TOOLCHAIN = "gcc" | 60 | TOOLCHAIN = "gcc" |
| 48 | 61 | ||
| 49 | BBCLASSEXTEND = "native nativesdk" | 62 | BBCLASSEXTEND = "native nativesdk" |
