summaryrefslogtreecommitdiff
path: root/tests/parser.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parser.sh')
-rwxr-xr-xtests/parser.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/parser.sh b/tests/parser.sh
index b8924e4..333edd2 100755
--- a/tests/parser.sh
+++ b/tests/parser.sh
@@ -1,5 +1,6 @@
#!/bin/sh
+# Copyright (C) 2021-2022 Free Software Foundation, Inc.
# Copyright (C) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
@@ -19,14 +20,31 @@ PARSER="${PARSER:-../src/asn1Parser${EXEEXT}}"
srcdir="${srcdir:-.}"
TMPFILE=pkix.asn.$$.tmp
-${PARSER} ${srcdir}/pkix.asn -o ${TMPFILE}
+if ! test -z "${VALGRIND}"; then
+ VALGRIND="${LIBTOOL:-libtool} --mode=execute valgrind --leak-check=full"
+fi
+
+echo "Test: PKIX file generation"
+
+${VALGRIND} ${PARSER} ${srcdir}/pkix.asn -o ${TMPFILE}
if test $? != 0;then
echo "Cannot generate C file!"
exit 1
fi
-diff --strip-trailing-cr ${TMPFILE} ${srcdir}/pkix.asn.out
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+ cr='\015'
+else
+ cr='\r'
+fi
+# normalize output
+LC_ALL=C tr -d "$cr" < $TMPFILE > x$TMPFILE
+mv x$TMPFILE $TMPFILE
+
+diff ${TMPFILE} ${srcdir}/pkix.asn.out
if test $? != 0;then
echo "Generated C file differs!"