GNU bug report logs - #45819
28.0.50; time-stamp-tests failures

Previous Next

Package: emacs;

Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Date: Tue, 12 Jan 2021 16:56:02 UTC

Severity: normal

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45819 in the body.
You can then email your comments to 45819 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to stepheng+emacs <at> gildea.com, bug-gnu-emacs <at> gnu.org:
bug#45819; Package emacs. (Tue, 12 Jan 2021 16:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Basil L. Contovounesios" <contovob <at> tcd.ie>:
New bug report received and forwarded. Copy sent to stepheng+emacs <at> gildea.com, bug-gnu-emacs <at> gnu.org. (Tue, 12 Jan 2021 16:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; time-stamp-tests failures
Date: Tue, 12 Jan 2021 16:55:10 +0000
[Message part 1 (text/plain, inline)]
X-Debbugs-Cc: Stephen Gildea <stepheng+emacs <at> gildea.com>

I've been seeing the attached failures in time-stamp-format-am-pm,
time-stamp-format-ignored-modifiers, and time-stamp-format-string-width
for a while now.

My guess is that all three are failing because AM/PM format is not
supported in my locale, and so '%p' returns an empty string, as per
(info "(libc) Formatting Calendar Time").

Should the tests be changed to just also handle an empty/blank string,
or is a more complicated fix required?

Thanks,

-- 
Basil

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2021-01-12 built on tia
Repository revision: ca024b0575c4ea754c4c6e6dbf21ed610e0d1fb8
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-O2 -march=native' --config-cache
 --prefix=/home/blc/.local --enable-checking=structs
 --with-x-toolkit=lucid --with-file-notification=yes --with-x'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11
XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml easymenu mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process emacs)

[time-stamp-tests.log (text/plain, inline)]
Running 27 tests (2021-01-12 16:30:45+0000, selector ‘(not (or (tag :expensive-test) (tag :unstable)))’)
   passed   1/27  time-stamp-custom-count (0.000162 sec)
   passed   2/27  time-stamp-custom-end (0.000067 sec)
   passed   3/27  time-stamp-custom-format-tabs-expand (0.000161 sec)
   passed   4/27  time-stamp-custom-inserts-lines (0.000088 sec)
   passed   5/27  time-stamp-custom-pattern (0.000928 sec)
   passed   6/27  time-stamp-custom-time-zone (0.000124 sec)
Test time-stamp-format-am-pm backtrace:
  signal(ert-test-failed (((should (equal (time-stamp-string "%#p" ref
  ert-fail(((should (equal (time-stamp-string "%#p" ref-time1) "pm")) 
  #f(compiled-function () #<bytecode -0x8b3f0cf664f83f8>)()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name time-stamp-format-am-pm :documentatio
  ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
  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" "lisp/time-stamp-tests" "-
  command-line()
  normal-top-level()
Test time-stamp-format-am-pm condition:
    (ert-test-failed
     ((should
       (equal
	(time-stamp-string "%#p" ref-time1)
	"pm"))
      :form
      (equal "" "pm")
      :value nil :explanation
      (arrays-of-different-length 0 2 "" "pm" first-mismatch-at 0)))
   FAILED   7/27  time-stamp-format-am-pm (0.000081 sec)
   passed   8/27  time-stamp-format-day-number-in-week (0.000068 sec)
   passed   9/27  time-stamp-format-day-of-month (0.000077 sec)
   passed  10/27  time-stamp-format-day-of-week (0.000069 sec)
   passed  11/27  time-stamp-format-hours-12 (0.000093 sec)
   passed  12/27  time-stamp-format-hours-24 (0.000092 sec)
Test time-stamp-format-ignored-modifiers backtrace:
  signal(ert-test-failed (((should (equal (time-stamp-string "%.,@-+_ 
  ert-fail(((should (equal (time-stamp-string "%.,@-+_ ^(stuff)P" ref-
  #f(compiled-function () #<bytecode 0xc68192e38314a10>)()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name time-stamp-format-ignored-modifiers :
  ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
  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" "lisp/time-stamp-tests" "-
  command-line()
  normal-top-level()
Test time-stamp-format-ignored-modifiers condition:
    (ert-test-failed
     ((should
       (equal
	(time-stamp-string "%.,@-+_ ^(stuff)P" ref-time3)
	"AM"))
      :form
      (equal "  " "AM")
      :value nil :explanation
      (array-elt 0
		 (different-atoms
		  (32 "#x20" "? ")
		  (65 "#x41" "?A")))))
   FAILED  13/27  time-stamp-format-ignored-modifiers (0.000074 sec)
   passed  14/27  time-stamp-format-minute (0.000109 sec)
   passed  15/27  time-stamp-format-month-name (0.000061 sec)
   passed  16/27  time-stamp-format-month-number (0.000075 sec)
   passed  17/27  time-stamp-format-non-conversions (0.000035 sec)
   passed  18/27  time-stamp-format-non-date-conversions (0.000074 sec)
   passed  19/27  time-stamp-format-second (0.000074 sec)
Test time-stamp-format-string-width backtrace:
  signal(ert-test-failed (((should (equal (time-stamp-string "%1P" ref
  ert-fail(((should (equal (time-stamp-string "%1P" ref-time3) "A")) :
  #f(compiled-function () #<bytecode -0x1c7303a0ee5a2b2>)()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name time-stamp-format-string-width :docum
  ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
  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" "lisp/time-stamp-tests" "-
  command-line()
  normal-top-level()
Test time-stamp-format-string-width condition:
    (ert-test-failed
     ((should
       (equal
	(time-stamp-string "%1P" ref-time3)
	"A"))
      :form
      (equal " " "A")
      :value nil :explanation
      (array-elt 0
		 (different-atoms
		  (32 "#x20" "? ")
		  (65 "#x41" "?A")))))
   FAILED  20/27  time-stamp-format-string-width (0.000074 sec)
   passed  21/27  time-stamp-format-time-zone-name (0.000095 sec)
   passed  22/27  time-stamp-format-time-zone-offset (0.000125 sec)
   passed  23/27  time-stamp-format-year-2digit (0.000113 sec)
   passed  24/27  time-stamp-format-year-4digit (0.000040 sec)
   passed  25/27  time-stamp-helper-safe-locals (0.000051 sec)
   passed  26/27  time-stamp-helper-string-defaults (0.000069 sec)
   passed  27/27  time-stamp-helper-zone-type-p (0.000041 sec)

Ran 27 tests, 24 results as expected, 3 unexpected (2021-01-12 16:30:45+0000, 0.232066 sec)

3 unexpected results:
   FAILED  time-stamp-format-am-pm
   FAILED  time-stamp-format-ignored-modifiers
   FAILED  time-stamp-format-string-width


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45819; Package emacs. (Tue, 12 Jan 2021 17:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 45819 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 45819 <at> debbugs.gnu.org
Cc: stephen gildea <stepheng+emacs <at> gildea.com>
Subject: Re: bug#45819: 28.0.50; time-stamp-tests failures
Date: Tue, 12 Jan 2021 17:11:26 +0000
[Message part 1 (text/plain, inline)]
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> I've been seeing the attached failures in time-stamp-format-am-pm,
> time-stamp-format-ignored-modifiers, and time-stamp-format-string-width
> for a while now.
>
> My guess is that all three are failing because AM/PM format is not
> supported in my locale, and so '%p' returns an empty string, as per
> (info "(libc) Formatting Calendar Time").
>
> Should the tests be changed to just also handle an empty/blank string,

Perhaps something like the attached?

Thanks,

-- 
Basil

[0001-Fix-time-stamp-tests-for-non-AM-PM-locales.patch (text/x-diff, inline)]
From 39ef99ab39f7421cb515b41a9e8c5999ded1d5c8 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Tue, 12 Jan 2021 17:08:27 +0000
Subject: [PATCH] Fix time-stamp-tests for non-AM/PM locales

* test/lisp/time-stamp-tests.el (with-time-stamp-test-env): Add
Edebug spec.
(time-stamp-format-am-pm, time-stamp-format-ignored-modifiers)
(time-stamp-format-string-width): Handle locales which don't support
AM/PM formats and return an empty string instead (bug#45819).
---
 test/lisp/time-stamp-tests.el | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index 81488c3df1..c0c5e6dae5 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -26,7 +26,7 @@
 
 (defmacro with-time-stamp-test-env (&rest body)
   "Evaluate BODY with some standard time-stamp test variables bound."
-  (declare (indent defun))
+  (declare (debug (body)) (indent defun))
   `(let ((user-login-name "test-logname")
          (user-full-name "100%d Tester") ;verify "%" passed unchanged
          (buffer-file-name "/emacs/test/time-stamped-file")
@@ -481,16 +481,17 @@ time-stamp-format-year-4digit
     (should (equal (time-stamp-string "%Y" ref-time1) "2006"))))
 
 (ert-deftest time-stamp-format-am-pm ()
-  "Test time-stamp formats for AM and PM strings."
+  "Test time-stamp formats for AM and PM strings.
+Note that `%P' returns an empty string in some locales."
   (with-time-stamp-test-env
     ;; implemented and documented since 1997
-    (should (equal (time-stamp-string "%#p" ref-time1) "pm"))
-    (should (equal (time-stamp-string "%#p" ref-time3) "am"))
-    (should (equal (time-stamp-string "%P" ref-time1) "PM"))
-    (should (equal (time-stamp-string "%P" ref-time3) "AM"))
+    (should (member (time-stamp-string "%#p" ref-time1) '("" "pm")))
+    (should (member (time-stamp-string "%#p" ref-time3) '("" "am")))
+    (should (member (time-stamp-string "%P" ref-time1) '("" "PM")))
+    (should (member (time-stamp-string "%P" ref-time3) '("" "AM")))
     ;; warned 1997-2019, changed in 2019
-    (should (equal (time-stamp-string "%p" ref-time1) "PM"))
-    (should (equal (time-stamp-string "%p" ref-time3) "AM"))))
+    (should (member (time-stamp-string "%p" ref-time1) '("" "PM")))
+    (should (member (time-stamp-string "%p" ref-time3) '("" "AM")))))
 
 (ert-deftest time-stamp-format-day-number-in-week ()
   "Test time-stamp formats for day number in week."
@@ -565,10 +566,12 @@ time-stamp-format-non-date-conversions
       (should (equal (time-stamp-string "%q" ref-time1) "sysname-no-dots")))))
 
 (ert-deftest time-stamp-format-ignored-modifiers ()
-  "Test additional args allowed (but ignored) to allow for future expansion."
+  "Test additional args allowed (but ignored) to allow for future expansion.
+Note that `%P' returns an empty string in some locales."
   (with-time-stamp-test-env
     ;; allowed modifiers
-    (should (equal (time-stamp-string "%.,@-+_ ^(stuff)P" ref-time3) "AM"))
+    (should (member (time-stamp-string "%.,@-+_ ^(stuff)P" ref-time3)
+                    '("  " "AM")))
     ;; not all punctuation is allowed
     (should-not (equal (time-stamp-string "%&P" ref-time3) "AM"))))
 
@@ -578,13 +581,14 @@ time-stamp-format-non-conversions
     (should (equal (time-stamp-string "No percent" ref-time1) "No percent"))))
 
 (ert-deftest time-stamp-format-string-width ()
-  "Test time-stamp string width modifiers."
+  "Test time-stamp string width modifiers.
+Note that `%P' returns an empty string in some locales."
   (with-time-stamp-test-env
     ;; strings truncate on the right or are blank-padded on the left
     (should (equal (time-stamp-string "%0P" ref-time3) ""))
-    (should (equal (time-stamp-string "%1P" ref-time3) "A"))
-    (should (equal (time-stamp-string "%2P" ref-time3) "AM"))
-    (should (equal (time-stamp-string "%3P" ref-time3) " AM"))
+    (should (member (time-stamp-string "%1P" ref-time3) '(" " "A")))
+    (should (member (time-stamp-string "%2P" ref-time3) '("  " "AM")))
+    (should (member (time-stamp-string "%3P" ref-time3) '("   " " AM")))
     (should (equal (time-stamp-string "%0%" ref-time3) ""))
     (should (equal (time-stamp-string "%1%" ref-time3) "%"))
     (should (equal (time-stamp-string "%2%" ref-time3) " %"))
-- 
2.29.2


Added tag(s) fixed. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Mon, 18 Jan 2021 22:53:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 45819 <at> debbugs.gnu.org and "Basil L. Contovounesios" <contovob <at> tcd.ie> Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Mon, 18 Jan 2021 22:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45819; Package emacs. (Mon, 18 Jan 2021 22:54:02 GMT) Full text and rfc822 format available.

Message #15 received at 45819-done <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 45819-done <at> debbugs.gnu.org
Cc: stephen gildea <stepheng+emacs <at> gildea.com>
Subject: Re: bug#45819: 28.0.50; time-stamp-tests failures
Date: Mon, 18 Jan 2021 22:52:49 +0000
tags 45819 fixed
close 45819 28.1
quit

"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> X-Debbugs-Cc: Stephen Gildea <stepheng+emacs <at> gildea.com>
>
> I've been seeing the attached failures in time-stamp-format-am-pm,
> time-stamp-format-ignored-modifiers, and time-stamp-format-string-width
> for a while now.

Now fixed:

time-stamp-tests now pass in more locales
35119b2bc0 2021-01-18 13:47:15 -0800
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=35119b2bc0fd602a19fa0b07d305592d139be6a8

-- 
Basil




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 16 Feb 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 63 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.