1#!/bin/sh
2
3if [ -z "$srcdir" ]; then
4 srcdir=.
5fi
6
7# test pwsafe on known-good test.dat database, which uses "abc" as passphrase and contains one entry named "testing".
8test() {
9 pwsafe=$srcdir/pwsafe
10 file="$1"
11 pw="$2"
12
13 echo -n "testing pwsafe against $file database: "
14 out=`$pwsafe -f "$file" 2>&1 <<EOF
15$pw
16EOF
17`
18
19 if echo "$out" | grep 'testing$' >/dev/null; then
20   echo OK
21 else
22   echo "FAILED!"
23   echo "pwsafe is NOT WORKING PROPERLY. It is unable to decrypt $file (passphase: $pw)."
24   echo "Here is the output:"
25   echo "$out"
26   exit 1
27 fi
28}
29
30test $srcdir/test.dat "abc"
31test $srcdir/testv2.dat "abc"
32
33
34exit 0
35
36