unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Alan Third <alan@idiocy.org>
Cc: Philipp Stephani <p.stephani2@gmail.com>,
	Michael Albinus <michael.albinus@gmx.de>,
	30327@debbugs.gnu.org
Subject: bug#30327: 27.0.50; Failures in files-tests.el on macOS
Date: Sat, 03 Feb 2018 11:29:29 -0500	[thread overview]
Message-ID: <87wozuf34m.fsf@users.sourceforge.net> (raw)
In-Reply-To: <20180203161311.GA17938@breton.holly.idiocy.org> (Alan Third's message of "Sat, 3 Feb 2018 16:13:11 +0000")

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

Alan Third <alan@idiocy.org> writes:

> On Sat, Feb 03, 2018 at 12:47:29AM -0500, Noam Postavsky wrote:
>> Philipp Stephani <p.stephani2@gmail.com> writes:
>> 
>> > The differing element is the last access time. This isn't surprising
>> > given that reading the directory accesses it. Probably the test
>> > should simply ignore the fifth element (the access time). 
>> 
>> Ah, good point.  I went through all the different file handlers pretty
>> quickly when writing these tests, so I missed these details.  It passes
>> for me because I mount with 'relatime'.
>> 
>> Element 9 is "unspecified", so I think we shouldn't check that either.
>
> The patch makes it even worse with two failures now:

Sorry about that, I made some initial fix, then after testing, extended
it, but completely forgot to actually try out the extended version.
Here's a patch actually works on my box (and hopefully on others too).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2442 bytes --]

From 0276d2e2d438a4f9606e708ef6367800ad7a5bfc Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 3 Feb 2018 00:44:45 -0500
Subject: [PATCH v2] ; Don't require all file-attributes to be equal
 (Bug#30327)

* test/lisp/files-tests.el (files-tests-file-attributes-equal): New
function.
(files-tests-file-name-non-special-directory-files-and-attributes)
(files-tests-file-name-non-special-file-attributes): Use it instead of
`equal'.
---
 test/lisp/files-tests.el | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 3879ca8731..2c651c6715 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -408,10 +408,23 @@ files-tests--with-temp-file
     (should (equal (directory-files nospecial-dir)
                    (directory-files tmpdir)))))
 
+(defun files-tests-file-attributes-equal (attr1 attr2)
+  ;; Element 4 is access time, which may be changed by the act of
+  ;; checking the attributes.
+  (setf (nth 4 attr1) nil)
+  (setf (nth 4 attr2) nil)
+  ;; Element 9 is unspecified.
+  (setf (nth 9 attr1) nil)
+  (setf (nth 9 attr2) nil)
+  (equal attr1 attr2))
+
 (ert-deftest files-tests-file-name-non-special-directory-files-and-attributes ()
   (files-tests--with-temp-non-special (tmpdir nospecial-dir t)
-    (should (equal (directory-files-and-attributes nospecial-dir)
-                   (directory-files-and-attributes tmpdir)))))
+    (cl-loop for (file1 . attr1) in (directory-files-and-attributes nospecial-dir)
+             for (file2 . attr2) in (directory-files-and-attributes tmpdir)
+             do
+             (should (equal file1 file2))
+             (should (files-tests-file-attributes-equal attr1 attr2)))))
 
 (ert-deftest files-tests-file-name-non-special-dired-compress-handler ()
   ;; `dired-compress-file' can get confused by filenames with ":" in
@@ -442,7 +455,8 @@ files-tests--with-temp-file
 
 (ert-deftest files-tests-file-name-non-special-file-attributes ()
   (files-tests--with-temp-non-special (tmpfile nospecial)
-    (should (equal (file-attributes nospecial) (file-attributes tmpfile)))))
+    (should (files-tests-file-attributes-equal
+             (file-attributes nospecial) (file-attributes tmpfile)))))
 
 (ert-deftest files-tests-file-name-non-special-file-directory-p ()
   (files-tests--with-temp-non-special (tmpdir nospecial-dir t)
-- 
2.11.0


  reply	other threads:[~2018-02-03 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 20:31 bug#30327: 27.0.50; Failures in files-tests.el on macOS Alan Third
2018-02-02 21:03 ` Noam Postavsky
2018-02-02 22:03 ` Michael Albinus
2018-02-02 23:04   ` Alan Third
2018-02-02 23:57     ` Philipp Stephani
2018-02-03  5:47       ` Noam Postavsky
2018-02-03 16:13         ` Alan Third
2018-02-03 16:29           ` Noam Postavsky [this message]
2018-02-03 17:26             ` Alan Third
2018-02-03 19:10               ` Michael Albinus
2018-02-03 19:38                 ` Noam Postavsky

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=87wozuf34m.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=30327@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=michael.albinus@gmx.de \
    --cc=p.stephani2@gmail.com \
    /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).