From: Paul Eggert <eggert@cs.ucla.edu>
To: 31318@debbugs.gnu.org
Subject: bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27
Date: Mon, 30 Apr 2018 10:36:31 -0700 [thread overview]
Message-ID: <1cf43452-0e5f-f1f6-6368-d975fd273ce7@cs.ucla.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 447 bytes --]
I upgraded to Fedora 28 beta over the weekend (Fedora 28 is scheduled
for release next week) and ran into one test case failure on the
emacs-26 branch: fns-tests-collate-sort fails (test/src/fns-tests.log is
attached). Looking into the test, it appears that the test is making
unportable assumptions about strcoll behavior in non-POSIX locales, an
assumption that is not true of glibc 2.27 as shipped in Fedora 28.
Proposed patch attached.
[-- Attachment #2: fns-tests.log --]
[-- Type: text/x-log, Size: 3157 bytes --]
Running 37 tests (2018-04-30 10:14:49-0700)
Test fns-tests-collate-sort backtrace:
signal(ert-test-failed (((should (equal (sort '("11" "1 2" "1.2" "12
ert-fail(((should (equal (sort '("11" "1 2" "1.2" "12") (lambda (a b
(if (unwind-protect (setq value-355 (apply fn-353 args-354)) (setq f
(let (form-description-357) (if (unwind-protect (setq value-355 (app
(let ((value-355 'ert-form-evaluation-aborted-356)) (let (form-descr
(let* ((fn-353 (function equal)) (args-354 (condition-case err (let
(lambda nil (let* ((fn-343 (function fns-tests--collate-enabled-p))
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name fns-tests-collate-sort :documentation
ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
command-line-1(("-L" ":." "-l" "ert" "-l" "src/fns-tests.el" "--eval
command-line()
normal-top-level()
Test fns-tests-collate-sort condition:
(ert-test-failed
((should
(equal
(sort ... ...)
'...))
:form
(equal
("1 1" "1.1" "11" "1 2" "1.2" "12")
("11" "1 1" "1.1" "12" "1 2" "1.2"))
:value nil :explanation
(list-elt 0
(arrays-of-different-length 3 2 "1 1" "11" first-mismatch-at 1))))
FAILED 1/37 fns-tests-collate-sort
passed 2/37 fns-tests-collate-strings
passed 3/37 fns-tests-compare-strings
passed 4/37 fns-tests-func-arity
passed 5/37 fns-tests-hash-buffer
passed 6/37 fns-tests-mapcan
passed 7/37 fns-tests-nreverse
passed 8/37 fns-tests-nreverse-bool-vector
passed 9/37 fns-tests-reverse
passed 10/37 fns-tests-reverse-bool-vector
passed 11/37 fns-tests-sort
passed 12/37 fns-tests-string-version-lessp
passed 13/37 lax-plist-get/odd-number-of-elements
passed 14/37 lax-plist-put/odd-number-of-elements
passed 15/37 plist-get/odd-number-of-elements
passed 16/37 plist-member/improper-list
passed 17/37 plist-put/odd-number-of-elements
passed 18/37 test-assoc-testfn
passed 19/37 test-cycle-assoc
passed 20/37 test-cycle-assq
passed 21/37 test-cycle-delete
passed 22/37 test-cycle-delq
passed 23/37 test-cycle-equal
passed 24/37 test-cycle-lax-plist-get
passed 25/37 test-cycle-lax-plist-put
passed 26/37 test-cycle-length
passed 27/37 test-cycle-member
passed 28/37 test-cycle-memq
passed 29/37 test-cycle-memql
passed 30/37 test-cycle-nconc
passed 31/37 test-cycle-plist-get
passed 32/37 test-cycle-plist-member
passed 33/37 test-cycle-plist-put
passed 34/37 test-cycle-rassoc
passed 35/37 test-cycle-rassq
passed 36/37 test-cycle-reverse
passed 37/37 test-cycle-safe-length
Ran 37 tests, 36 results as expected, 1 unexpected (2018-04-30 10:14:52-0700)
1 unexpected results:
FAILED fns-tests-collate-sort
[-- Attachment #3: 0001-Port-collation-tests-to-glibc-2.27.txt --]
[-- Type: text/plain, Size: 3937 bytes --]
From deaadc19c8a59b69bc53b735f9f66e93304010e9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 30 Apr 2018 10:35:04 -0700
Subject: [PATCH] Port collation tests to glibc 2.27
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* test/src/fns-tests.el (fns-tests-collate-strings)
(fns-tests-collate-sort): Don’t make unportable assumptions
about how en_US.UTF-8 collation works. These assumptions
are not true on Fedora 28, which ships with glibc 2.27.
---
test/src/fns-tests.el | 48 +++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index f8554636ba..491915f56a 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -119,10 +119,9 @@ fns-tests--collate-enabled-p
;; In POSIX or C locales, collation order is lexicographic.
(should (string-collate-lessp "XYZZY" "xyzzy" "POSIX"))
- ;; In a language specific locale, collation order is different.
- (should (string-collate-lessp
- "xyzzy" "XYZZY"
- (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))
+ ;; In a language specific locale on MS-Windows, collation order is different.
+ (when (eq system-type 'windows-nt)
+ (should (string-collate-lessp "xyzzy" "XYZZY" "en_US.UTF-8")))
;; Ignore case.
(should (string-collate-equalp "xyzzy" "XYZZY" nil t))
@@ -154,8 +153,6 @@ fns-tests--collate-enabled-p
(9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])))
(ert-deftest fns-tests-collate-sort ()
- ;; See https://lists.gnu.org/r/emacs-devel/2015-10/msg02505.html.
- :expected-result (if (eq system-type 'cygwin) :failed :passed)
(skip-unless (fns-tests--collate-enabled-p))
;; Punctuation and whitespace characters are relevant for POSIX.
@@ -165,15 +162,16 @@ fns-tests--collate-enabled-p
(lambda (a b) (string-collate-lessp a b "POSIX")))
'("1 1" "1 2" "1.1" "1.2" "11" "12")))
;; Punctuation and whitespace characters are not taken into account
- ;; for collation in other locales.
- (should
- (equal
- (sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
- (lambda (a b)
- (let ((w32-collate-ignore-punctuation t))
- (string-collate-lessp
- a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
- '("11" "1 1" "1.1" "12" "1 2" "1.2")))
+ ;; for collation in other locales, on MS-Windows systems.
+ (when (eq system-type 'windows-nt)
+ (should
+ (equal
+ (sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
+ (lambda (a b)
+ (let ((w32-collate-ignore-punctuation t))
+ (string-collate-lessp
+ a b "enu_USA"))))
+ '("11" "1 1" "1.1" "12" "1 2" "1.2"))))
;; Diacritics are different letters for POSIX, they sort lexicographical.
(should
@@ -181,15 +179,17 @@ fns-tests--collate-enabled-p
(sort '("Ævar" "Agustín" "Adrian" "Eli")
(lambda (a b) (string-collate-lessp a b "POSIX")))
'("Adrian" "Agustín" "Eli" "Ævar")))
- ;; Diacritics are sorted between similar letters for other locales.
- (should
- (equal
- (sort '("Ævar" "Agustín" "Adrian" "Eli")
- (lambda (a b)
- (let ((w32-collate-ignore-punctuation t))
- (string-collate-lessp
- a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8")))))
- '("Adrian" "Ævar" "Agustín" "Eli"))))
+ ;; Diacritics are sorted between similar letters for other locales,
+ ;; on MS-Windows systems.
+ (when (eq system-type 'windows-nt)
+ (should
+ (equal
+ (sort '("Ævar" "Agustín" "Adrian" "Eli")
+ (lambda (a b)
+ (let ((w32-collate-ignore-punctuation t))
+ (string-collate-lessp
+ a b "enu_USA"))))
+ '("Adrian" "Ævar" "Agustín" "Eli")))))
(ert-deftest fns-tests-string-version-lessp ()
(should (string-version-lessp "foo2.png" "foo12.png"))
--
2.17.0
next reply other threads:[~2018-04-30 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 17:36 Paul Eggert [this message]
2018-04-30 19:50 ` bug#31318: emacs-26 fns-tests-collate-sort failure on glibc 2.27 Eli Zaretskii
2018-05-01 0:39 ` Paul Eggert
2018-05-01 16:11 ` Eli Zaretskii
2018-05-01 16:31 ` Paul Eggert
2018-05-01 16:49 ` Eli Zaretskii
2019-06-18 23:52 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1cf43452-0e5f-f1f6-6368-d975fd273ce7@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=31318@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).