From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#26337: 26.0.50; Command to run tests with latest source Date: Sun, 02 Apr 2017 14:28:10 +0900 Message-ID: <87vaqnnzth.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1491110953 13716 195.159.176.226 (2 Apr 2017 05:29:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Apr 2017 05:29:13 +0000 (UTC) To: 26337@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 02 07:29:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1cuY4Z-0002rb-3D for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Apr 2017 07:29:07 +0200 Original-Received: from localhost ([::1]:53738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuY4e-0007pm-Ua for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Apr 2017 01:29:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuY4Z-0007pW-6j for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:29:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuY4U-0002cM-8v for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:29:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58116) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuY4U-0002cG-4z for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cuY4T-0004dT-TJ for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Apr 2017 05:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26337 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.149111091217783 (code B ref -1); Sun, 02 Apr 2017 05:29:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Apr 2017 05:28:32 +0000 Original-Received: from localhost ([127.0.0.1]:56315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuY40-0004ck-JI for submit@debbugs.gnu.org; Sun, 02 Apr 2017 01:28:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuY3y-0004cX-CZ for submit@debbugs.gnu.org; Sun, 02 Apr 2017 01:28:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuY3s-0002PH-84 for submit@debbugs.gnu.org; Sun, 02 Apr 2017 01:28:25 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cuY3s-0002PD-52 for submit@debbugs.gnu.org; Sun, 02 Apr 2017 01:28:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuY3q-0007mg-NZ for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:28:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuY3l-0002NK-QH for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:28:22 -0400 Original-Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]:34240) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuY3l-0002NF-KY for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2017 01:28:17 -0400 Original-Received: by mail-pf0-x235.google.com with SMTP id 197so9204119pfv.1 for ; Sat, 01 Apr 2017 22:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=ZltcOomufblV6SwH7GCXN6mR0Mg618NBaXMwOn4kFww=; b=F4vzgU9JcM//XsaWT1lsvv0g1yqWdDDCuWHPdXspn4LmD67kqQonRAlnFTAG27nRl8 86jEnAO88pjKSgE7wwWhVB/KSV2cNfpuuzVU2AHNcDFJN8dR2GtYIvtgFQWUHBN4uZQd 3P6jzSXPA5YqGtihLGy7+zdSc5Mk79y0oHFMcEsSJ4QPfRSzPfcecabGHD+vEWBrqxWL nprvL6MQ6+BQsGvuQLHGPNc3IC8pzGlAaOiOpsMQdutQEB5ox4j/P0cMNh5iO8pEokOF jpqyj+Bn3JunnxNSQ2iXqQiFLI8UvLMBL1XlbOpogWlXUuGtayKx9/NX+BGHUb8dHAY/ sZfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=ZltcOomufblV6SwH7GCXN6mR0Mg618NBaXMwOn4kFww=; b=bakH/pylCkK+jLdF0r4UnXjVDPdAiESdCZc6tnPaKz+EFq3TPShiQSTwPLPHf1VWB4 b5DFikPGrOeoUbodZOMcTfClWNp4yM1PCjC2pnSsmtHxhYiBgHk5JJr8VShe1bZ2Weir mBvf02xu97ZvJG4lI9blMMMSZ3h9kInqPuD56b0rbwplEiC92XeZ/qA0zuS67ztGpQj3 WNbtg5i1B1qausUVge+78bBa5tyGnMK4CORLnmXygw3a31TZsqBqpfZ+5Ao1a1GwWEM4 wBAItVBuFIQ+4dtiTm5vnmpq9BLFa7+jV8COuW1N/jBC/qtU13EfXC1sWQ4ixWbP+nK3 R8yg== X-Gm-Message-State: AFeK/H239ByPNlQe2UGw128lTEluVUKiuCZXnWA6QNCySQGq7Q1DMkbw36jp/jP+ybw9/g== X-Received: by 10.98.19.12 with SMTP id b12mr10507649pfj.21.1491110895113; Sat, 01 Apr 2017 22:28:15 -0700 (PDT) Original-Received: from calancha-pc (234.204.100.220.dy.bbexcite.jp. [220.100.204.234]) by smtp.gmail.com with ESMTPSA id r8sm18568675pfk.80.2017.04.01.22.28.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Apr 2017 22:28:14 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131203 Archived-At: Severity: wishlist I often while debugging follow this workflow: 1) Make some changes in one branch. 2) Compile Emacs. 3) Run one test file with: M-& emacs -batch -l ert -l ? -f ert-run-tests-batch-and-exit RET I never remember the exact command in 3), so i always first check the manual. We have `ert-run-tests-interactively', but that command won't use the just compiled sources: you need first to reload the new .elc. I just wrote one command to do 1-3 above. Interactively prompts for the file with the tests. With a prefix argument, also prompts for the selector. Default to run all the tests. Do you think could be worth to have such a command in ert.el? --8<-----------------------------cut here---------------start------------->8--- commit 14602c92c6e456000b6c2e649b68976f87cd2a4d Author: Tino Calancha Date: Sun Apr 2 14:05:51 2017 +0900 * lisp/emacs-lisp/ert.el (ert-run-tests-batch-in-file): New command. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index e7387e463c..c80d8ee5ae 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1449,6 +1449,41 @@ ert-run-tests-batch (ert-test-name test))))))) nil)) +(declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) +;;;###autoload +(defun ert-run-tests-batch-in-file (file &optional selector) + "Run the tests in FILE specified by SELECTOR. +Interactively prompt for FILE. +Called with a prefix arg prompt for SELECTOR." + (interactive + (let* ((prefix current-prefix-arg) + (def (and (derived-mode-p 'dired-mode) (dired-get-filename))) + (file (read-file-name "Run test: " nil def 'mustmatch nil + (lambda (f) (equal "el" (file-name-extension f))))) + (test (if (not prefix) "t" + (with-temp-buffer + (insert-file-contents file) + (let (all-tests) + (while (re-search-forward "^\\s-*(ert-deftest \\([^[:blank:]]+\\)" nil t) + (push (match-string-no-properties 1) all-tests)) + (unless all-tests + (error "File '%s' doesn't contain any test" file)) + (completing-read "Select a test: " all-tests nil 'mustmatch nil nil "t")))))) + (list file test))) + (if (and (stringp selector) (not (string= selector "t"))) + (setq selector (concat selector "\\\\'")) "t") + (let ((buf (get-buffer-create "*ert*")) + (program (expand-file-name invocation-name invocation-directory))) + (with-current-buffer buf + (let ((inhibit-read-only t)) + (erase-buffer) + (call-process program nil (current-buffer) t + "-batch" "-l" "ert" "-l" file "-eval" + (format + "(ert-run-tests-batch-and-exit\ \"%s\")" + selector)))) + (display-buffer buf))) + ;;;###autoload (defun ert-run-tests-batch-and-exit (&optional selector) "Like `ert-run-tests-batch', but exits Emacs when done. --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.9) of 2017-04-02 Repository revision: a184a7edc58e1e053aa317a0f162df7e225597e1