gnu: go-github-com-prometheus-procfs: Enable tests.

* gnu/packages/prometheus.scm (go-github-com-prometheus-procfs): Enable tests.
[arguments] <#:phases>: Add 'unpack-testdata and 'remove-testdata
phases. Use custom 'check phase.

Change-Id: Iae01ce9cb57748ce4b155e2b814dd69ff9ba5114
This commit is contained in:
Sharlatan Hellseher 2024-08-25 17:35:26 +01:00
parent 0e8fd31a3d
commit 0fc1ce6f4f
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -399,9 +399,22 @@ (define-public go-github-com-prometheus-procfs
(arguments
(list
#:import-path "github.com/prometheus/procfs"
;; The tests require Go modules, which are not yet supported in Guix's
;; Go build system.
#:tests? #f))
#:phases
#~(modify-phases %standard-phases
(add-before 'check 'unpack-testdata
(lambda* (#:key tests? import-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" import-path)
(invoke "./ttar" "-C" "testdata/" "-x" "-f" "testdata/fixtures.ttar"))))
;; XXX: Replace when go-build-system supports nested path.
(replace 'check
(lambda* (#:key import-path tests? #:allow-other-keys)
(when tests?
(with-directory-excursion (string-append "src/" import-path)
(invoke "go" "test" "-v" "./...")))))
(add-after 'check 'remove-testdata
(lambda* (#:key tests? import-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" import-path)
(delete-file-recursively "testdata")))))))
(propagated-inputs
(list go-github-com-google-go-cmp
go-golang-org-x-sync