gnu: clitest: Fix test failure with newer grep.

* gnu/packages/patches/clitest-grep-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/check.scm (clitest)[source](patches): New field.
[arguments]: While at it, remove obsolete substitution.
This commit is contained in:
Marius Bakke 2023-04-30 23:16:54 +08:00
parent f9a60f3467
commit a34348967e
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
3 changed files with 29 additions and 7 deletions

View file

@ -1000,6 +1000,7 @@ dist_patch_DATA = \
%D%/packages/patches/classpath-aarch64-support.patch \ %D%/packages/patches/classpath-aarch64-support.patch \
%D%/packages/patches/classpath-miscompilation.patch \ %D%/packages/patches/classpath-miscompilation.patch \
%D%/packages/patches/cling-use-shared-library.patch \ %D%/packages/patches/cling-use-shared-library.patch \
%D%/packages/patches/clitest-grep-compat.patch \
%D%/packages/patches/clog-fix-shared-build.patch \ %D%/packages/patches/clog-fix-shared-build.patch \
%D%/packages/patches/clucene-pkgconfig.patch \ %D%/packages/patches/clucene-pkgconfig.patch \
%D%/packages/patches/cmake-curl-certificates-3.24.patch \ %D%/packages/patches/cmake-curl-certificates-3.24.patch \

View file

@ -310,6 +310,7 @@ (define-public clitest
(method git-fetch) (method git-fetch)
(uri (git-reference (url home-page) (commit version))) (uri (git-reference (url home-page) (commit version)))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(patches (search-patches "clitest-grep-compat.patch"))
(sha256 (sha256
(base32 (base32
"1p745mxiq3hgi3ywfljs5sa1psi06awwjxzw0j9c2xx1b09yqv4a")))) "1p745mxiq3hgi3ywfljs5sa1psi06awwjxzw0j9c2xx1b09yqv4a"))))
@ -325,13 +326,6 @@ (define-public clitest
(replace 'check (replace 'check
(lambda* (#:key tests? #:allow-other-keys) (lambda* (#:key tests? #:allow-other-keys)
(when tests? (when tests?
(substitute* "test.md"
;; One test looks for an error from grep in the form "grep: foo",
;; but our grep returns the absolute file name on errors. Adjust
;; the test to cope with that.
(("sed 's/\\^e\\*grep: \\.\\*/")
"sed 's/.*e*grep: .*/"))
(setenv "HOME" "/tmp") (setenv "HOME" "/tmp")
(invoke "./clitest" "test.md")))) (invoke "./clitest" "test.md"))))
(replace 'install (replace 'install

View file

@ -0,0 +1,27 @@
Suppress a warning from grep which causes tests to fail.
Taken from upstream pull request:
https://github.com/aureliojargas/clitest/pull/54
diff --git a/test/inline-match-egrep.sh b/test/inline-match-egrep.sh
--- a/test/inline-match-egrep.sh
+++ b/test/inline-match-egrep.sh
@@ -42,7 +42,7 @@ $ printf ' \t \t\t \n' #=> --egrep ^ $
# egrep regexes. You'll need to test in your system if that's the
# case. I recommend using a literal tab to avoid problems.
-$ printf 'may\tfail' #=> --egrep ^may\tfail$
+$ printf 'may\tfail' #=> --egrep ^may\\tfail$
$ printf 'may\tfail' #=> --egrep ^may[\t]fail$
$ printf 'will\tmatch' #=> --egrep ^will match$
@@ -51,7 +51,7 @@ $ printf 'will\tmatch' #=> --egrep ^will match$
# These tests will fail:
$ printf 'will\nfail' #=> --egrep will.*fail
-$ printf 'will\nfail' #=> --egrep will\nfail
+$ printf 'will\nfail' #=> --egrep will\\nfail
# If one line of a multiline results matches, the test is OK