bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18745:


From: Juanma Barranquero
Subject: bug#18745:
Date: Sun, 1 Nov 2015 00:20:34 +0100

On Fri, Oct 30, 2015 at 9:10 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> If the batch says
>
>   cmd /c echo arg1 = %1, arg2 = %2
>
> i.e. invokes cmd.exe from the batch file, does the test still fail?

With

            (with-temp-file batfile
              (insert "@cmd /c echo arg1 = %1, arg2 = %2\n"))

it still works on cmd.exe, fails on tcc.exe

> If it still fails, I think making the test more tolerant of the
> trailing whitespace is IMO a better alternative than letting it fail.
> After all, that trailing space is not what we are testing there.

Something like this, you mean?

diff --git a/test/automated/process-tests.el b/test/automated/process-tests.el
index 1dab615..58a2de7 100644
--- a/test/automated/process-tests.el
+++ b/test/automated/process-tests.el
@@ -61,15 +61,15 @@ process-test-sentinel-wait-function-working-p
             ;; to force quoting.
             (setq batfile (make-temp-file "echo args" nil ".bat"))
             (with-temp-file batfile
-              (insert "@echo arg1 = %1, arg2 = %2\n"))
+              (insert "@echo arg1=%1, arg2=%2\n"))
             (with-temp-buffer
               (call-process batfile nil '(t t) t "x &y")
-              (should (string= (buffer-string) "arg1 = \"x &y\", arg2 = \n")))
+              (should (string= (buffer-string) "arg1=\"x &y\", arg2=\n")))
             (with-temp-buffer
               (call-process-shell-command
                (mapconcat #'shell-quote-argument (list batfile "x &y") " ")
                nil '(t t) t)
-              (should (string= (buffer-string) "arg1 = \"x &y\", arg2 = \n"))))
+              (should (string= (buffer-string) "arg1=\"x &y\", arg2=\n"))))
         (when batfile (delete-file batfile))))))
 
 (ert-deftest process-test-stderr-buffer ()
warning: LF will be replaced by CRLF in test/automated/process-tests.el.
The file will have its original line endings in your working directory.



BTW, curiously, the stderr-related tests in the same test file (process-test-stderr-buffer and process-test-stderr-filter) fail sometimes. Much more frequently on TCC than CMD, but they also fail in CMD, as in these examples:

C:\...\automated> ..\..\src\emacs.exe -Q -batch -l ert -l process-tests.elc -f ert-run-tests-batch-and-exit
Running 5 tests (2015-10-31 23:35:46+0100)
   passed  1/5  process-test-quoted-batfile
   passed  2/5  process-test-sentinel-accept-process-output
   passed  3/5  process-test-sentinel-sit-for
Test process-test-stderr-buffer backtrace:
  #[nil "\306\307C \310 \311 \3121 \313\216\314      \"\211 )0\202 \210
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test process-test-stderr-buffer nil #[ni
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test p
  ert-run-tests(t #[385 "\306 \307\"\203G \211\211G\310U\203 \211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-l" "ert" "-l" "process-tests.elc" "-f" "ert-run-te
  command-line()
  normal-top-level()
Test process-test-stderr-buffer condition:
    (ert-test-failed
     ((should
       (with-current-buffer stderr-buffer
         (goto-char ...)
         (looking-at "hello stderr!")))
      :form
      (save-current-buffer
        (set-buffer stderr-buffer)
        (goto-char
         (point-min))
        (looking-at "hello stderr!"))
      :value nil))
   FAILED  4/5  process-test-stderr-buffer
   passed  5/5  process-test-stderr-filter

Ran 5 tests, 4 results as expected, 1 unexpected (2015-10-31 23:35:47+0100)

1 unexpected results:
   FAILED  process-test-stderr-buffer


C:\...\automated> ..\..\src\emacs.exe -Q -batch -l ert -l process-tests.elc -f ert-run-tests-batch-and-exit
Running 5 tests (2015-10-31 23:34:42+0100)
   passed  1/5  process-test-quoted-batfile
   passed  2/5  process-test-sentinel-accept-process-output
   passed  3/5  process-test-sentinel-sit-for
   passed  4/5  process-test-stderr-buffer
Test process-test-stderr-filter backtrace:
  #[nil "\306\307C \310 \311 \3121 \313\216\314      \"\211 )0\202 \210
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test process-test-stderr-filter nil #[ni
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test p
  ert-run-tests(t #[385 "\306 \307\"\203G \211\211G\310U\203 \211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-l" "ert" "-l" "process-tests.elc" "-f" "ert-run-te
  command-line()
  normal-top-level()
Test process-test-stderr-filter condition:
    (ert-test-failed
     ((should stderr-sentinel-called)
      :form stderr-sentinel-called :value nil))
   FAILED  5/5  process-test-stderr-filter

Ran 5 tests, 4 results as expected, 1 unexpected (2015-10-31 23:34:43+0100)

1 unexpected results:
   FAILED  process-test-stderr-filter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]