From b12d44dd5e35ac236bf3fbb5619b9c8c2f42c902 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 23 Apr 2025 09:58:36 +0900 Subject: [PATCH] gnu: libssh: Enable tests. * gnu/packages/ssh.scm (libssh) [arguments] <#:configure-flags>: Add "-DUNIT_TESTING=ON". <#:phases>: New argument. [native-inputs]: Add cmocka. Change-Id: Ibe0f8f7b9bff969c9483dcd8c6b7635d91e62feb --- gnu/packages/ssh.scm | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm index 877d129e91..5f0b3e2a6a 100644 --- a/gnu/packages/ssh.scm +++ b/gnu/packages/ssh.scm @@ -15,7 +15,7 @@ ;;; Copyright © 2019, 2020 Mathieu Othacehe ;;; Copyright © 2020, 2023, 2024 Janneke Nieuwenhuizen ;;; Copyright © 2020 Oleg Pykhalov -;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer +;;; Copyright © 2020, 2021, 2022, 2025 Maxim Cournoyer ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2023 Simon Streit ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> @@ -158,16 +158,30 @@ file names. (build-system cmake-build-system) (outputs '("out" "debug")) (arguments - `(#:configure-flags '("-DWITH_GCRYPT=ON" - ,@(if (and (%current-target-system) - (not (target-64bit?))) - (list (string-append - "-DCMAKE_C_FLAGS=-g -O2" - " -Wno-incompatible-pointer-types")) - '())) - - ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite. - #:tests? #f)) + (list + #:configure-flags + #~(list "-DWITH_GCRYPT=ON" + "-DUNIT_TESTING=ON" + #$@(if (and (%current-target-system) + (not (target-64bit?))) + #~(list (string-append + "-DCMAKE_C_FLAGS=-g -O2" + " -Wno-incompatible-pointer-types")) + #~())) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'disable-problematic-tests + (lambda _ + ;; XXX: There is no finer-grain control on skipping tests using + ;; cmocka, short of patching sources, which isn't trivial with + ;; substitute*/sed. + (substitute* "tests/unittests/CMakeLists.txt" + ;; Some torture tests fail due to assuming the user directory + ;; (from the passwd database) matches HOME, and other fail for + ;; unknown reasons (see: + ;; https://gitlab.com/libssh/libssh-mirror/-/issues/302). + (("^ torture_(config|misc|options).*$") ""))))))) + (native-inputs (list cmocka)) (inputs (list zlib libgcrypt mit-krb5)) (synopsis "SSH client library") (description