From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Daniel_Mart=C3=ADn?= Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix some failing tests in BSD systems Date: Sun, 03 Jan 2021 18:16:46 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38251"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 03 18:18:33 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kw71T-0009pp-Qu for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Jan 2021 18:18:31 +0100 Original-Received: from localhost ([::1]:58188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kw71S-0000Sg-Tg for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Jan 2021 12:18:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kw6zx-00088b-2O for emacs-devel@gnu.org; Sun, 03 Jan 2021 12:16:57 -0500 Original-Received: from sonic304-22.consmr.mail.ir2.yahoo.com ([77.238.179.147]:41887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kw6zu-0006cH-H7 for emacs-devel@gnu.org; Sun, 03 Jan 2021 12:16:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1609694208; bh=Km7AHPSanKdN+eW3Oc0oM0bL9Ex+Md4o5h3S9uJnriM=; h=From:To:Subject:Date:References:From:Subject; b=LVhY/TWDKSjFs80OxGWUEw1ccR6RSwNIDUNRGjbNBey0f8iJIUuwHJvtvJ814+hjZ9dnul2j0LzVSTlIBW+9NCXR6v939ttRy5QlBbyOtpWP842xxC9vlZxYkjP5TbPOCcvZ1BO8KQTsLN7Iord9wWfcycRqEjcFDcySflUnrXUENc3XLV6TMU9XbfIUwBtSijZrLEySuxYr6TqIsusP7s+HElBfWJHC8uqRmd2e1Cl3JGHpS2GNF5H5wL1ZELdVkIFl6OPyTzxtZVk0JZhR79KpXs6/9ffqyNxc0G8j624eOgdddZNg7G0M5k9YdeDdjeS7mrrf5oTtdkzFUn9Cbg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1609694209; bh=ajBH+U17ghef3ovIwgY6TnnS4rh48N+OcIPSe2hrTZd=; h=From:To:Subject:Date:From:Subject; b=IGckz3lZP5xNT6qoadQwCD5R14lOU5naaonL+oGAUABarHXmuwxlldJaPtTDOqyagihypApS1dMO7OupZ1Jlf16aMjc1htHAYQoWrtm3HCYQ+zZUzkD89dlfPBBesGlXK9edGbWwWKpsStDepyRCqmWF7rg2l4QEVfAKszYdX6fDi1PDXwnJMni84qrNBRpyEUAr++zMIlWKLuS4TczL1/zSjjpk6KRmTBtDARi72pgEKzTi1DuS0ht9GFbQSnYQdazOilabJTUvuv6pu5Toz6FyZJb+MSFPL4F8zSkFeZFi648iT3XSuRhE0M9H6Ro3CX+/QhtP17idGXXY2Aoy8g== X-YMail-OSG: dIUE.c0VM1mxizL06E8aWIYxirEOjfkuar.KEQB.O88kgoHSKL0o0gsu0E46QAg DRET.2IpG5DMVooyQzjmf3H.AP8JkYICDX.F1V9ph2aQi2A4Ps_wbeq4CyOCK5yA2SKOqugLInnx o1n8ibKxZSm4ZEcQWuJp1olwByHQdcjppm6EGhM30momhksA8HT8TJmF4D1O3pjxCLD6RSfRWF3K YEju4BgI0DdwkndeiHegKzTMgEYEpV0jfrP9aDNleBFUSNe.3YFBpnJKI6PXoFANvTu0lYqMCDcb JwdqRpjE2Y_wliypsMlYKft8kfl9o1tptwXrTvBMi8aT3WOPNqn1ItMhH3Z.qk703eVGSanyW5Um AljnW3naYwNbyxjKXZkAnjKSth7ugCEBpyEXc.VZDU6EfL5CIcZ2DoPWF7G.u_FoO35qg0FHDLjC eSuxko1ZGjoXRGYLGNP3BKEKiTrzHT8TufeEpBzCYS9ivm9iE1eL.HHhbRqJynQxhPCqNLLLcFrD bTnZ26xyE1bJ6mhyFbiBbKOxNNDcVRmlqu3_1ojHDSVk7VXn71JtJk.EUGMPmxBWyA5E9haXqpGM P5xajl1SBKDdSJa6BeAP.tzIOUZNrXwhcsMsxwHbRLJ_Z6D3UiGo095dgNf4WKGPIcnVS2zCkKXC D3N0qANYoFNdlRBwtFfoV67wZGylVHLuB0nv4K8uIFAuJwhQoX3RjLVmS.kjue8yt0Q_j8auCKz. BkoT2kxhJZ50aYZdloREGFBoB.Np_pmIyc6pETgSDdW4aFkRnvWf.gYt84cwLNvNYTkdXQ6x4OkG .GF_Oopz3m6fbH1zdoBNGshCP.btG8_gMpCx6iLiZD Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ir2.yahoo.com with HTTP; Sun, 3 Jan 2021 17:16:48 +0000 Original-Received: by smtp410.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 398e672d17d1a49e8eb19f8349cc97c6; Sun, 03 Jan 2021 17:16:47 +0000 (UTC) X-Mailer: WebService/1.1.17278 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.8) Received-SPF: pass client-ip=77.238.179.147; envelope-from=mardani29@yahoo.es; helo=sonic304-22.consmr.mail.ir2.yahoo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:262369 Archived-At: --=-=-= Content-Type: text/plain A couple of tests are failing for me on master and a BSD system (macOS): 2 unexpected results: FAILED xref--xref-file-name-display-is-abs FAILED xref--xref-file-name-display-is-relative-to-project-root An extract of a test failure is (list-elt 0 (arrays-of-different-length 25 24 "xref-resources//file1.txt" "xref-resources/file1.txt" first-mismatch-at 15)) The reason for the failure is that BSD 'find' sometimes outputs paths with an extra '/', for example: find /path/emacs/test/lisp/progmodes/xref-resources/ -type f \( -iname \* \) /path/emacs/test/lisp/progmodes/xref-resources//file2.txt /path/emacs/test/lisp/progmodes/xref-resources//file1.txt (Note the trailing '/' in the first argument to 'find'.) As I think this differs from GNU find but it's still a valid POSIX path, I decided to make the tests more flexible. Could you install the attached patch if you think it does TRT? Thanks. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-some-xref-tests-for-systems-with-BSD-find.patch >From 6c82722c7ecba28fce619fa4b4fcb3d4425ffa64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sun, 3 Jan 2021 18:13:07 +0100 Subject: [PATCH] Fix some xref-tests for systems with BSD find Some versions of BSD find, like those present on macOS systems, may return a file path with two intermediate slashes (eg. "path/to//resource"). As this is valid POSIX, just make the tests more flexible to accommodate for this situation. --- test/lisp/progmodes/xref-tests.el | 38 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el index eaafc5888c..dd083d655b 100644 --- a/test/lisp/progmodes/xref-tests.el +++ b/test/lisp/progmodes/xref-tests.el @@ -99,13 +99,18 @@ xref--buf-pairs-iterator-cleans-up-markers (should (null (marker-position (cdr (nth 0 (cdr cons2)))))))) (ert-deftest xref--xref-file-name-display-is-abs () - (let ((xref-file-name-display 'abs)) - (should (equal (delete-dups - (mapcar 'xref-location-group - (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) - (list - (concat xref-tests--data-dir "file1.txt") - (concat xref-tests--data-dir "file2.txt")))))) + (let ((xref-file-name-display 'abs) + ;; BSD find may add an extra '/' to the path. + (expected (list + (concat xref-tests--data-dir "/?file1.txt") + (concat xref-tests--data-dir "/?file2.txt"))) + (actual (delete-dups + (mapcar 'xref-location-group + (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))))) + (should (and (= (length expected) (length actual)) + (cl-every (lambda (e1 e2) + (string-match-p e1 e2)) + expected actual))))) (ert-deftest xref--xref-file-name-display-is-nondirectory () (let ((xref-file-name-display 'nondirectory)) @@ -121,10 +126,15 @@ xref--xref-file-name-display-is-relative-to-project-root (file-name-directory (directory-file-name xref-tests--data-dir))) (project-find-functions #'(lambda (_) (cons 'transient data-parent-dir))) - (xref-file-name-display 'project-relative)) - (should (equal (delete-dups - (mapcar 'xref-location-group - (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) - (list - "xref-resources/file1.txt" - "xref-resources/file2.txt"))))) + (xref-file-name-display 'project-relative) + ;; BSD find may add an extra '/' to the path. + (expected (list + "xref-resources//?file1.txt" + "xref-resources//?file2.txt")) + (actual (delete-dups + (mapcar 'xref-location-group + (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))))) + (should (and (= (length expected) (length actual)) + (cl-every (lambda (e1 e2) + (string-match-p e1 e2)) + expected actual))))) -- 2.28.0 --=-=-=--