diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2023-03-16 11:20:10 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-03-17 07:06:56 -0700 |
commit | bf49bdea290ba8cf18f3fd6b47d1d71dfe499948 (patch) | |
tree | a77b444375b26a047c1b9f7f40ceec13645e5656 /meta-oe/recipes-support | |
parent | b71b1eedb4d74aef2dfcb55f5cfbba0a2a8d793b (diff) | |
download | meta-openembedded-bf49bdea290ba8cf18f3fd6b47d1d71dfe499948.tar.gz |
libssh: add ptest
Results:
$ ptest-runner libssh
START: ptest-runner
2023-03-16T02:56
BEGIN: /usr/lib/libssh/ptest
PASS: torture_bind_config
PASS: torture_buffer
PASS: torture_bytearray
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_moduli
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_push_pop_dir
PASS: torture_rand
PASS: torture_session_keys
PASS: torture_temp_dir
PASS: torture_temp_file
PASS: torture_threads_buffer
PASS: torture_threads_crypto
PASS: torture_threads_init
PASS: torture_threads_pki_rsa
PASS: torture_tokens
DURATION: 24
END: /usr/lib/libssh/ptest
2023-03-16T02:56
STOP: ptest-runner
TOTAL: 1 FAIL: 0
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support')
3 files changed, 109 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 000000000..0c7f53029 --- /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 | --- | ||
13 | tests/CMakeLists.txt | 2 ++ | ||
14 | 1 file changed, 2 insertions(+) | ||
15 | |||
16 | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt | ||
17 | index 22a36f37..aa32ca2e 100644 | ||
18 | --- a/tests/CMakeLists.txt | ||
19 | +++ b/tests/CMakeLists.txt | ||
20 | @@ -86,6 +86,7 @@ set(TEST_TARGET_LIBRARIES | ||
21 | |||
22 | add_subdirectory(unittests) | ||
23 | |||
24 | +if (CLIENT_TESTING OR SERVER_TESTING) | ||
25 | # OpenSSH Capabilities are required for all unit tests | ||
26 | find_program(SSH_EXECUTABLE NAMES ssh) | ||
27 | if (SSH_EXECUTABLE) | ||
28 | @@ -293,6 +294,7 @@ if (CLIENT_TESTING OR SERVER_TESTING) | ||
29 | |||
30 | message(STATUS "TORTURE_ENVIRONMENT=${TORTURE_ENVIRONMENT}") | ||
31 | endif () | ||
32 | +endif () | ||
33 | |||
34 | configure_file(tests_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/tests_config.h) | ||
35 | |||
36 | -- | ||
37 | 2.25.1 | ||
38 | |||
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 000000000..159994e9b --- /dev/null +++ b/meta-oe/recipes-support/libssh/libssh/run-ptest | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Valid tests to run | ||
4 | tests="torture_bind_config \ | ||
5 | torture_buffer \ | ||
6 | torture_bytearray \ | ||
7 | torture_callbacks \ | ||
8 | torture_channel \ | ||
9 | torture_config \ | ||
10 | torture_crypto \ | ||
11 | torture_hashes \ | ||
12 | torture_init \ | ||
13 | torture_isipaddr \ | ||
14 | torture_keyfiles \ | ||
15 | torture_knownhosts_parsing \ | ||
16 | torture_list \ | ||
17 | torture_misc \ | ||
18 | torture_moduli \ | ||
19 | torture_options \ | ||
20 | torture_packet \ | ||
21 | torture_packet_filter \ | ||
22 | torture_pki \ | ||
23 | torture_pki_ecdsa \ | ||
24 | torture_pki_ed25519 \ | ||
25 | torture_pki_rsa \ | ||
26 | torture_push_pop_dir \ | ||
27 | torture_rand \ | ||
28 | torture_session_keys \ | ||
29 | torture_temp_dir \ | ||
30 | torture_temp_file \ | ||
31 | torture_threads_buffer \ | ||
32 | torture_threads_crypto \ | ||
33 | torture_threads_init \ | ||
34 | torture_threads_pki_rsa \ | ||
35 | torture_tokens \ | ||
36 | " | ||
37 | |||
38 | ptestdir=$(dirname "$(readlink -f "$0")") | ||
39 | cd "$ptestdir"/tests || exit | ||
40 | |||
41 | # Run specified tests | ||
42 | for f in $tests | ||
43 | do | ||
44 | if test -e ./"$f"; then | ||
45 | if ./"$f" > ./"$f".out 2> ./"$f".err; then | ||
46 | echo "PASS: $f" | ||
47 | else | ||
48 | echo "FAIL: $f" | ||
49 | fi | ||
50 | else | ||
51 | echo "SKIP: $f" | ||
52 | fi | ||
53 | done | ||
diff --git a/meta-oe/recipes-support/libssh/libssh_0.10.4.bb b/meta-oe/recipes-support/libssh/libssh_0.10.4.bb index 3a57a728a..801644d95 100644 --- a/meta-oe/recipes-support/libssh/libssh_0.10.4.bb +++ b/meta-oe/recipes-support/libssh/libssh_0.10.4.bb | |||
@@ -6,16 +6,20 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=dabb4958b830e5df11d2b0ed8ea255a0" | |||
6 | 6 | ||
7 | DEPENDS = "zlib openssl" | 7 | DEPENDS = "zlib openssl" |
8 | 8 | ||
9 | SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable-0.10" | 9 | SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable-0.10 \ |
10 | file://0001-tests-CMakeLists.txt-do-not-search-ssh-sshd-commands.patch \ | ||
11 | file://run-ptest \ | ||
12 | " | ||
10 | SRCREV = "e8322817a9e5aaef0698d779ddd467a209a85d85" | 13 | SRCREV = "e8322817a9e5aaef0698d779ddd467a209a85d85" |
11 | 14 | ||
12 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
13 | 16 | ||
14 | inherit cmake | 17 | inherit cmake ptest |
15 | 18 | ||
16 | PACKAGECONFIG ??= "gcrypt" | 19 | PACKAGECONFIG ??= "gcrypt ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" |
17 | PACKAGECONFIG[gssapi] = "-DWITH_GSSAPI=1, -DWITH_GSSAPI=0, krb5, " | 20 | PACKAGECONFIG[gssapi] = "-DWITH_GSSAPI=1, -DWITH_GSSAPI=0, krb5, " |
18 | PACKAGECONFIG[gcrypt] = "-DWITH_GCRYPT=1, -DWITH_GCRYPT=0, libgcrypt, " | 21 | PACKAGECONFIG[gcrypt] = "-DWITH_GCRYPT=1, -DWITH_GCRYPT=0, libgcrypt, " |
22 | PACKAGECONFIG[tests] = "-DUNIT_TESTING=1, -DUNIT_TESTING=0, cmocka" | ||
19 | 23 | ||
20 | ARM_INSTRUCTION_SET:armv5 = "arm" | 24 | ARM_INSTRUCTION_SET:armv5 = "arm" |
21 | 25 | ||
@@ -26,4 +30,15 @@ EXTRA_OECMAKE = " \ | |||
26 | -DWITH_EXAMPLES=0 \ | 30 | -DWITH_EXAMPLES=0 \ |
27 | " | 31 | " |
28 | 32 | ||
33 | do_compile:prepend () { | ||
34 | if [ ${PTEST_ENABLED} = "1" ]; then | ||
35 | sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/config.h | ||
36 | fi | ||
37 | } | ||
38 | |||
39 | do_install_ptest () { | ||
40 | install -d ${D}${PTEST_PATH}/tests | ||
41 | cp -f ${B}/tests/unittests/torture_* ${D}${PTEST_PATH}/tests/ | ||
42 | } | ||
43 | |||
29 | BBCLASSEXTEND = "native nativesdk" | 44 | BBCLASSEXTEND = "native nativesdk" |