zsh-workers
 help / color / mirror / code / Atom feed
From: Clinton Bunch <cdb_zsh@zentaur.org>
To: zsh-workers@zsh.org
Subject: [PATCH] diff for test harness (was: There seems to be a problem with the test harness on Solaris 11.4)
Date: Tue, 8 Nov 2022 21:29:04 -0600	[thread overview]
Message-ID: <f2615cb7-ec32-7eed-a6b7-262d4ea5b15e@zentaur.org> (raw)
In-Reply-To: <661bf664-e751-6c2a-0562-46f0e7caf9cd@zentaur.org>

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

On 11/7/2022 1:39 PM, Clinton Bunch wrote:
> On 11/6/2022 1:32 PM, Clinton Bunch wrote:
>> On 11/6/2022 1:09 PM, Bart Schaefer wrote:
>>> On Sun, Nov 6, 2022 at 10:35 AM Clinton Bunch <cdb_zsh@zentaur.org> 
>>> wrote:
>>>> Solaris 11.4 at least also has GNU diff as gdiff.
>>> Use of "diff -a" hasn't changed since at least 2017.  Is it possible
>>> that there's been a default (or your own) PATH change causing the
>>> POSIX diff to be found in preference?
>>>
>>
>>
>>
> I'm working on a patch to check if diff supports -a, check if gdiff is 
> in the path.  If both of those fail, do we want to run without -a or 
> abort and kindly suggest they install GNU diff?
>
Here's a patch that has configure check for an appropriate diff in the 
path and if it fails to find one runs diff without -a in the test harness


[-- Attachment #2: zsh-diff-a.patch --]
[-- Type: text/plain, Size: 2064 bytes --]

diff --git a/Config/defs.mk.in b/Config/defs.mk.in
index 2bc17482a..c979307f7 100644
--- a/Config/defs.mk.in
+++ b/Config/defs.mk.in
@@ -75,6 +75,7 @@ IMPOPT          = @IMPOPT@
 
 # utilities
 AWK             = @AWK@
+DIFF            = @DIFF@
 ANSI2KNR        = @ANSI2KNR@
 YODL            = @YODL@ @YODL_OPTIONS@
 YODL2TXT        = @YODL@2txt
diff --git a/Test/Makefile.in b/Test/Makefile.in
index 09f37bf53..636746a45 100644
--- a/Test/Makefile.in
+++ b/Test/Makefile.in
@@ -53,6 +53,7 @@ check test:
 	if ZTST_testlist="`for f in $(sdir)/$(TESTNUM)*.ztst; \
            do echo $$f; done`" \
 	 ZTST_srcdir="$(sdir)" \
+	 ZTST_diff_pg="$(DIFF)" \
 	 ZTST_exe=$(dir_top)/Src/zsh@EXEEXT@ \
 	 $(dir_top)/Src/zsh@EXEEXT@ +Z -f $(sdir)/$$ZTST_handler; then \
 	 stat=0; \
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index ea1b016d5..96a138483 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -382,7 +382,7 @@ ZTST_diff() {
       diff_ret=1
     fi
   else
-    diff_out=$(diff -a "$@")
+    diff_out=$(${=ZTST_diff_pg}  "$@")
     diff_ret="$?"
     if [[ "$diff_ret" != "0" ]]; then
       print -r -- "$diff_out"
diff --git a/configure.ac b/configure.ac
index 074141d38..7e9426148 100644
--- a/configure.ac
+++ b/configure.ac
@@ -611,6 +611,19 @@ AC_PROG_AWK                 dnl Check for mawk,gawk,nawk, then awk.
 AC_PROG_LN                  dnl Check for working ln, for "make install"
 AC_PROG_LN_S                dnl Use ln -s/ln/cp for "make install.runhelp"
 AC_PROG_EGREP               dnl sets $EGREP to grep -E or egrep
+
+dnl check for diff that supports -a
+AC_CACHE_CHECK([for diff that supports -a],[ac_cv_path_DIFF],
+    [AC_PATH_PROGS_FEATURE_CHECK([DIFF],[diff gdiff],
+       [[
+	    echo "abcdef" > conftest.$$
+	    echo "abcdef" > conftest2.$$
+	    $ac_path_DIFF -a conftest.$$ conftest2.$$ > /dev/null 2>&1
+	    test "x$?" = x0 \
+            && ac_cv_path_DIFF="$ac_path_DIFF -a" ac_path_DIFF_found=:]],
+	[ac_cv_path_DIFF="diff"])])
+AC_SUBST([DIFF],[$ac_cv_path_DIFF])
+
 AC_CHECK_PROGS([YODL], [yodl], [: yodl])
 
 YODL_OPTIONS=''

      reply	other threads:[~2022-11-09  3:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 16:54 There seems to be a problem with the test harness on Solaris 11.4 Clinton Bunch
2022-11-06 18:12 ` Bart Schaefer
2022-11-06 18:28   ` Clinton Bunch
2022-11-06 18:34     ` Clinton Bunch
2022-11-06 19:09       ` Bart Schaefer
2022-11-06 19:32         ` Clinton Bunch
2022-11-07 19:39           ` Clinton Bunch
2022-11-09  3:29             ` Clinton Bunch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2615cb7-ec32-7eed-a6b7-262d4ea5b15e@zentaur.org \
    --to=cdb_zsh@zentaur.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).