summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-14 09:59:20 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-06-14 10:05:36 +0200
commit3d96c8bb76012611fe97e27a50933308cee69420 (patch)
tree55ae53d88a3469e82fd7f077678d87f5c768f376
parentd1b4ec98a601275c1eeeb706a03a98dfb2052265 (diff)
downloadgnutls-3d96c8bb76012611fe97e27a50933308cee69420.tar.gz
tests: moved check for datefudge in scripts/common.sh
-rwxr-xr-xtests/cert-tests/certtool10
-rwxr-xr-xtests/cert-tests/krb5-test10
-rwxr-xr-xtests/cert-tests/md5-test10
-rwxr-xr-xtests/cert-tests/othername-test10
-rwxr-xr-xtests/cert-tests/sha3-test10
-rwxr-xr-xtests/cert-tests/template-test10
-rwxr-xr-xtests/cert-tests/tlsfeature-test10
-rw-r--r--tests/scripts/common.sh9
8 files changed, 30 insertions, 49 deletions
diff --git a/tests/cert-tests/certtool b/tests/cert-tests/certtool
index b5d69dae09..6a8bcc8b81 100755
--- a/tests/cert-tests/certtool
+++ b/tests/cert-tests/certtool
@@ -79,13 +79,9 @@ fi
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600" || test "$WINDOWS" = 1; then
-echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
cat "${srcdir}/../certs/cert-ecc256.pem" "${srcdir}/../certs/ca-cert-ecc.pem"|datefudge "2012-11-22" \
${VALGRIND} "${CERTTOOL}" --verify-chain
diff --git a/tests/cert-tests/krb5-test b/tests/cert-tests/krb5-test
index 57ea4757f7..54ce215611 100755
--- a/tests/cert-tests/krb5-test
+++ b/tests/cert-tests/krb5-test
@@ -28,13 +28,9 @@ TMPLFILE=tmp-krb5name.tmpl
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600"; then
- echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
if ! test -z "${VALGRIND}"; then
VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=3"
diff --git a/tests/cert-tests/md5-test b/tests/cert-tests/md5-test
index f4a2046248..c72cc14919 100755
--- a/tests/cert-tests/md5-test
+++ b/tests/cert-tests/md5-test
@@ -27,13 +27,9 @@ DIFF="${DIFF:-diff}"
TMPFILE=md5.$$.tmp
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600"; then
- echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
# Test MD5 signatures
diff --git a/tests/cert-tests/othername-test b/tests/cert-tests/othername-test
index 603db3696f..8741b0f52e 100755
--- a/tests/cert-tests/othername-test
+++ b/tests/cert-tests/othername-test
@@ -27,13 +27,9 @@ OUTFILE=tmp-othername.pem
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600"; then
- echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
# Note that in rare cases this test may fail because the
# time set using datefudge could have changed since the generation
diff --git a/tests/cert-tests/sha3-test b/tests/cert-tests/sha3-test
index 40f2912306..8d619e59f0 100755
--- a/tests/cert-tests/sha3-test
+++ b/tests/cert-tests/sha3-test
@@ -26,13 +26,9 @@ DIFF="${DIFF:-diff}"
TMPFILE=sha3.$$.tmp
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600"; then
- echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
# Note that in rare cases this test may fail because the
# time set using datefudge could have changed since the generation
diff --git a/tests/cert-tests/template-test b/tests/cert-tests/template-test
index 976df045bf..1d40735908 100755
--- a/tests/cert-tests/template-test
+++ b/tests/cert-tests/template-test
@@ -26,13 +26,9 @@ DIFF="${DIFF:-diff}"
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600"; then
- echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
# Note that in rare cases this test may fail because the
# time set using datefudge could have changed since the generation
diff --git a/tests/cert-tests/tlsfeature-test b/tests/cert-tests/tlsfeature-test
index 0070ea8627..e76aa109b3 100755
--- a/tests/cert-tests/tlsfeature-test
+++ b/tests/cert-tests/tlsfeature-test
@@ -27,13 +27,9 @@ TMPFILE=tlsfeature.$$.tmp
TMPFILE2=tlsfeature-2.$$.tmp
export TZ="UTC"
-# Check for datefudge
-TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
-if test "$TSTAMP" != "1158969600"; then
- echo $TSTAMP
- echo "You need datefudge to run this test"
- exit 77
-fi
+. ${srcdir}/../scripts/common.sh
+
+check_for_datefudge
#
# Test certificate generation
diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh
index 9c9c3fb3aa..46f9598032 100644
--- a/tests/scripts/common.sh
+++ b/tests/scripts/common.sh
@@ -25,6 +25,15 @@ GETPORT='rc=0;while test $rc = 0;do PORT="$(((($$<<15)|RANDOM) % 63001 + 2000))"
netstat -anl|grep "[\:\.]$PORT" >/dev/null 2>&1;
rc=$?;done;'
+check_for_datefudge() {
+ TSTAMP=`datefudge -s "2006-09-23" date -u +%s || true`
+ if test "$TSTAMP" != "1158969600" || test "$WINDOWS" = 1; then
+ echo $TSTAMP
+ echo "You need datefudge to run this test"
+ exit 77
+ fi
+}
+
fail() {
PID="$1"
shift