guile: Fix dependencies to be parallel-safe.
[gnutls.git] / tests / cert-tests / template-test
blob1a54f663c0fefccd32fe691e3ae2697b5a823177
1 #!/bin/sh
3 # Copyright (C) 2006-2012 Free Software Foundation, Inc.
5 # This file is part of GnuTLS.
7 # GnuTLS is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 3 of the License, or (at
10 # your option) any later version.
12 # GnuTLS is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GnuTLS; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #set -e
23 srcdir=${srcdir:-.}
24 CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
26 # Check for datefudge
27 TSTAMP=`datefudge "2006-09-23" date -u +%s || true`
28 if test "$TSTAMP" != "1158962400"; then
29 echo "You need datefudge to run this test"
30 exit 77
33 # Note that in rare cases this test may fail because the
34 # time set using datefudge could have changed since the generation
35 # (if example the system was busy)
37 rc=1
38 counter=1
40 while [ "$rc" != "0" -a $counter -le 3 ]
43 datefudge "2007-04-22" \
44 $CERTTOOL --generate-self-signed \
45 --load-privkey $srcdir/template-test.key \
46 --template $srcdir/template-test.tmpl \
47 --outfile tmp-tt.pem 2>/dev/null
49 diff $srcdir/template-test.pem tmp-tt.pem
50 rc=$?
51 counter=`expr $counter + 1`
52 done
54 # We're done.
55 if test "$rc" != "0"; then
56 echo "Test 1 failed"
57 exit $rc
60 rm -f tmp-tt.pem
62 rc=1
63 counter=1
65 while [ "$rc" != "0" -a $counter -le 3 ]
67 datefudge "2007-04-22" \
68 $CERTTOOL --generate-self-signed \
69 --load-privkey $srcdir/template-test.key \
70 --template $srcdir/template-utf8.tmpl \
71 --outfile tmp-tt.pem 2>/dev/null
73 diff $srcdir/template-utf8.pem tmp-tt.pem
74 rc=$?
75 counter=`expr $counter + 1`
76 done
78 # We're done.
79 if test "$rc" != "0"; then
80 echo "Test 2 (UTF8) failed"
81 exit $rc
84 rm -f tmp-tt.pem
86 exit 0