unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45819: 28.0.50; time-stamp-tests failures
@ 2021-01-12 16:55 Basil L. Contovounesios
  2021-01-12 17:11 ` Basil L. Contovounesios
  2021-01-18 22:52 ` Basil L. Contovounesios
  0 siblings, 2 replies; 3+ messages in thread
From: Basil L. Contovounesios @ 2021-01-12 16:55 UTC (permalink / raw)
  To: 45819; +Cc: stephen gildea

[-- Attachment #1: Type: text/plain, Size: 2977 bytes --]

X-Debbugs-Cc: Stephen Gildea <stepheng+emacs@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)


[-- Attachment #2: time-stamp-tests.log --]
[-- Type: text/plain, Size: 5601 bytes --]

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#45819: 28.0.50; time-stamp-tests failures
  2021-01-12 16:55 bug#45819: 28.0.50; time-stamp-tests failures Basil L. Contovounesios
@ 2021-01-12 17:11 ` Basil L. Contovounesios
  2021-01-18 22:52 ` Basil L. Contovounesios
  1 sibling, 0 replies; 3+ messages in thread
From: Basil L. Contovounesios @ 2021-01-12 17:11 UTC (permalink / raw)
  To: 45819; +Cc: stephen gildea

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

"Basil L. Contovounesios" <contovob@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-time-stamp-tests-for-non-AM-PM-locales.patch --]
[-- Type: text/x-diff, Size: 4383 bytes --]

From 39ef99ab39f7421cb515b41a9e8c5999ded1d5c8 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#45819: 28.0.50; time-stamp-tests failures
  2021-01-12 16:55 bug#45819: 28.0.50; time-stamp-tests failures Basil L. Contovounesios
  2021-01-12 17:11 ` Basil L. Contovounesios
@ 2021-01-18 22:52 ` Basil L. Contovounesios
  1 sibling, 0 replies; 3+ messages in thread
From: Basil L. Contovounesios @ 2021-01-18 22:52 UTC (permalink / raw)
  To: 45819-done; +Cc: stephen gildea

tags 45819 fixed
close 45819 28.1
quit

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

> X-Debbugs-Cc: Stephen Gildea <stepheng+emacs@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-18 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 16:55 bug#45819: 28.0.50; time-stamp-tests failures Basil L. Contovounesios
2021-01-12 17:11 ` Basil L. Contovounesios
2021-01-18 22:52 ` Basil L. Contovounesios

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).