[gnutls-devel] [PATCH 1/4] tests: misc: cleanup shell usage

Alon Bar-Lev alon.barlev at gmail.com
Sun Jun 21 02:00:02 CEST 2015


Add quotes for most usages of variables.

Added ${} for variables.

Cleanup indentation to be consistent with other tests.

Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 tests/pkcs1-padding/pkcs1-pad             |  50 +++++++--------
 tests/pkcs12-decode/pkcs12                | 102 +++++++++++++++---------------
 tests/pkcs8-decode/pkcs8                  |  70 ++++++++++----------
 tests/rfc2253-escape-test                 |  15 ++---
 tests/rsa-md5-collision/rsa-md5-collision |  26 ++++----
 tests/sha2/sha2                           |  70 ++++++++++----------
 tests/sha2/sha2-dsa                       |  52 +++++++--------
 tests/slow/override-ciphers               |  34 +++++-----
 tests/slow/test-ciphers                   |  36 +++++------
 tests/userid/userid                       |  14 ++--
 10 files changed, 232 insertions(+), 237 deletions(-)

diff --git a/tests/pkcs1-padding/pkcs1-pad b/tests/pkcs1-padding/pkcs1-pad
index 3101c7e..65b31fd 100755
--- a/tests/pkcs1-padding/pkcs1-pad
+++ b/tests/pkcs1-padding/pkcs1-pad
@@ -23,33 +23,33 @@
 
 set -e
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
 
 # Check for datefudge
 TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158962400"; then
-    echo "You need datefudge to run this test"
-    exit 77
+if test "${TSTAMP}" != "1158962400"; then
+  echo "You need datefudge to run this test"
+  exit 77
 fi
 
 # Test 1, PKCS#1 pad digestAlgorithm.parameters
 
 EXPECT1=2002
 
-datefudge "2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok.pem | tee out1 >/dev/null 2>&1
-datefudge "2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken.pem | tee out2 >/dev/null 2>&1
+datefudge "2006-09-23" "${CERTTOOL}" --verify-chain --infile "${srcdir}/pkcs1-pad-ok.pem" | tee out1 >/dev/null 2>&1
+datefudge "2006-09-23" "${CERTTOOL}" --verify-chain --infile "${srcdir}/pkcs1-pad-broken.pem" | tee out2 >/dev/null 2>&1
 
 out1oks=`grep 'Verified.' out1 | wc -l | tr -d " "`
 out2oks=`grep 'Verified.' out2 | wc -l | tr -d " "`
 out1fails=`grep 'Not verified.' out1 | wc -l | tr -d " "`
 out2fails=`grep 'Not verified.' out2 | wc -l | tr -d " "`
 
-if test "$out1oks$out2oks$out1fails$out2fails" != "$EXPECT1"; then
-    echo out1 oks $out1oks fails $out1fails out2 oks $out2oks fails $out2fails
-    echo expected $EXPECT1
-    echo "PKCS1-PAD1 FAIL"
-    exit 1
+if test "${out1oks}${out2oks}${out1fails}${out2fails}" != "${EXPECT1}"; then
+  echo "out1 oks ${out1oks} fails ${out1fails} out2 oks ${out2oks} fails ${out2fails}"
+  echo "expected ${EXPECT1}"
+  echo "PKCS1-PAD1 FAIL"
+  exit 1
 fi
 
 rm -f out1 out2
@@ -60,19 +60,19 @@ echo "PKCS1-PAD1 OK"
 
 EXPECT2=2002
 
-datefudge "2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-ok2.pem | tee out1 >/dev/null 2>&1
-datefudge "2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken2.pem | tee out2 >/dev/null 2>&1
+datefudge "2006-09-23" "${CERTTOOL}" --verify-chain --infile "${srcdir}/pkcs1-pad-ok2.pem" | tee out1 >/dev/null 2>&1
+datefudge "2006-09-23" "${CERTTOOL}" --verify-chain --infile "${srcdir}/pkcs1-pad-broken2.pem" | tee out2 >/dev/null 2>&1
 
 out1oks=`grep 'Verified.' out1 | wc -l | tr -d " "`
 out2oks=`grep 'Verified.' out2 | wc -l | tr -d " "`
 out1fails=`grep 'Not verified.' out1 | wc -l | tr -d " "`
 out2fails=`grep 'Not verified.' out2 | wc -l | tr -d " "`
 
-if test "$out1oks$out2oks$out1fails$out2fails" != "$EXPECT2"; then
-    echo out1 oks $out1oks fails $out1fails out2 oks $out2oks fails $out2fails
-    echo expected $EXPECT2
-    echo "PKCS1-PAD2 FAIL"
-    exit 1
+if test "${out1oks}${out2oks}${out1fails}${out2fails}" != "${EXPECT2}"; then
+  echo "out1 oks ${out1oks} fails ${out1fails} out2 oks ${out2oks} fails ${out2fails}"
+  echo "expected ${EXPECT2}"
+  echo "PKCS1-PAD2 FAIL"
+  exit 1
 fi
 
 rm -f out1 out2
@@ -85,16 +85,16 @@ echo "PKCS1-PAD2 OK"
 
 EXPECT3=02
 
-datefudge "2006-09-23" $CERTTOOL --verify-chain --infile $srcdir/pkcs1-pad-broken3.pem | tee out1 >/dev/null 2>&1
+datefudge "2006-09-23" "${CERTTOOL}" --verify-chain --infile "${srcdir}/pkcs1-pad-broken3.pem" | tee out1 >/dev/null 2>&1
 
 out1oks=`grep 'Verified.' out1 | wc -l | tr -d " "`
 out1fails=`grep 'Not verified.' out1 | wc -l | tr -d " "`
 
-if test "$out1oks$out1fails" != "$EXPECT3"; then
-    echo out1 oks $out1oks fails $out1fails
-    echo expected $EXPECT3
-    echo "PKCS1-PAD3 FAIL"
-    exit 1
+if test "${out1oks}${out1fails}" != "${EXPECT3}"; then
+  echo "out1 oks ${out1oks} fails ${out1fails}"
+  echo "expected ${EXPECT3}"
+  echo "PKCS1-PAD3 FAIL"
+  exit 1
 fi
 
 rm -f out1
diff --git a/tests/pkcs12-decode/pkcs12 b/tests/pkcs12-decode/pkcs12
index 0aa7746..0408ad1 100755
--- a/tests/pkcs12-decode/pkcs12
+++ b/tests/pkcs12-decode/pkcs12
@@ -21,10 +21,10 @@
 # along with GnuTLS; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-srcdir=${srcdir:-.}
-top_builddir=${top_builddir:-../..}
-CERTTOOL=${CERTTOOL:-${top_builddir}/src/certtool$EXEEXT}
-DIFF=${DIFF:-diff}
+srcdir="${srcdir:-.}"
+top_builddir="${top_builddir:-../..}"
+CERTTOOL="${CERTTOOL:-${top_builddir}/src/certtool${EXEEXT}}"
+DIFF="${DIFF:-diff}"
 DEBUG=""
 
 if test "x$1" != "x";then
@@ -33,88 +33,88 @@ fi
 
 ret=0
 for p12 in 'client.p12 foobar' noclient.p12 unclient.p12 pkcs12_2certs.p12; do
-    set -- $p12
-    file=$1
-    passwd=$2
-    if test "x$DEBUG" != "x";then
-      $CERTTOOL -d 99 --p12-info --inder --password "$passwd" \
-		--infile $srcdir/$file
-    else
-      $CERTTOOL --p12-info --inder --password "$passwd" \
-		--infile $srcdir/$file >/dev/null 2>&1
-    fi
-    rc=$?
-    if test $rc != 0; then
-	echo "NEON PKCS12 FATAL $p12"
-	ret=1
-    fi
+  set -- ${p12}
+  file="$1"
+  passwd="$2"
+  if test "x$DEBUG" != "x";then
+    "${CERTTOOL}" -d 99 --p12-info --inder --password "${passwd}" \
+      --infile "${srcdir}/${file}"
+  else
+    "${CERTTOOL}" --p12-info --inder --password "${passwd}" \
+      --infile "${srcdir}/${file}" >/dev/null 2>&1
+  fi
+  rc=$?
+  if test ${rc} != 0; then
+    echo "NEON PKCS12 FATAL ${p12}"
+    ret=1
+  fi
 done
 
 file=test-null.p12
-$CERTTOOL --p12-info --inder --null-password --infile $srcdir/$file >/dev/null 2>&1
+"${CERTTOOL}" --p12-info --inder --null-password --infile "${srcdir}/${file}" >/dev/null 2>&1
 rc=$?
-if test $rc != 0; then
-	echo "PKCS12 FATAL $file"
-	ret=1
+if test ${rc} != 0; then
+  echo "PKCS12 FATAL ${file}"
+  ret=1
 fi
 
 file=sha256.p12
-$CERTTOOL --p12-info --inder --password 1234 --infile $srcdir/$file >/dev/null 2>&1
+"${CERTTOOL}" --p12-info --inder --password 1234 --infile "${srcdir}/${file}" >/dev/null 2>&1
 rc=$?
-if test $rc != 0; then
-	echo "PKCS12 FATAL $file"
-	ret=1
+if test ${rc} != 0; then
+  echo "PKCS12 FATAL ${file}"
+  ret=1
 fi
 
 # test whether we can encode a certificate and a key
-$CERTTOOL --to-p12 --password 1234 --p12-name "my-key" --load-certificate $srcdir/../certs/cert-ecc256.pem --load-privkey $srcdir/../certs/ecc256.pem --outder --outfile out.p12 >/dev/null 2>&1
+"${CERTTOOL}" --to-p12 --password 1234 --p12-name "my-key" --load-certificate "${srcdir}/../certs/cert-ecc256.pem" --load-privkey "${srcdir}/../certs/ecc256.pem" --outder --outfile out.p12 >/dev/null 2>&1
 rc=$?
-if test $rc != 0; then
-	echo "PKCS12 FATAL encoding"
-	ret=1
+if test ${rc} != 0; then
+  echo "PKCS12 FATAL encoding"
+  ret=1
 fi
 
-$CERTTOOL --p12-info --inder --password 1234 --infile out.p12 >out.pem 2>/dev/null
+"${CERTTOOL}" --p12-info --inder --password 1234 --infile out.p12 >out.pem 2>/dev/null
 rc=$?
-if test $rc != 0; then
-	echo "PKCS12 FATAL decrypting/decoding"
-	ret=1
+if test ${rc} != 0; then
+  echo "PKCS12 FATAL decrypting/decoding"
+  ret=1
 fi
 
 grep "BEGIN ENCRYPTED PRIVATE KEY" out.pem >/dev/null 2>&1
 rc=$?
 
-if test "$rc" != "0"; then
-  exit $rc
+if test "${rc}" != "0"; then
+  exit ${rc}
 fi
 
 grep "BEGIN CERTIFICATE" out.pem >/dev/null 2>&1
 rc=$?
 
-if test "$rc" != "0"; then
-  exit $rc
+if test "${rc}" != "0"; then
+  exit ${rc}
 fi
 
 # test whether we can encode a certificate, a key and a CA
-$CERTTOOL --to-p12 --password 123456 --p12-name "my-key" --load-certificate $srcdir/../certs/cert-ecc256.pem --load-privkey $srcdir/../certs/ecc256.pem --load-ca-certificate $srcdir/../certs/ca-cert-ecc.pem --outder --outfile out.p12 >/dev/null 2>&1
+"${CERTTOOL}" --to-p12 --password 123456 --p12-name "my-key" --load-certificate "${srcdir}/../certs/cert-ecc256.pem" --load-privkey "${srcdir}/../certs/ecc256.pem" --load-ca-certificate "${srcdir}/../certs/ca-cert-ecc.pem" --outder --outfile out.p12 >/dev/null 2>&1
 rc=$?
-if test $rc != 0; then
-	echo "PKCS12 FATAL encoding 2"
-	exit 1
+if test ${rc} != 0; then
+  echo "PKCS12 FATAL encoding 2"
+  exit 1
 fi
 
-$CERTTOOL --p12-info --inder --password 123456 --infile out.p12 >out.pem 2>/dev/null
+"${CERTTOOL}" --p12-info --inder --password 123456 --infile out.p12 >out.pem 2>/dev/null
 rc=$?
-if test $rc != 0; then
-	echo "PKCS12 FATAL decrypting/decoding 2"
-	exit 1
+if test ${rc} != 0; then
+  echo "PKCS12 FATAL decrypting/decoding 2"
+  exit 1
 fi
 
 grep "BEGIN ENCRYPTED PRIVATE KEY" out.pem >/dev/null 2>&1
 rc=$?
 
-if test "$rc" != "0"; then
-  exit $rc
+if test "${rc}" != "0"; then
+  exit ${rc}
 fi
 
 count=`grep -c "BEGIN CERTIFICATE" out.pem`
@@ -126,5 +126,5 @@ fi
 
 rm -f out.pem out.p12
 
-#echo "NEON PKCS12 DONE (rc $ret)"
-exit $ret
+#echo "NEON PKCS12 DONE (rc ${ret})"
+exit ${ret}
diff --git a/tests/pkcs8-decode/pkcs8 b/tests/pkcs8-decode/pkcs8
index 041a59b..756d0ac 100755
--- a/tests/pkcs8-decode/pkcs8
+++ b/tests/pkcs8-decode/pkcs8
@@ -20,52 +20,52 @@
 # along with GnuTLS; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
-DIFF=${DIFF:-diff}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
+DIFF="${DIFF:-diff}"
 
 if ! test -z "${VALGRIND}";then
-VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
+  VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
 fi
 
 ret=0
 for p8 in 'encpkcs8.pem foobar' unencpkcs8.pem 'enc2pkcs8.pem baz'; do
-    set -- $p8
-    file=$1
-    passwd=$2
-    $VALGRIND $CERTTOOL --key-info --pkcs8 --password "$passwd" \
-		--infile $srcdir/$file | tee out >/dev/null
-    rc=$?
-    if test $rc != 0; then
-	cat out
-	echo "PKCS8 FATAL $p8"
-	ret=1
-    else
-	echo "PKCS8 OK $p8"
-    fi
+  set -- ${p8}
+  file="$1"
+  passwd="$2"
+  ${VALGRIND} "${CERTTOOL}" --key-info --pkcs8 --password "${passwd}" \
+    --infile "${srcdir}/${file}" | tee out >/dev/null
+  rc=$?
+  if test ${rc} != 0; then
+    cat out
+    echo "PKCS8 FATAL ${p8}"
+    ret=1
+  else
+    echo "PKCS8 OK ${p8}"
+  fi
 done
 rm -f out
 
 for p8 in openssl-aes128.p8 openssl-aes256.p8 openssl-3des.p8; do
-    set -- $p8
-    file=$1
-    passwd=$2
-    $VALGRIND $CERTTOOL --p8-info --password "1234" \
-		--infile $srcdir/$file | tee out >/dev/null
-    rc=$?
-    if test $rc != 0; then
-	cat out
-	echo "PKCS8 FATAL $p8"
-	ret=1
-    fi
+  set -- ${p8}
+  file="$1"
+  passwd="$2"
+  ${VALGRIND} "${CERTTOOL}" --p8-info --password "1234" \
+    --infile "${srcdir}/${file}" | tee out >/dev/null
+  rc=$?
+  if test ${rc} != 0; then
+    cat out
+    echo "PKCS8 FATAL ${p8}"
+    ret=1
+  fi
 
-    $DIFF $srcdir/$p8.txt out
-    rc=$?
-    if test $rc != 0; then
-	cat out
-	echo "PKCS8 FATAL TXT $p8"
-	ret=1
-    fi
+  ${DIFF} "${srcdir}/${p8}.txt" out
+  rc=$?
+  if test ${rc} != 0; then
+    cat out
+    echo "PKCS8 FATAL TXT ${p8}"
+    ret=1
+  fi
 done
 rm -f out
 
diff --git a/tests/rfc2253-escape-test b/tests/rfc2253-escape-test
index 8f620dc..7506139 100755
--- a/tests/rfc2253-escape-test
+++ b/tests/rfc2253-escape-test
@@ -22,15 +22,14 @@
 
 set -e
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../src/certtool$EXEEXT}
+CERTTOOL="${CERTTOOL:-../src/certtool${EXEEXT}}"
 if ! test -z "${VALGRIND}";then
-VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=1"
+  VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=1"
 fi
 
 if cat<<EOF \
-    | $VALGRIND $CERTTOOL --certificate-info \
-    | grep 'Issuer: O=RFC 2253 escape test,OU=Plus \\+ Comma \\,' > /dev/null
+  | ${VALGRIND} "${CERTTOOL}" --certificate-info \
+  | grep 'Issuer: O=RFC 2253 escape test,OU=Plus \\+ Comma \\,' > /dev/null
 -----BEGIN CERTIFICATE-----
 MIICETCCAXygAwIBAgIESnlIMTALBgkqhkiG9w0BAQUwODEdMBsGA1UEChMUUkZD
 IDIyNTMgZXNjYXBlIHRlc3QxFzAVBgNVBAsTDlBsdXMgKyBDb21tYSAsMB4XDTA5
@@ -47,10 +46,10 @@ iptEYYo=
 -----END CERTIFICATE-----
 EOF
 then
-    :
+  :
 else
-    echo "RFC 2253 escaping not working?"
-    exit 1
+  echo "RFC 2253 escaping not working?"
+  exit 1
 fi
 
 exit 0
diff --git a/tests/rsa-md5-collision/rsa-md5-collision b/tests/rsa-md5-collision/rsa-md5-collision
index 7f3361d..888bbed 100755
--- a/tests/rsa-md5-collision/rsa-md5-collision
+++ b/tests/rsa-md5-collision/rsa-md5-collision
@@ -22,26 +22,26 @@
 
 set -e
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
 
-$CERTTOOL --inder --certificate-info \
-    --infile $srcdir/MD5CollisionCA.cer > ca.pem
-$CERTTOOL --inder --certificate-info \
-    --infile $srcdir/TargetCollidingCertificate1.cer > client1.pem
-$CERTTOOL --inder --certificate-info \
-	  --infile $srcdir/TargetCollidingCertificate2.cer > client2.pem
+"${CERTTOOL}" --inder --certificate-info \
+  --infile "${srcdir}/MD5CollisionCA.cer" > ca.pem
+"${CERTTOOL}" --inder --certificate-info \
+  --infile "${srcdir}/TargetCollidingCertificate1.cer" > client1.pem
+"${CERTTOOL}" --inder --certificate-info \
+  --infile "${srcdir}/TargetCollidingCertificate2.cer" > client2.pem
 
 cat client1.pem ca.pem > chain1.pem
 cat client2.pem ca.pem > chain2.pem
 
-$CERTTOOL --verify-chain < chain1.pem | \
-    grep 'Not verified.' | grep 'insecure algorithm' >/dev/null
-$CERTTOOL --verify-chain < chain2.pem | \
-    grep 'Not verified.' | grep 'insecure algorithm' >/dev/null
+"${CERTTOOL}" --verify-chain < chain1.pem | \
+  grep 'Not verified.' | grep 'insecure algorithm' >/dev/null
+"${CERTTOOL}" --verify-chain < chain2.pem | \
+  grep 'Not verified.' | grep 'insecure algorithm' >/dev/null
 
 rm -f ca.pem client1.pem client2.pem \
-   chain1.pem chain2.pem \
+  chain1.pem chain2.pem \
 
 # We're done.
 exit 0
diff --git a/tests/sha2/sha2 b/tests/sha2/sha2
index c8e3b71..02b1778 100755
--- a/tests/sha2/sha2
+++ b/tests/sha2/sha2
@@ -22,71 +22,71 @@
 
 #set -e
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
 
 echo ca > template-sha2
 echo cn = "SHA 512 CA" >> template-sha2
 
-$CERTTOOL -d 2 --generate-self-signed --template template-sha2 \
-    --load-privkey $srcdir/key-ca.pem \
-    --outfile new-ca.pem \
-    --hash sha512 >out 2>&1
+"${CERTTOOL}" -d 2 --generate-self-signed --template template-sha2 \
+  --load-privkey "${srcdir}/key-ca.pem" \
+  --outfile new-ca.pem \
+  --hash sha512 >out 2>&1
 
 if [ $? != 0 ];then
-	cat out
-	exit 1
+  cat out
+  exit 1
 fi
 
 echo ca > template-sha2
 echo cn = "SHA 384 sub-CA" >> template-sha2
 
-$CERTTOOL -d 2 --generate-certificate --template template-sha2 \
-    --load-ca-privkey $srcdir/key-ca.pem \
-    --load-ca-certificate new-ca.pem \
-    --load-privkey $srcdir/key-subca.pem \
-    --outfile new-subca.pem \
-    --hash sha384 >out 2>&1
+"${CERTTOOL}" -d 2 --generate-certificate --template template-sha2 \
+  --load-ca-privkey "${srcdir}/key-ca.pem" \
+  --load-ca-certificate new-ca.pem \
+  --load-privkey "${srcdir}/key-subca.pem" \
+  --outfile new-subca.pem \
+  --hash sha384 >out 2>&1
 
 if [ $? != 0 ];then
-	cat out
-	exit 1
+  cat out
+  exit 1
 fi
 
 echo ca > template-sha2
 echo cn = "SHA 256 sub-sub-CA" >> template-sha2
 
-$CERTTOOL -d 2 --generate-certificate --template template-sha2 \
-    --load-ca-privkey $srcdir/key-subca.pem \
-    --load-ca-certificate new-subca.pem \
-    --load-privkey $srcdir/key-subsubca.pem \
-    --outfile new-subsubca.pem \
-    --hash sha256 >out 2>&1
+"${CERTTOOL}" -d 2 --generate-certificate --template template-sha2 \
+  --load-ca-privkey "${srcdir}/key-subca.pem" \
+  --load-ca-certificate new-subca.pem \
+  --load-privkey "${srcdir}/key-subsubca.pem" \
+  --outfile new-subsubca.pem \
+  --hash sha256 >out 2>&1
 
 if [ $? != 0 ];then
-	cat out
-	exit 1
+  cat out
+  exit 1
 fi
 
 echo cn = "End-user" > template-sha2
 
-$CERTTOOL -d 2 --generate-certificate --template template-sha2 \
-    --load-ca-privkey $srcdir/key-subsubca.pem \
-    --load-ca-certificate new-subsubca.pem \
-    --load-privkey $srcdir/key-user.pem \
-    --outfile new-user.pem >out 2>&1
+"${CERTTOOL}" -d 2 --generate-certificate --template template-sha2 \
+  --load-ca-privkey "${srcdir}/key-subsubca.pem" \
+  --load-ca-certificate new-subsubca.pem \
+  --load-privkey "${srcdir}/key-user.pem" \
+  --outfile new-user.pem >out 2>&1
 
 if [ $? != 0 ];then
-	cat out
-	exit 1
+  cat out
+  exit 1
 fi
 
-num=`cat new-user.pem new-subsubca.pem new-subca.pem new-ca.pem | $CERTTOOL --verify-chain | tee verify-sha2 | grep -c Verified`
+num=`cat new-user.pem new-subsubca.pem new-subca.pem new-ca.pem | "${CERTTOOL}" --verify-chain | tee verify-sha2 | grep -c Verified`
 #cat verify
 
-if test "$num" != "4"; then
-    echo Verification failure
-    exit 1
+if test "${num}" != "4"; then
+  echo Verification failure
+  exit 1
 fi
 
 rm -f verify-sha2 new-user.pem new-subsubca.pem new-subca.pem new-ca.pem template-sha2 out
diff --git a/tests/sha2/sha2-dsa b/tests/sha2/sha2-dsa
index 68b8432..623c621 100755
--- a/tests/sha2/sha2-dsa
+++ b/tests/sha2/sha2-dsa
@@ -22,56 +22,56 @@
 
 #set -e
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
 
 echo ca > template-dsa
 echo cn = "SHA 256 CA" >> template-dsa
 
-$CERTTOOL -d 2 --generate-self-signed --template template-dsa \
-    --load-privkey $srcdir/key-ca-dsa.pem \
-    --outfile new-ca-dsa.pem \
-    --hash sha256 >out-dsa 2>&1
+"${CERTTOOL}" -d 2 --generate-self-signed --template template-dsa \
+  --load-privkey "${srcdir}/key-ca-dsa.pem" \
+  --outfile new-ca-dsa.pem \
+  --hash sha256 >out-dsa 2>&1
 
 if [ $? != 0 ];then
-	cat out-dsa
-	exit 1
+  cat out-dsa
+  exit 1
 fi
 
 echo ca > template-dsa
 echo cn = "SHA 224 Mid CA" >> template-dsa
 
-$CERTTOOL -d 2 --generate-certificate --template template-dsa \
-    --load-ca-privkey $srcdir/key-ca-dsa.pem \
-    --load-ca-certificate new-ca-dsa.pem \
-    --load-privkey $srcdir/key-subca-dsa.pem \
-    --outfile new-subca-dsa.pem \
-    --hash sha224 >out-dsa 2>&1
+"${CERTTOOL}" -d 2 --generate-certificate --template template-dsa \
+  --load-ca-privkey "${srcdir}/key-ca-dsa.pem" \
+  --load-ca-certificate new-ca-dsa.pem \
+  --load-privkey "${srcdir}/key-subca-dsa.pem" \
+  --outfile new-subca-dsa.pem \
+  --hash sha224 >out-dsa 2>&1
 
 if [ $? != 0 ];then
-	cat out-dsa
-	exit 1
+  cat out-dsa
+  exit 1
 fi
 
 echo cn = "End-user" > template-dsa
 
-$CERTTOOL -d 2 --generate-certificate --template template-dsa \
-    --load-ca-privkey $srcdir/key-subca-dsa.pem \
-    --load-ca-certificate new-subca-dsa.pem \
-    --load-privkey $srcdir/key-dsa.pem \
-    --outfile new-user-dsa.pem >out-dsa 2>&1
+"${CERTTOOL}" -d 2 --generate-certificate --template template-dsa \
+  --load-ca-privkey "${srcdir}/key-subca-dsa.pem" \
+  --load-ca-certificate new-subca-dsa.pem \
+  --load-privkey "${srcdir}/key-dsa.pem" \
+  --outfile new-user-dsa.pem >out-dsa 2>&1
 
 if [ $? != 0 ];then
-	cat out-dsa
-	exit 1
+  cat out-dsa
+  exit 1
 fi
 
 cat new-user-dsa.pem new-subca-dsa.pem new-ca-dsa.pem > out-dsa
-$CERTTOOL --verify-chain <out-dsa > verify-dsa
+"${CERTTOOL}" --verify-chain <out-dsa > verify-dsa
 
 if [ $? != 0 ];then
-	cat verify-dsa
-	exit 1
+  cat verify-dsa
+  exit 1
 fi
 
 rm -f verify-dsa new-user-dsa.pem new-ca-dsa.pem new-subca-dsa.pem template-dsa out-dsa
diff --git a/tests/slow/override-ciphers b/tests/slow/override-ciphers
index 45cc862..aa1e7ad 100755
--- a/tests/slow/override-ciphers
+++ b/tests/slow/override-ciphers
@@ -20,41 +20,39 @@
 # along with GnuTLS; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-srcdir="${srcdir:-.}"
-CLI="${CLI:-../../src/gnutls-cli$EXEEXT}"
 unset RETCODE
 if ! test -z "${VALGRIND}";then
-VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
+  VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
 fi
 
-GNUTLS_NO_EXPLICIT_INIT=1 $VALGRIND ./cipher-override
+GNUTLS_NO_EXPLICIT_INIT=1 ${VALGRIND} ./cipher-override
 if test $? != 0;then
-	echo "overriden cipher tests failed"
-	exit 1
+  echo "overriden cipher tests failed"
+  exit 1
 fi
 
-$VALGRIND ./cipher-override
+${VALGRIND} ./cipher-override
 if test $? != 0;then
-	echo "overriden cipher tests 2 failed"
-	exit 1
+  echo "overriden cipher tests 2 failed"
+  exit 1
 fi
 
-$VALGRIND ./cipher-override2
+${VALGRIND} ./cipher-override2
 if test $? != 0;then
-	echo "overriden cipher tests 3 failed"
-	exit 1
+  echo "overriden cipher tests 3 failed"
+  exit 1
 fi
 
-GNUTLS_NO_EXPLICIT_INIT=1 $VALGRIND ./mac-override
+GNUTLS_NO_EXPLICIT_INIT=1 ${VALGRIND} ./mac-override
 if test $? != 0;then
-	echo "overriden mac tests failed"
-	exit 1
+  echo "overriden mac tests failed"
+  exit 1
 fi
 
-$VALGRIND ./mac-override
+${VALGRIND} ./mac-override
 if test $? != 0;then
-	echo "overriden mac tests 2 failed"
-	exit 1
+  echo "overriden mac tests 2 failed"
+  exit 1
 fi
 
 exit 0
diff --git a/tests/slow/test-ciphers b/tests/slow/test-ciphers
index 7d66d54..0b66bb1 100755
--- a/tests/slow/test-ciphers
+++ b/tests/slow/test-ciphers
@@ -20,59 +20,57 @@
 # along with GnuTLS; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-srcdir="${srcdir:-.}"
-CLI="${CLI:-../../src/gnutls-cli$EXEEXT}"
 unset RETCODE
 if ! test -z "${VALGRIND}";then
-VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
+  VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
 fi
 
 ./cipher-test
 if test $? != 0;then
-	echo "default cipher tests failed"
-	exit 1
+  echo "default cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x1 ./cipher-test
 if test $? != 0;then
-	echo "included cipher tests failed"
-	exit 1
+  echo "included cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x2 ./cipher-test
 if test $? != 0;then
-	echo "AESNI cipher tests failed"
-	exit 1
+  echo "AESNI cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x4 ./cipher-test
 if test $? != 0;then
-	echo "SSSE3 cipher tests failed"
-	exit 1
+  echo "SSSE3 cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x8 ./cipher-test
 if test $? != 0;then
-	echo "PCLMUL cipher tests failed"
-	exit 1
+  echo "PCLMUL cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x100000 ./cipher-test
 if test $? != 0;then
-	echo "padlock cipher tests failed"
-	exit 1
+  echo "padlock cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x200000 ./cipher-test
 if test $? != 0;then
-	echo "padlock PHE cipher tests failed"
-	exit 1
+  echo "padlock PHE cipher tests failed"
+  exit 1
 fi
 
 GNUTLS_CPUID_OVERRIDE=0x400000 ./cipher-test
 if test $? != 0;then
-	echo "padlock PHE SHA512 cipher tests failed"
-	exit 1
+  echo "padlock PHE SHA512 cipher tests failed"
+  exit 1
 fi
 
 exit 0
diff --git a/tests/userid/userid b/tests/userid/userid
index 5374227..fbf97e7 100755
--- a/tests/userid/userid
+++ b/tests/userid/userid
@@ -20,15 +20,15 @@
 # along with GnuTLS; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-srcdir=${srcdir:-.}
-CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
 
-$CERTTOOL --certificate-info --infile $srcdir/userid.pem >out 2>&1
+$CERTTOOL --certificate-info --infile "${srcdir}/userid.pem" >out 2>&1
 RET=$?
-if [ $RET !=  0 ];then
-	echo "Error in userid:"
-	cat out
-	exit 1
+if [ ${RET} !=  0 ];then
+  echo "Error in userid:"
+  cat out
+  exit 1
 fi
 
 rm -f out
-- 
2.3.6




More information about the Gnutls-devel mailing list