[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about test failure on Hydra
From: |
Eli Zaretskii |
Subject: |
Re: Question about test failure on Hydra |
Date: |
Sun, 30 Jul 2017 18:59:34 +0300 |
> From: Stephen Berman <address@hidden>
> Date: Sun, 30 Jul 2017 17:50:38 +0200
>
> (ert-deftest dired-test-bug27243-01 ()
> "Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27243#5 ."
> (let ((test-dir (make-temp-file "test-dir-" t))
> (dired-auto-revert-buffer t) buffers)
> (with-current-buffer (find-file-noselect test-dir)
> (make-directory "test-subdir"))
> (push (dired test-dir) buffers)
> (unwind-protect
> (let ((buf (current-buffer))
> (pt1 (point))
> (test-file (concat (file-name-as-directory "test-subdir")
> "test-file")))
> (write-region "Test" nil test-file nil 'silent nil 'excl)
> ;; Sanity check: point should now be on the subdirectory.
> (should (equal (dired-file-name-at-point)
> (concat (file-name-as-directory test-dir)
> (file-name-as-directory "test-subdir"))))
>
> When it fails, Hydra show dired-file-name-at-point returning e.g. this
> (it's a temporary directory so the name is different on each test run):
>
> "/build/test-dir-26691mMc/../"
>
> while the concat sexp it's being compared with returns (e.g.) this:
>
> "/build/test-dir-26691mMc/test-subdir/"
>
> IIUC dired-file-name-at-point can only return the above result if point
> is on the ".." entry in Dired. But the sexp (dired test-dir) should
> (and in all my test runs does) put point on the first "nontrivial" file
> (i.e. it skips "." and ".."). I don't see how the above code can lead
> to the failure Hydra reports. And again, it doesn't always fail in
> Hydra. Does anyone have any idea what's going on here and what to do
> about it?
Doesn't dired-auto-revert-buffer by default use some kind of file
notifications? If so, this could be some race between the
notification coming in and the rest. You could introduce a wait to
try to solve that, or maybe try turning off file notifications.