gnu: go-github-com-godbus-dbus: Enable tests.

* gnu/packages/golang.scm (go-github-com-godbus-dbus): Enable tests.
[arguments] <#:phases>: Add 'disable-failing-tests phase. Override
'check phase to run tests within a dbus session.

Change-Id: Ib27d33363d4d7071e91380588413ae035ae9609f
Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Sarah Morgensen 2024-08-29 01:02:52 +01:00 committed by Sharlatan Hellseher
parent d4da8af4e4
commit c293aa1d6f
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -6666,8 +6666,22 @@ RFC-5802 and RFC-7677.")
"0h0cl1r136g0kxbw3i7ggb9mhavpi1yr7d7312iwhkxm93dxkphg")))) "0h0cl1r136g0kxbw3i7ggb9mhavpi1yr7d7312iwhkxm93dxkphg"))))
(build-system go-build-system) (build-system go-build-system)
(arguments (arguments
`(#:tests? #f ;no /var/run/dbus/system_bus_socket (list
#:import-path "github.com/godbus/dbus")) #:import-path "github.com/godbus/dbus"
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'disable-failing-tests
(lambda* (#:key tests? unpack-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" unpack-path)
(substitute* (find-files "." "\\_test.go$")
;; Disable tests which require a system D-Bus instance.
(("TestSystemBus") "OffTestSystemBus")
(("TestConnectSystemBus") "OffTestConnectSystemBus")))))
(replace 'check
(lambda* (#:key tests? import-path #:allow-other-keys)
(when tests?
(with-directory-excursion (string-append "src/" import-path)
(invoke "dbus-run-session" "--" "go" "test" "./..."))))))))
(native-inputs (native-inputs
(list dbus)) ;dbus-launch (list dbus)) ;dbus-launch
(home-page "https://github.com/godbus/dbus/") (home-page "https://github.com/godbus/dbus/")