summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-04 14:31:26 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-04 15:24:57 +0100
commit94a8d00a6bf96305543317de0ce4bb42da0327ab (patch)
treea32e0bd1d8826e3d6e0b6787177677fd0d1ffd0d
parentb994805907fead443e31ad69b7388e1355c6a5f1 (diff)
downloadgnutls-94a8d00a6bf96305543317de0ce4bb42da0327ab.tar.gz
tests: openpgp-cert-parser: simplified
-rwxr-xr-xtests/cert-tests/openpgp-cert-parser24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/cert-tests/openpgp-cert-parser b/tests/cert-tests/openpgp-cert-parser
index 800a2038c6..f30f1d6d83 100755
--- a/tests/cert-tests/openpgp-cert-parser
+++ b/tests/cert-tests/openpgp-cert-parser
@@ -20,11 +20,13 @@
# along with GnuTLS; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-set -e
-
srcdir="${srcdir:-.}"
CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
+if ! test -z "${VALGRIND}"; then
+ VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
+fi
+
if ! test -x "${CERTTOOL}"; then
exit 77
fi
@@ -38,16 +40,22 @@ fail() {
echo "Checking OpenPGP certificate parsing"
-("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/truncated.pub" 2>&1 \
- | grep "^import error: Error in parsing" > /dev/null) || \
+${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/truncated.pub" 2>&1
+rc=$?
+if test $rc != 1;then
fail "Parsing should have errored"
+fi
-("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/attribute-leak-1.pub" 2>&1 \
- | grep "^import error:" > /dev/null) || \
+${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/attribute-leak-1.pub" 2>&1
+rc=$?
+if test $rc != 1;then
fail "Parsing should have errored"
+fi
-("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/subpkt-leak.pub" 2>&1 \
- | grep "^import error:" > /dev/null) || \
+${VALGRIND} "${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/data/subpkt-leak.pub" 2>&1
+rc=$?
+if test $rc != 1;then
fail "Parsing should have errored"
+fi
exit ${RETCODE:-0}