Skip to content

Commit

Permalink
First round attempting some test overrides for EBCDIC
Browse files Browse the repository at this point in the history
  • Loading branch information
NWilson committed Jan 14, 2025
1 parent fdeb41f commit f9ca812
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
38 changes: 36 additions & 2 deletions RunTest
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ checkresult()
-dfa) with=" with DFA";;
*) with="";;
esac
$cf $testdata/testoutput$2 testtry
cf_out="$testdata/testoutput$2"
if [ $ebcdic -eq 1 ] ; then
sed '/^# ifndef EBCDIC/,/^# endif/d' "$cf_out" >testtry2
cf_out=testtry2
fi
$cf "$cf_out" testtry
if [ $? != 0 ] ; then
echo ""
echo "** Test $2 failed$with"
Expand Down Expand Up @@ -358,6 +363,35 @@ $sim $pcre2test -C ebcdic >/dev/null
ebcdic=$?
$sim $pcre2test -C ebcdic-io >/dev/null
ebcdic_io=$?
if [ $ebcdic -eq 1 ]; then
filterebcdic()
{
filter_cmd="$1"
filter_args=
shift
while [ $# -gt 0 ] ; do
case "$1" in
-C|-error|-pattern|-S|-subject|-t|-tm|-T|-TM)
if [ $# -gt 1 ] ; then
filter_args="$filter_args $1 $2"; shift; shift
else
filter_args="$filter_args $1"; shift
fi
;;
-*) filter_args="$filter_args $1"; shift;;
*) break;;
esac
done
if [ $# -gt 0 ] ; then
input="$1"
shift
sed '/^# ifndef EBCDIC/,/^# endif/d' "$input" | "$filter_cmd" $filter_args "/dev/stdin" "$@"
else
"$filter_cmd" $filter_args "$@"
fi
}
sim="filterebcdic $sim"
fi

# Check for EBCDIC newline
ebcdic_nl=`$sim $pcre2test -C ebcdic-nl`
Expand Down Expand Up @@ -986,6 +1020,6 @@ done


# Clean up local working files
rm -f testbtables testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry
rm -f testbtables testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry testtry2

# End
2 changes: 2 additions & 0 deletions testdata/testinput1
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
What do you know about the quick brown fox?
What do you know about THE QUICK BROWN FOX?

# ifndef EBCDIC
/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
abcd\t\n\r\f\a\e9;\$\\?caxyz
# endif

/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
abxyzpqrrrabbxyyyypqAzz
Expand Down
2 changes: 2 additions & 0 deletions testdata/testoutput1
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ No match
What do you know about THE QUICK BROWN FOX?
0: THE QUICK BROWN FOX

# ifndef EBCDIC
/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
abcd\t\n\r\f\a\e9;\$\\?caxyz
0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
# endif

/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
abxyzpqrrrabbxyyyypqAzz
Expand Down

0 comments on commit f9ca812

Please sign in to comment.