From 1d04bb33723d63635dbe16ed602f0e5b7545cfa6 Mon Sep 17 00:00:00 2001 From: ph10 Date: Thu, 6 Dec 2018 17:05:06 +0000 Subject: [PATCH] Cut out test of NUL characters in RunGrepTest for all OS except Linux, as it doesn't work for *BSD as well as for Solaris and MacOS (which were already cut out). --- ChangeLog | 5 +++++ RunGrepTest | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6411b12..49139e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -88,6 +88,11 @@ via a string callout. 22. If a pattern started with (*MARK), (*COMMIT), (*PRUNE), (*SKIP), or (*THEN) followed by ^ it was not recognized as anchored. +23. The RunGrepTest script used to cut out the test of NUL characters for +Solaris and MacOS as printf and sed can't handle them. It seems that the *BSD +systems can't either. I've inverted the test so that only those OS that are +known to work (currently only Linux) try to run this test. + Version 10.32 10-September-2018 ------------------------------- diff --git a/RunGrepTest b/RunGrepTest index ddf57ac..b950927 100755 --- a/RunGrepTest +++ b/RunGrepTest @@ -714,20 +714,24 @@ $valgrind $vjs $pcre2grep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep > printf '%c--------------------------- Test N6 ------------------------------\r\n' - >>testtrygrep $valgrind $vjs $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep -# It seems impossible to handle NUL characters easily in Solaris (aka SunOS). -# The version of sed explicitly doesn't like them. For the moment, we just -# don't run this test under SunOS. Fudge the output so that the comparison -# works. A similar problem has also been reported for MacOS (Darwin). +# It seems impossible to handle NUL characters easily in many operating +# systems, including Solaris (aka SunOS), where the version of sed explicitly +# doesn't like them, and also MacOS (Darwin), OpenBSD, FreeBSD, and NetBSD. So +# now we run this test only on OS that are known to work. For the rest, we +# fudge the output so that the comparison works. printf '%c--------------------------- Test N7 ------------------------------\r\n' - >>testtrygrep uname=`uname` -if [ "$uname" != "SunOS" -a "$uname" != "Darwin" ] ; then - printf 'abc\0def' >testNinputgrep - $valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | sed 's/\x00/ZERO/' >>testtrygrep - echo "" >>testtrygrep -else - echo '1:abcZERO2:def' >>testtrygrep -fi +case $uname in + Linux) + printf 'abc\0def' >testNinputgrep + $valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | sed 's/\x00/ZERO/' >>testtrygrep + echo "" >>testtrygrep + ;; + *) + echo '1:abcZERO2:def' >>testtrygrep + ;; +esac $cf $srcdir/testdata/grepoutputN testtrygrep if [ $? != 0 ] ; then exit 1; fi