]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: moved check for datefudge in scripts/common.sh
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 14 Jun 2016 07:59:20 +0000 (09:59 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 14 Jun 2016 08:05:36 +0000 (10:05 +0200)
tests/cert-tests/certtool
tests/cert-tests/krb5-test
tests/cert-tests/md5-test
tests/cert-tests/othername-test
tests/cert-tests/sha3-test
tests/cert-tests/template-test
tests/cert-tests/tlsfeature-test
tests/scripts/common.sh

index b5d69dae090e30db6a0a02ecf012ea7a3823590d..6a8bcc8b812555e399d85dc4a79ab3c0a81dae6e 100755 (executable)
@@ -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
index 57ea4757f7b1ee41b8b9f8fa9bf91321e1bb80a4..54ce2156110b45a8cedd5d4516cbe8b579e540e8 100755 (executable)
@@ -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"
index f4a204624852dc9ad0179a57efb1d23b479aba61..c72cc14919f8601a287c78fd6dc1233e598449f1 100755 (executable)
@@ -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
 
index 603db3696f30906c80e6babf398a3e67dcd0ec87..8741b0f52e9183560be8840ed0483baf13e404f3 100755 (executable)
@@ -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
index 40f2912306829dff38f0b221cb6901f507534e57..8d619e59f09c3974393770fefaa8dc99c7e04705 100755 (executable)
@@ -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
index 976df045bf5c9f3421ded8903414d9cddb6bd576..1d40735908dc1acb52c2fe1ea57ad97121a46581 100755 (executable)
@@ -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
index 0070ea8627cfdb05846adc78ef9df982f425aede..e76aa109b31ff2b8b8649d10e951ceff3ae095ae 100755 (executable)
@@ -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
index 9c9c3fb3aa1c9e36479ac77f846305903f4d02c1..46f9598032fffb382f41cd9d1c685d1b6cf6a764 100644 (file)
@@ -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