summaryrefslogtreecommitdiff
path: root/tests/parser.sh
diff options
context:
space:
mode:
authorDariusz Michaluk <d.michaluk@samsung.com>2024-02-13 15:44:51 +0100
committerDariusz Michaluk <d.michaluk@samsung.com>2024-02-14 10:46:44 +0100
commitc28e9eeaa4dccef63b3b237ebe8a8b5abb23e335 (patch)
tree504a1953b56446487f4759d3a5f348bbeb925461 /tests/parser.sh
parent1778d37a3eec1209d7c9c064318f3ff8c5132490 (diff)
parent031996ef501f8c3d0532f7df1c38cf2e540a4f11 (diff)
downloadlibtasn1-c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335.tar.gz
libtasn1-c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335.tar.bz2
libtasn1-c28e9eeaa4dccef63b3b237ebe8a8b5abb23e335.zip
Change-Id: I893fd2c90c487d6e13b0b10e25b2cafc408da180
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!"