4141valgrind=
4242while [ $# -gt 0 ] ; do
4343 case $1 in
44- valgrind) valgrind=" valgrind -q --leak-check=no --smc-check=all-non-file" ;;
44+ valgrind|-valgrind ) valgrind=" valgrind -q --leak-check=no --smc-check=all-non-file --error-exitcode=70 " ;;
4545 * ) echo " RunGrepTest: Unknown argument $1 " ; exit 1;;
4646 esac
4747 shift
@@ -318,8 +318,11 @@ echo "RC=$?" >>testtrygrep
318318
319319echo " ---------------------------- Test 46 ------------------------------" >> testtrygrep
320320(cd $srcdir ; $valgrind $vjs $pcre2grep -e ' unopened)' -e abc ./testdata/grepinput) >> testtrygrep 2>&1
321+ echo " RC=$? " >> testtrygrep
321322(cd $srcdir ; $valgrind $vjs $pcre2grep -eabc -e ' (unclosed' ./testdata/grepinput) >> testtrygrep 2>&1
323+ echo " RC=$? " >> testtrygrep
322324(cd $srcdir ; $valgrind $vjs $pcre2grep -eabc -e xyz -e ' [unclosed' ./testdata/grepinput) >> testtrygrep 2>&1
325+ echo " RC=$? " >> testtrygrep
323326(cd $srcdir ; $valgrind $vjs $pcre2grep --regex=123 -eabc -e xyz -e ' [unclosed' ./testdata/grepinput) >> testtrygrep 2>&1
324327echo " RC=$? " >> testtrygrep
325328
@@ -975,31 +978,48 @@ printf 'abc\rdef\r\nghi\njkl' >testNinputgrep
975978
976979printf ' %c--------------------------- Test N1 ------------------------------\r\n' - > testtrygrep
977980$valgrind $vjs $pcre2grep -n -N CR " ^(abc|def|ghi|jkl)" testNinputgrep >> testtrygrep
981+ echo " RC=$? " >> testtrygrep
978982$valgrind $vjs $pcre2grep -B1 -n -N CR " ^def" testNinputgrep >> testtrygrep
983+ echo " RC=$? " >> testtrygrep
979984
980985printf ' %c--------------------------- Test N2 ------------------------------\r\n' - >> testtrygrep
981986$valgrind $vjs $pcre2grep -n --newline=crlf " ^(abc|def|ghi|jkl)" testNinputgrep >> testtrygrep
987+ echo " RC=$? " >> testtrygrep
982988$valgrind $vjs $pcre2grep -B1 -n -N CRLF " ^ghi" testNinputgrep >> testtrygrep
989+ echo " RC=$? " >> testtrygrep
983990
984991printf ' %c--------------------------- Test N3 ------------------------------\r\n' - >> testtrygrep
985992pattern=` printf ' def\rjkl' `
986993$valgrind $vjs $pcre2grep -n --newline=cr -F " $pattern " testNinputgrep >> testtrygrep
994+ echo " RC=$? " >> testtrygrep
987995
988996printf ' %c--------------------------- Test N4 ------------------------------\r\n' - >> testtrygrep
989997$valgrind $vjs $pcre2grep -n --newline=crlf -F -f $srcdir /testdata/greppatN4 testNinputgrep >> testtrygrep
998+ echo " RC=$? " >> testtrygrep
990999
9911000printf ' %c--------------------------- Test N5 ------------------------------\r\n' - >> testtrygrep
9921001$valgrind $vjs $pcre2grep -n --newline=any " ^(abc|def|ghi|jkl)" testNinputgrep >> testtrygrep
1002+ echo " RC=$? " >> testtrygrep
9931003$valgrind $vjs $pcre2grep -B1 -n --newline=any " ^def" testNinputgrep >> testtrygrep
1004+ echo " RC=$? " >> testtrygrep
9941005
9951006printf ' %c--------------------------- Test N6 ------------------------------\r\n' - >> testtrygrep
9961007$valgrind $vjs $pcre2grep -n --newline=anycrlf " ^(abc|def|ghi|jkl)" testNinputgrep >> testtrygrep
1008+ echo " RC=$? " >> testtrygrep
9971009$valgrind $vjs $pcre2grep -B1 -n --newline=anycrlf " ^jkl" testNinputgrep >> testtrygrep
1010+ echo " RC=$? " >> testtrygrep
9981011
9991012printf ' %c--------------------------- Test N7 ------------------------------\r\n' - >> testtrygrep
10001013printf ' xyz\0abc\0def' > testNinputgrep
10011014$valgrind $vjs $pcre2grep -na --newline=nul " ^(abc|def)" testNinputgrep | $tr ' \000' ' @' >> testtrygrep
1015+ echo " RC=$? " >> testtrygrep
10021016$valgrind $vjs $pcre2grep -B1 -na --newline=nul " ^(abc|def)" testNinputgrep | $tr ' \000' ' @' >> testtrygrep
1017+ echo " RC=$? " >> testtrygrep
1018+
1019+ printf ' %c--------------------------- Test N8 ------------------------------\r\n' - >> testtrygrep
1020+ $valgrind $vjs $pcre2grep -na --newline=anycrlf " ^a" $srcdir /testdata/grepinputBad8_Trail >> testtrygrep
1021+ echo " RC=$? " >> testtrygrep
1022+
10031023echo " " >> testtrygrep
10041024
10051025$cf $srcdir /testdata/grepoutputN testtrygrep
@@ -1013,6 +1033,12 @@ if [ $utf8 -ne 0 ] ; then
10131033
10141034 printf ' %c--------------------------- Test UN1 ------------------------------\r\n' - > testtrygrep
10151035 $valgrind $vjs $pcre2grep -nau --newline=anycrlf " ^(abc|def)" $srcdir /testdata/grepinputUN >> testtrygrep
1036+ echo " RC=$? " >> testtrygrep
1037+
1038+ printf ' %c--------------------------- Test UN2 ------------------------------\r\n' - > testtrygrep
1039+ $valgrind $vjs $pcre2grep -nauU --newline=anycrlf " ^a" $srcdir /testdata/grepinputBad8_Trail >> testtrygrep
1040+ echo " RC=$? " >> testtrygrep
1041+
10161042 echo " " >> testtrygrep
10171043
10181044 $cf $srcdir /testdata/grepoutputUN testtrygrep
@@ -1031,16 +1057,22 @@ if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'callout scri
10311057 echo " Testing pcre2grep script callouts"
10321058 echo " --- Test 1 ---" > testtrygrep
10331059 $valgrind $vjs $pcre2grep ' (T)(..(.))(?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4) ($14) ($0)")()' $srcdir /testdata/grepinputv >> testtrygrep
1060+ echo " RC=$? " >> testtrygrep
10341061 echo " --- Test 2 ---" >> testtrygrep
10351062 $valgrind $vjs $pcre2grep ' (T)(..(.))()()()()()()()(..)(?C"/bin/echo|Arg1: [$11] [${11}]")' $srcdir /testdata/grepinputv >> testtrygrep
1063+ echo " RC=$? " >> testtrygrep
10361064 echo " --- Test 3 ---" >> testtrygrep
10371065 $valgrind $vjs $pcre2grep ' (T)(?C"|$0:$1$n")' $srcdir /testdata/grepinputv >> testtrygrep
1066+ echo " RC=$? " >> testtrygrep
10381067 echo " --- Test 4 ---" >> testtrygrep
10391068 $valgrind $vjs $pcre2grep ' (T)(?C"/bin/echo|$0:$1$n")' $srcdir /testdata/grepinputv >> testtrygrep
1069+ echo " RC=$? " >> testtrygrep
10401070 echo " --- Test 5 ---" >> testtrygrep
10411071 $valgrind $vjs $pcre2grep ' (T)(?C"|$1$n")(*F)' $srcdir /testdata/grepinputv >> testtrygrep
1072+ echo " RC=$? " >> testtrygrep
10421073 echo " --- Test 6 ---" >> testtrygrep
10431074 $valgrind $vjs $pcre2grep -m1 ' (T)(?C"|$0:$1:$x{41}$o{101}$n")' $srcdir /testdata/grepinputv >> testtrygrep
1075+ echo " RC=$? " >> testtrygrep
10441076
10451077 if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q ' Non-fork callout scripts in patterns are supported' ; then
10461078 nonfork=1
@@ -1057,8 +1089,10 @@ if $valgrind $vjs $pcre2grep --help | $valgrind $vjs $pcre2grep -q 'callout scri
10571089 echo " Testing pcre2grep script callout with UTF-8 features"
10581090 echo " --- Test 1 ---" > testtrygrep
10591091 $valgrind $vjs $pcre2grep -u ' (T)(?C"|$0:$x{a6}$n")' $srcdir /testdata/grepinputv >> testtrygrep
1092+ echo " RC=$? " >> testtrygrep
10601093 echo " --- Test 2 ---" >> testtrygrep
10611094 $valgrind $vjs $pcre2grep -u ' (T)(?C"/bin/echo|$0:$x{a6}$n")' $srcdir /testdata/grepinputv >> testtrygrep
1095+ echo " RC=$? " >> testtrygrep
10621096
10631097 if [ $nonfork = 1 ] ; then
10641098 $cf $srcdir /testdata/grepoutputCNU testtrygrep
0 commit comments