GNU bug report logs -
#30327
27.0.50; Failures in files-tests.el on macOS
Previous Next
Reported by: Alan Third <alan <at> idiocy.org>
Date: Fri, 2 Feb 2018 20:33:02 UTC
Severity: normal
Tags: fixed
Found in version 27.0.50
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Philipp Stephani <p.stephani2 <at> 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.
[v1-0001-Don-t-require-all-file-attributes-to-be-equal-Bug.patch (text/x-diff, inline)]
From 911722154298b3ee7b8328a84215210de5b8fa00 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 3 Feb 2018 00:44:45 -0500
Subject: [PATCH v1] ; 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 | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 3879ca8731..df9d3ad49b 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -408,10 +408,21 @@ 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 attr-nospecial 4) nil)
+ (setf (nth attr-tmpdir 4) nil)
+ ;; Element 9 is unspecified.
+ (setf (nth attr-nospecial 9) nil)
+ (setf (nth attr-tmpdir 9) 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)))))
+ (should (files-tests-file-attributes-equal
+ (directory-files-and-attributes nospecial-dir)
+ (directory-files-and-attributes tmpdir)))))
(ert-deftest files-tests-file-name-non-special-dired-compress-handler ()
;; `dired-compress-file' can get confused by filenames with ":" in
@@ -442,7 +453,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
This bug report was last modified 7 years and 110 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.