4 # Copyright (C) 2010 Google Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 export PYTHON=${PYTHON:=python}
26 CCE=tools/check-cert-expired
35 $PYTHON "${TOP_SRCDIR:-.}/test/import-export_unittest-helper" "$@"
38 $CCE 2>/dev/null && err 'Accepted empty argument list'
39 $CCE foo bar 2>/dev/null && err 'Accepted more than one argument'
40 $CCE foo bar baz 2>/dev/null && err 'Accepted more than one argument'
43 trap "rm -rf $tmpdir" EXIT
45 [[ -f "$tmpdir/cert-not" ]] && err 'File existed when it should not'
46 $CCE $tmpdir/cert-not 2>/dev/null && err 'Accepted non-existent file'
48 VALIDITY=1 impexpd_helper $tmpdir/cert-valid gencert
49 $CCE $tmpdir/cert-valid 2>/dev/null && \
50 err 'Reported valid certificate as expired'
52 VALIDITY=-50 impexpd_helper $tmpdir/cert-expired gencert
53 $CCE $tmpdir/cert-expired 2>/dev/null || \
54 err 'Reported expired certificate as valid'
56 echo > $tmpdir/cert-invalid
57 $CCE $tmpdir/cert-invalid 2>/dev/null && \
58 err 'Reported invalid certificate as expired'
60 echo 'Hello World' > $tmpdir/cert-invalid2
61 $CCE $tmpdir/cert-invalid2 2>/dev/null && \
62 err 'Reported invalid certificate as expired'