diff options
author | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-11-16 16:06:18 +0100 |
---|---|---|
committer | Tim Rühsen <tim.ruehsen@gmx.de> | 2018-12-18 10:39:06 +0100 |
commit | ad51d200438a0c600a75fe8acfa27d29bb45bdac (patch) | |
tree | 0e6211420705c3271c5f257a9abf15c92fd260eb | |
parent | 2cffd2d20b6e1065cc44c71703698e2f2d5026d6 (diff) | |
download | gnutls-ad51d200438a0c600a75fe8acfa27d29bb45bdac.tar.gz |
tests/cert-tests/pem-decoding: Increase portability (fix for busybox)
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rwxr-xr-x | tests/cert-tests/pem-decoding | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/tests/cert-tests/pem-decoding b/tests/cert-tests/pem-decoding index 1daf926317..267a1fc7f3 100755 --- a/tests/cert-tests/pem-decoding +++ b/tests/cert-tests/pem-decoding @@ -24,7 +24,6 @@ srcdir="${srcdir:-.}" CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}" -DIFF="${DIFF:-diff -b -B}" if ! test -x "${CERTTOOL}"; then exit 77 @@ -34,6 +33,8 @@ if ! test -z "${VALGRIND}"; then VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}" fi +. "${srcdir}/../scripts/common.sh" + TMPFILE=tmp-$$.pem.tmp TMPFILE1=tmp1-$$.pem.tmp TMPFILE2=tmp2-$$.pem.tmp @@ -57,8 +58,7 @@ if test "${rc}" != "0"; then exit ${rc} fi -#FIXME: the output string differs in windows and linux on the last char. -${DIFF} -I 'Algorithm Security Level' "${srcdir}/data/bmpstring.pem" ${TMPFILE} || ${DIFF} -I 'Algorithm Security Level' --strip-trailing-cr "${srcdir}/data/bmpstring.pem" ${TMPFILE} +check_if_equal "${srcdir}/data/bmpstring.pem" ${TMPFILE} "Algorithm Security Level" rc=$? if test "${rc}" != "0"; then @@ -75,9 +75,7 @@ if test "${rc}" != "0"; then exit ${rc} fi -cat "${srcdir}/data/complex-cert.pem" |grep -v "Not After:" >${TMPFILE1} -cat ${TMPFILE} |grep -v "Not After:" >${TMPFILE2} -${DIFF} -I 'Algorithm Security Level' ${TMPFILE1} ${TMPFILE2} || ${DIFF} -I 'Algorithm Security Level' --strip-trailing-cr ${TMPFILE1} ${TMPFILE2} +check_if_equal "${srcdir}/data/complex-cert.pem" ${TMPFILE} "Not After:|Algorithm Security Level" rc=$? if test "${rc}" != "0"; then @@ -94,9 +92,7 @@ if test "${rc}" != "0"; then exit ${rc} fi -cat "${srcdir}/data/xmpp-othername.pem" |grep -v "Not After:" >${TMPFILE1} -cat ${TMPFILE} |grep -v "Not After:" >${TMPFILE2} -${DIFF} -I ^warning -I 'Algorithm Security Level' ${TMPFILE1} ${TMPFILE2} || ${DIFF} -I 'Algorithm Security Level' --strip-trailing-cr ${TMPFILE1} ${TMPFILE2} +check_if_equal "${srcdir}/data/xmpp-othername.pem" ${TMPFILE} "^warning|Not After:|Algorithm Security Level" rc=$? if test "${rc}" != "0"; then @@ -112,9 +108,9 @@ if test "${rc}" != "0"; then exit ${rc} fi -cat ${TMPFILE} |grep "KRB5Principal:" >${TMPFILE1} -cat "${srcdir}/data/template-krb5name-full.pem" |grep "KRB5Principal:" >${TMPFILE2} -${DIFF} -I 'Algorithm Security Level' -u ${TMPFILE1} ${TMPFILE2} || ${DIFF} -I 'Algorithm Security Level' -u --strip-trailing-cr ${TMPFILE1} ${TMPFILE2} +grep "KRB5Principal:" ${TMPFILE} >${TMPFILE1} +grep "KRB5Principal:" "${srcdir}/data/template-krb5name-full.pem" >${TMPFILE2} +check_if_equal ${TMPFILE1} ${TMPFILE2} rc=$? if test "${rc}" != "0"; then @@ -138,7 +134,7 @@ if test "${rc}" != "0"; then exit ${rc} fi -${DIFF} -u ${TMPFILE} "${GOSTCERT}" || ${DIFF} -u --strip-trailing-cr "${TMPFILE}" "${GOSTCERT}" +check_if_equal ${TMPFILE} "${GOSTCERT}" rc=$? if test "${rc}" != "0"; then @@ -155,7 +151,7 @@ if test "${rc}" != "0"; then exit ${rc} fi -${DIFF} -I 'Algorithm Security Level' ${TMPFILE} "${srcdir}/data/gost94-cert.pem" || ${DIFF} -I 'Algorithm Security Level' --strip-trailing-cr "${TMPFILE}" "${srcdir}/data/gost94-cert.pem" +check_if_equal ${TMPFILE} "${srcdir}/data/gost94-cert.pem" "Algorithm Security Level" rc=$? if test "${rc}" != "0"; then @@ -171,7 +167,8 @@ if test "${rc}" != "0"; then exit ${rc} fi -${DIFF} -I 'Algorithm Security Level' ${TMPFILE} "${srcdir}/data/multi-value-dn.pem" || ${DIFF} -I 'Algorithm Security Level' --strip-trailing-cr "${TMPFILE}" "${srcdir}/data/multi-value-dn.pem" +# Needed for FIPS140 mode +check_if_equal "${srcdir}/data/multi-value-dn.pem" ${TMPFILE} "Algorithm Security Level:" rc=$? if test "${rc}" != "0"; then |