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: Re: [PATCH] Fix some failing tests in BSD systems Date: Sun, 03 Jan 2021 22:08:56 +0100 Message-ID: References: <83a6tpdiuf.fsf@gnu.org> 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="38009"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 03 22:11:13 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 1kwAee-0009nJ-RB for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Jan 2021 22:11:12 +0100 Original-Received: from localhost ([::1]:36620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwAed-0001Ec-QM for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Jan 2021 16:11:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwAci-0007Mr-I7 for emacs-devel@gnu.org; Sun, 03 Jan 2021 16:09:12 -0500 Original-Received: from sonic306-21.consmr.mail.ir2.yahoo.com ([77.238.176.207]:34915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwAcf-00030N-95 for emacs-devel@gnu.org; Sun, 03 Jan 2021 16:09:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1609708142; bh=1HsXFV0K7ZVYAFfHd7KIpGgCi8Z3utYEp+xRXcvYs34=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject; b=nzwMPU+AjhU22ufm7RSxsdFdtqB1uxD8ViX0NqVTlYUDy+kH4jZwLf2hPSmUlCMku15nV5cWJBrPG0f5sPb4qG/8mk9CoKBK+Tg0Ga/I9PWWYY7z4Mm2RkWgTExzl+0V5X8EfqIgdLyXbsdNZKAN+1nCIhkyUpp0gdbqv/9WeBX6sFGvuGbt8sTI5U1+V8HLoi43Z6WrPga/VibC2i9ojd3cpaeWMdoQKce62jnqU6ZCHc+zWuAYqjrXyriqwOSagOV84ysq8R2pMDOjQK2lpiZAweyjT1MLlGMGnLbKLiKUMKp/EDGjSbuC0ZwbIFfApmB9gM3KYIpnIGz/F5u22g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1609708142; bh=JpVvszh6y2TDO74nszVny7wruQvSw6lj/lu8nThRhXH=; h=From:To:Subject:Date:From:Subject; b=eQq3jMEp9IUbi3ll/cr3jXLb+KZ1tXIn5vbVLikz+3YaRxZzimTq5UzCQ2lMeaIJcxGom7il0tNQQRb1sM2TAUpH6min4E8eRtSE0ci3KbnGME/Sc76v6ZJNPAJBr5ObkSFf8eXFfWK8ddifWc7ikRIRj7dYb1R6KXdSQrmhrSxX6/tN1fpQLGvqwibwZQ66gJwGthkDAYYSP0bZmjh/w9M6epTCuptu6ItZi9+cCKfr5zSu6YZ4fGKnOrxudCNPyMRwYYdC9Xnwb9JiKUMY01ZtzOsjTORwmXsiEkTxH9RoRnoxYZuLZJnH1jX/McdmTm94nXQ5MkROi3EJrehGsQ== X-YMail-OSG: uvofBicVM1k7qsUshiqLLPekzTa5gMxVzvb1o2taXXaw8E165qH2CR9pHer8Cj4 92xtAqW_rFKEVz7QbT4jOxjV78BBeiqUdFha5UvRKqUZ43O.Xf2S5MxI5rhfOSNpOeEAmVHdBbYH MSRhuaFLRGU7vvXweASys7mT3wb7nsB.7rRsCBgOzcIUIqvnf.wDN6UZtJDPr1KcJEqy5AhrvtNs .Cg1REdnRp4DEhSIUw3jo1vnIAj4fmA.uKkE4fStOjLx__FWNL6eyYt.oe1H3UDgrgQS007H4dR0 ZgNsbfMli1LFZ8XGlU_bDRRs9p9_ZT9dQgy69tP5HGeekbAoADKNXYQY1zlhCJTRPr3yOeN2nNqx 1ltbuyuTPEGhaZnMD8ju2muRWc3l3y.cjFnbIYejk61eF70_2iIKZm.Wa0Nf50ZCQvNiUhDYKKkq 6WrbSeIVvRjvx8fmkiXmSaZ3IHpQFq.qxHW_raMv_a569LTQ3skaLJ_XD51DutV5j7lSXXfzQExl R4chYRmNmGMdKyPCfrs3IElVk5NXLiWPkSYW94dHhozgwZnTc4E3Jv4IJ8KcBytyRMnUzJc5IiMS M1_ZLjcEdGePlAPvuKP1Jrfh6sxgxHpaHFJMi4Hrc_QV51WAKtwYBdVFj1EcDc_y7AvXdn3DUPNp OA9lsqYKJOrjjtWorH2KNTsLbzTx9zyQiy6BHDjUzlCPQUYbatSdUBYhmN.qaKLmrom4AtKIXuwU a85fXQMnSucZlpvwQpAZd67k36MG_Bm.R5KDmZtXlRGoshCenfPS3bGhY24DVQGrpexm.X5jMujs VswonRT4hnO4ZiIFizu6QJcoh8rw1sYy55XQmqn1WG Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Sun, 3 Jan 2021 21:09:02 +0000 Original-Received: by smtp411.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID ef0cb11822b043975011430619dbd315; Sun, 03 Jan 2021 21:08:57 +0000 (UTC) In-Reply-To: <83a6tpdiuf.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 03 Jan 2021 19:35:20 +0200") 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.176.207; envelope-from=mardani29@yahoo.es; helo=sonic306-21.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:262379 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Daniel Mart=C3=ADn >> Date: Sun, 03 Jan 2021 18:16:46 +0100 >>=20 >> (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"))) > > Why are we producing file names by concatenation, instead of calling > expand-file-name? Wouldn't using the latter solve the problem? Or > what did I miss? Yes. I've attached another solution in terms of expand-file-name and file-relative-name. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-some-xref-tests-for-systems-with-BSD-find.patch >From 4a6eabf615d6b82d4dc570afe801833dd03295ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sun, 3 Jan 2021 21:49:22 +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 build their paths in a more portable way. --- test/lisp/progmodes/xref-tests.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el index eaafc5888c..32cb2960a1 100644 --- a/test/lisp/progmodes/xref-tests.el +++ b/test/lisp/progmodes/xref-tests.el @@ -101,11 +101,13 @@ xref--buf-pairs-iterator-cleans-up-markers (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\\)"))) + (mapcar + (lambda (e) + (expand-file-name (xref-location-group e))) + (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) (list - (concat xref-tests--data-dir "file1.txt") - (concat xref-tests--data-dir "file2.txt")))))) + (expand-file-name "file1.txt" xref-tests--data-dir) + (expand-file-name "file2.txt" xref-tests--data-dir)))))) (ert-deftest xref--xref-file-name-display-is-nondirectory () (let ((xref-file-name-display 'nondirectory)) @@ -121,10 +123,12 @@ 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)) + (xref-file-name-display 'project-relative)) (should (equal (delete-dups - (mapcar 'xref-location-group - (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) + (mapcar + (lambda (e) + (file-relative-name (xref-location-group e))) + (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) (list "xref-resources/file1.txt" "xref-resources/file2.txt"))))) -- 2.28.0 --=-=-=--