From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.devel Subject: Re: Some testing issues Date: Sat, 8 Jul 2017 00:20:23 -0400 Message-ID: References: <8737a8j61r.fsf@rosalinde> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1499487671 20508 195.159.176.226 (8 Jul 2017 04:21:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 8 Jul 2017 04:21:11 +0000 (UTC) Cc: Emacs developers To: Stephen Berman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 08 06:21:05 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dThEq-0004oT-Du for ged-emacs-devel@m.gmane.org; Sat, 08 Jul 2017 06:21:00 +0200 Original-Received: from localhost ([::1]:59773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dThEv-0000SO-MP for ged-emacs-devel@m.gmane.org; Sat, 08 Jul 2017 00:21:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dThEJ-0000S2-Bx for emacs-devel@gnu.org; Sat, 08 Jul 2017 00:20:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dThEI-0001kJ-BF for emacs-devel@gnu.org; Sat, 08 Jul 2017 00:20:27 -0400 Original-Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]:36820) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dThEI-0001jZ-5R for emacs-devel@gnu.org; Sat, 08 Jul 2017 00:20:26 -0400 Original-Received: by mail-oi0-x231.google.com with SMTP id x187so41997017oig.3 for ; Fri, 07 Jul 2017 21:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=rFUL5t4E8tG7L9xA3fvsgCJ2vTlq8y0UQkn5nvLudKQ=; b=cPRuuPGTJLw2E5THlcg8mR300pRCHQKRDZFVAZQDM4fX+4OFUWQyZ9pKe3jOjbYRme zBHBMW7osvVTSm3hufuscuI9dW5O7riFcXirgL0iuTEnoNwjZ7ObM9Iz0mtSvpFX+tI5 /t2tEksrrR/zgjkVt4QxX4v5wYPnK1L21m13U9dDM9pArNNShTUsUgmDsgG7clwVZwQU SSUBAKogQ3H+OOOA0aDkrF+GJIApd5W/c1Czke+Esr/X7r+kyqHsCjaXj02fqjIIn6lw 8eTYZ30OUtywouT2m89lnqVqoL7S7TEDNGSlOmTKTFY9tcrXb0ZJWh16AAPXkFe4+chL Vp7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=rFUL5t4E8tG7L9xA3fvsgCJ2vTlq8y0UQkn5nvLudKQ=; b=GgRBV48PdGRPq4D3V6Cuxxdy+quYi4A+pvLBnXzOmCIFI/tvLPeD2lF7mocI1d2LKY 1U8PrM8OBbF0HWAo34cuQ3mmKKVsDcWhw1bjf9JAupTbvKNM69bnHDSsUtrS23FQIw8m ZFbU16VukkH69Ry6I/sKoc523a6RejtbmhLShw8eJGwKHSNWjVoRhO5TNWfz1OWsDp2A G+deVQq+M+Ye4LT9ZkBQ42DZT+n/LeUGLILcyjqhK2hsfWg9H4tge8N3sHWv3K3HPEgM CgsQo/KR7AkapUKgU/9FcRZ4f7CsHACb5WiGVhY/Z6znVkaN3hsqqkNs1iot8kd717gG zS5g== X-Gm-Message-State: AIVw111YG6nCXVxN2tcsci1LSJiFMPIeLGH1boulunYbcji/utiEKPsT 87BuK2P1TsfNAnlC13qWLyAMVyC57Q== X-Received: by 10.202.87.130 with SMTP id l124mr2364833oib.180.1499487623881; Fri, 07 Jul 2017 21:20:23 -0700 (PDT) Original-Received: by 10.74.113.91 with HTTP; Fri, 7 Jul 2017 21:20:23 -0700 (PDT) In-Reply-To: <8737a8j61r.fsf@rosalinde> X-Google-Sender-Auth: w6GLU4mcF9YovOEIjZ6rM0TxcFA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216300 Archived-At: On Fri, Jul 7, 2017 at 5:22 PM, Stephen Berman wrote: > Several of the tests call the function todo-toggle-view-done-items, > which contains this code: > > (if (not (pos-visible-in-window-p shown)) > (recenter) > > (`shown' stores the position of the first done item in the category, if > it is shown.) When using todo-mode and also when stepping through the > function with Edebug, it works as expected. If I comment out the set-window-buffer call it fails for me in Edebug as well (when running the first time). By the way, in order to run successfully I did also need the following patch, otherwise all the tests failed (I think it only happens for me because I'm running from an Emacs that's living under my home directory). modified test/lisp/calendar/todo-mode-tests.el @@ -46,6 +46,7 @@ (defmacro with-todo-test (&rest body) "Set up an isolated todo-mode test environment." (declare (debug (body))) `(let* ((todo-test-home (make-temp-file "todo-test-home-" t)) + (abbreviated-home-dir nil) (process-environment (cons (format "HOME=%s" todo-test-home) process-environment)) (todo-directory todo-test-data-dir) > But when running the tests, > sometimes -- but not always -- it fails with the error "`recenter'ing a > window that does not display current-buffer." In those cases, the test > failure is prevented by evaluating the following sexp immediately before > calling todo-toggle-view-done-items: > > (set-window-buffer nil (current-buffer)) > > When using todo-mode this is not necessary, because the selected window > always contains the current buffer when the function is called, but > apparently when running the tests, this isn't always the case, although > according to Edebug it is, AFAICT. When I evaluate (selected-window) in edebug before the call, I see that the selected window is showing the *ert* buffer. > And again, the failure only happens > in some cases, though in those, it is reliably reproducible. In > addition, in at least one case, when I rerun the test immediately after > it fails, then it succeeds. I think it succeeds the second time because the *ert* buffer is in a different state. > And lastly, in one case, the test succeeds > without the set-window-buffer call when run interactively, but fails > without it when run in batch mode from the shell. Any idea what's going > on here? (If anyone wants to take a closer look, comments in the test > file point out the problematic cases.) todo-test-toggle-item-header04? I added a `message' call, and it seems that in batch mode the selected window shows *scratch* whereas in interactive mode it shows *ert*. I would say the success in interactive mode is just a coincidence. > > A second problem concerns trying to reference a message in a test. The > function todo-toggle-view-done-items outputs a message if the category > contains no done items, and the test captures this by calling > current-message immediately after todo-toggle-view-done-items. This > works when running the test interactively, but in a batch run, > current-message is nil (though the message is output in the shell). > Why? I think it's simply that there is no echo-area or any concept of a "current" message when running in batch mode. lread-tests--last-message might be worth looking at: (defun lread-tests--last-message () (with-current-buffer "*Messages*" (save-excursion (goto-char (point-max)) (skip-chars-backward "\n") (buffer-substring (line-beginning-position) (point)))))