unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
@ 2023-02-18  5:46 Xi Lu
  2023-02-18  7:29 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Xi Lu @ 2023-02-18  5:46 UTC (permalink / raw)
  To: 61595; +Cc: Xi Lu

---
 test/lisp/emacs-lisp/copyright-tests.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/lisp/emacs-lisp/copyright-tests.el b/test/lisp/emacs-lisp/copyright-tests.el
index abb0913a0d7..040071d90d0 100644
--- a/test/lisp/emacs-lisp/copyright-tests.el
+++ b/test/lisp/emacs-lisp/copyright-tests.el
@@ -59,7 +59,8 @@ test-end-chop
                 "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
         (copyright-update)
         (buffer-substring (- (point-max) 42) (point-max))))
-    "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
+    (format "Copyright 2006, 2007, 2008, %s Foo Bar\n\n"
+            (format-time-string "%Y")))))
 
 (ert-deftest test-correct-notice ()
   (should (equal
@@ -70,7 +71,8 @@ test-correct-notice
                    (copyright-query nil))
                (copyright-update))
              (buffer-string))
-           "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")))
+           (format "Copyright 2021 FSF\nCopyright 2021, %s FSF\n"
+                   (format-time-string "%Y")))))
 
 (provide 'copyright-tests)
 ;;; copyright-tests.el ends here
-- 
2.30.2






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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  5:46 bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure Xi Lu
@ 2023-02-18  7:29 ` Eli Zaretskii
  2023-02-18  7:38   ` lux
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-02-18  7:29 UTC (permalink / raw)
  To: Xi Lu; +Cc: 61595

> Cc: Xi Lu <lx@shellcodes.org>
> From: Xi Lu <lx@shellcodes.org>
> Date: Sat, 18 Feb 2023 13:46:07 +0800
> 
> ---
>  test/lisp/emacs-lisp/copyright-tests.el | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/test/lisp/emacs-lisp/copyright-tests.el b/test/lisp/emacs-lisp/copyright-tests.el
> index abb0913a0d7..040071d90d0 100644
> --- a/test/lisp/emacs-lisp/copyright-tests.el
> +++ b/test/lisp/emacs-lisp/copyright-tests.el
> @@ -59,7 +59,8 @@ test-end-chop
>                  "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
>          (copyright-update)
>          (buffer-substring (- (point-max) 42) (point-max))))
> -    "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
> +    (format "Copyright 2006, 2007, 2008, %s Foo Bar\n\n"
> +            (format-time-string "%Y")))))
>  
>  (ert-deftest test-correct-notice ()
>    (should (equal
> @@ -70,7 +71,8 @@ test-correct-notice
>                     (copyright-query nil))
>                 (copyright-update))
>               (buffer-string))
> -           "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")))
> +           (format "Copyright 2021 FSF\nCopyright 2021, %s FSF\n"
> +                   (format-time-string "%Y")))))

What is the failure, and why using format-time-string solves that?
That test doesn't fail for me.

Please _always_ accompany patches with rationale and the details of
the problem necessary to understand the patch and decide whether it is
the right solution for the problem.  Comments in the code explaining
why it does things that are not self-evident (like uses literal years
for some and format-time-string for others) is also a welcome habit.

Also, this patch lacks the commit log message.

Thanks.





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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  7:29 ` Eli Zaretskii
@ 2023-02-18  7:38   ` lux
  2023-02-18  7:49     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: lux @ 2023-02-18  7:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61595

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

On Sat, 2023-02-18 at 09:29 +0200, Eli Zaretskii wrote:
> > Cc: Xi Lu <lx@shellcodes.org>
> > From: Xi Lu <lx@shellcodes.org>
> > Date: Sat, 18 Feb 2023 13:46:07 +0800
> > 
> > ---
> >  test/lisp/emacs-lisp/copyright-tests.el | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/test/lisp/emacs-lisp/copyright-tests.el
> > b/test/lisp/emacs-lisp/copyright-tests.el
> > index abb0913a0d7..040071d90d0 100644
> > --- a/test/lisp/emacs-lisp/copyright-tests.el
> > +++ b/test/lisp/emacs-lisp/copyright-tests.el
> > @@ -59,7 +59,8 @@ test-end-chop
> >                  "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
> >          (copyright-update)
> >          (buffer-substring (- (point-max) 42) (point-max))))
> > -    "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
> > +    (format "Copyright 2006, 2007, 2008, %s Foo Bar\n\n"
> > +            (format-time-string "%Y")))))
> >  
> >  (ert-deftest test-correct-notice ()
> >    (should (equal
> > @@ -70,7 +71,8 @@ test-correct-notice
> >                     (copyright-query nil))
> >                 (copyright-update))
> >               (buffer-string))
> > -           "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")))
> > +           (format "Copyright 2021 FSF\nCopyright 2021, %s FSF\n"
> > +                   (format-time-string "%Y")))))
> 
> What is the failure, and why using format-time-string solves that?
> That test doesn't fail for me.
> 
> Please _always_ accompany patches with rationale and the details of
> the problem necessary to understand the patch and decide whether it
> is
> the right solution for the problem.  Comments in the code explaining
> why it does things that are not self-evident (like uses literal years
> for some and format-time-string for others) is also a welcome habit.
> 
> Also, this patch lacks the commit log message.
> 
> Thanks.


Test failure happens in Emacs 28.3, for test failure logs, see
copyright-tests.log

I reattach the patch file.

Thanks.


[-- Attachment #2: 0001-test-lisp-emacs-lisp-copyright-tests.el-Fix-test-fai.patch --]
[-- Type: text/x-patch, Size: 1356 bytes --]

From 761287b63f1782b27d9807ee386dedd5e34b74ec Mon Sep 17 00:00:00 2001
From: Xi Lu <lx@shellcodes.org>
Date: Sat, 18 Feb 2023 13:28:06 +0800
Subject: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test
 failure.

---
 test/lisp/emacs-lisp/copyright-tests.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/lisp/emacs-lisp/copyright-tests.el b/test/lisp/emacs-lisp/copyright-tests.el
index abb0913a0d7..040071d90d0 100644
--- a/test/lisp/emacs-lisp/copyright-tests.el
+++ b/test/lisp/emacs-lisp/copyright-tests.el
@@ -59,7 +59,8 @@ test-end-chop
                 "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
         (copyright-update)
         (buffer-substring (- (point-max) 42) (point-max))))
-    "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
+    (format "Copyright 2006, 2007, 2008, %s Foo Bar\n\n"
+            (format-time-string "%Y")))))
 
 (ert-deftest test-correct-notice ()
   (should (equal
@@ -70,7 +71,8 @@ test-correct-notice
                    (copyright-query nil))
                (copyright-update))
              (buffer-string))
-           "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")))
+           (format "Copyright 2021 FSF\nCopyright 2021, %s FSF\n"
+                   (format-time-string "%Y")))))
 
 (provide 'copyright-tests)
 ;;; copyright-tests.el ends here
-- 
2.30.2


[-- Attachment #3: copyright-tests.log --]
[-- Type: text/x-log, Size: 3654 bytes --]

Running 3 tests (2023-02-18 15:33:34+0800, selector `(not (or (tag :expensive-test) (tag :unstable) (tag :nativecomp)))')
   passed  1/3  test-copyright-update (0.000399 sec)
Test test-correct-notice backtrace:
  signal(ert-test-failed (((should (equal (with-temp-buffer (dotimes (
  ert-fail(((should (equal (with-temp-buffer (dotimes (_ 2) (insert "C
  (if (unwind-protect (setq value-12 (apply fn-10 args-11)) (setq form
  (let (form-description-14) (if (unwind-protect (setq value-12 (apply
  (let ((value-12 'ert-form-evaluation-aborted-13)) (let (form-descrip
  (let* ((fn-10 #'equal) (args-11 (condition-case err (let ((signal-ho
  (let ((lexical-binding t)) (let* ((fn-10 #'equal) (args-11 (conditio
  (closure (t) nil (let ((lexical-binding t)) (let* ((fn-10 #'equal) (
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name test-correct-notice :documentation ni
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or ... ... ...))
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable) (tag :n
  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/emacs-lisp/copyright
  command-line()
  normal-top-level()
Test test-correct-notice condition:
    (ert-test-failed
     ((should
       (equal
	(with-temp-buffer ... ... ...)
	"Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n"))
      :form
      (equal "Copyright 2021 FSF\nCopyright 2021, 2023 FSF\n" "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")
      :value nil :explanation
      (array-elt 38
		 (different-atoms
		  (51 "#x33" "?3")
		  (50 "#x32" "?2")))))
   FAILED  2/3  test-correct-notice (0.000267 sec)
Test test-end-chop backtrace:
  signal(ert-test-failed (((should (equal (with-temp-buffer (let (...)
  ert-fail(((should (equal (with-temp-buffer (let ((copyright-query ni
  (if (unwind-protect (setq value-7 (apply fn-5 args-6)) (setq form-de
  (let (form-description-9) (if (unwind-protect (setq value-7 (apply f
  (let ((value-7 'ert-form-evaluation-aborted-8)) (let (form-descripti
  (let* ((fn-5 #'equal) (args-6 (condition-case err (let ((signal-hook
  (let ((lexical-binding t)) (let* ((fn-5 #'equal) (args-6 (condition-
  (closure (t) nil (let ((lexical-binding t)) (let* ((fn-5 #'equal) (a
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name test-end-chop :documentation nil :bod
  ert-run-or-rerun-test(#s(ert--stats :selector (not ...) :tests [... 
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable) (tag :n
  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/emacs-lisp/copyright
  command-line()
  normal-top-level()
Test test-end-chop condition:
    (ert-test-failed
     ((should
       (equal
	(with-temp-buffer ...)
	"Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n"))
      :form
      (equal "Copyright 2006, 2007, 2008, 2023 Foo Bar\n\n" "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")
      :value nil :explanation
      (array-elt 31
		 (different-atoms
		  (51 "#x33" "?3")
		  (50 "#x32" "?2")))))
   FAILED  3/3  test-end-chop (0.000203 sec)

Ran 3 tests, 1 results as expected, 2 unexpected (2023-02-18 15:33:34+0800, 0.165198 sec)

2 unexpected results:
   FAILED  test-correct-notice
   FAILED  test-end-chop


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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  7:38   ` lux
@ 2023-02-18  7:49     ` Eli Zaretskii
  2023-02-18  7:58       ` lux
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-02-18  7:49 UTC (permalink / raw)
  To: lux; +Cc: 61595

> From: lux <lx@shellcodes.org>
> Cc: 61595@debbugs.gnu.org
> Date: Sat, 18 Feb 2023 15:38:22 +0800
> 
> Test failure happens in Emacs 28.3, for test failure logs, see
> copyright-tests.log

Thanks, then I don't think there's a need to install this change, as
the emacs-28 branch is frozen.





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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  7:49     ` Eli Zaretskii
@ 2023-02-18  7:58       ` lux
  2023-02-18  9:10         ` Stefan Kangas
  0 siblings, 1 reply; 9+ messages in thread
From: lux @ 2023-02-18  7:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61595

On Sat, 2023-02-18 at 09:49 +0200, Eli Zaretskii wrote:
> > From: lux <lx@shellcodes.org>
> > Cc: 61595@debbugs.gnu.org
> > Date: Sat, 18 Feb 2023 15:38:22 +0800
> > 
> > Test failure happens in Emacs 28.3, for test failure logs, see
> > copyright-tests.log
> 
> Thanks, then I don't think there's a need to install this change, as
> the emacs-28 branch is frozen.
> 

I see Stefan is testing for the Emacs 28.3 release.





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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  7:58       ` lux
@ 2023-02-18  9:10         ` Stefan Kangas
  2023-02-18  9:20           ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Kangas @ 2023-02-18  9:10 UTC (permalink / raw)
  To: lux, Eli Zaretskii; +Cc: 61595

lux <lx@shellcodes.org> writes:

> I see Stefan is testing for the Emacs 28.3 release.

Thanks for the patch and for the testing, it is much appreciated.

I don't think we will need to worry about test failures on the emacs-28
branch.  The purpose of tests is to aid during development, and there
will be no more development on that branch.  I also think it's better to
minimize the amount of changes on very old branches.

Therefore, I don't think we should install this particular patch at this
time.  I hope that rationale makes sense, and thanks again.





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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  9:10         ` Stefan Kangas
@ 2023-02-18  9:20           ` Eli Zaretskii
  2023-02-18  9:33             ` lux
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-02-18  9:20 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: lx, 61595

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sat, 18 Feb 2023 01:10:57 -0800
> Cc: 61595@debbugs.gnu.org
> 
> I don't think we will need to worry about test failures on the emacs-28
> branch.  The purpose of tests is to aid during development, and there
> will be no more development on that branch.  I also think it's better to
> minimize the amount of changes on very old branches.

Agreed.  On top of that, this release being an emergency security fix,
it should IMO have only the minimum number of changes strictly
necessary to fix the particular problem for which it is being
released.





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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  9:20           ` Eli Zaretskii
@ 2023-02-18  9:33             ` lux
  2023-02-18  9:51               ` Stefan Kangas
  0 siblings, 1 reply; 9+ messages in thread
From: lux @ 2023-02-18  9:33 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Kangas; +Cc: 61595

On Sat, 2023-02-18 at 11:20 +0200, Eli Zaretskii wrote:
> > From: Stefan Kangas <stefankangas@gmail.com>
> > Date: Sat, 18 Feb 2023 01:10:57 -0800
> > Cc: 61595@debbugs.gnu.org
> > 
> > I don't think we will need to worry about test failures on the
> > emacs-28
> > branch.  The purpose of tests is to aid during development, and
> > there
> > will be no more development on that branch.  I also think it's
> > better to
> > minimize the amount of changes on very old branches.
> 
> Agreed.  On top of that, this release being an emergency security
> fix,
> it should IMO have only the minimum number of changes strictly
> necessary to fix the particular problem for which it is being
> released.
> 
> 
> 

Okay, I understand. Thank you.





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

* bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.
  2023-02-18  9:33             ` lux
@ 2023-02-18  9:51               ` Stefan Kangas
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2023-02-18  9:51 UTC (permalink / raw)
  To: lux, Eli Zaretskii; +Cc: 61595-done

lux <lx@shellcodes.org> writes:

> Okay, I understand. Thank you.

Thanks, closing.





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

end of thread, other threads:[~2023-02-18  9:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-18  5:46 bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure Xi Lu
2023-02-18  7:29 ` Eli Zaretskii
2023-02-18  7:38   ` lux
2023-02-18  7:49     ` Eli Zaretskii
2023-02-18  7:58       ` lux
2023-02-18  9:10         ` Stefan Kangas
2023-02-18  9:20           ` Eli Zaretskii
2023-02-18  9:33             ` lux
2023-02-18  9:51               ` Stefan Kangas

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