mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
New tests
This commit is contained in:
parent
232547e4c0
commit
8ab0adb9f8
@ -1,27 +1,30 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
|
||||
TESTS = version.test decrypt.test clearsig.test armsigs.test \
|
||||
sigs.test armencrypt.test armencryptp.test \
|
||||
encrypt.test encryptp.test signencrypt.test \
|
||||
armsignencrypt.test armdetach.test detach.test \
|
||||
TESTS = version.test \
|
||||
decrypt.test decrypt-dsa.test \
|
||||
sigs.test sigs-dsa.test \
|
||||
encrypt.test encrypt-dsa.test \
|
||||
clearsig.test encryptp.test detach.test \
|
||||
armsigs.test armencrypt.test armencryptp.test \
|
||||
signencrypt.test signencrypt-dsa.test \
|
||||
armsignencrypt.test armdetach.test \
|
||||
armdetachm.test detachm.test genkey1024.test
|
||||
|
||||
|
||||
TEST_FILES = pubring.asc secring.asc gnupg.asc plain-1 plain-2 plain-3o.asc \
|
||||
plain-1.asc plain-2.asc plain-3.asc \
|
||||
plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \
|
||||
pubring.pkr.asc secring.skr.asc
|
||||
|
||||
DATA_FILES = data-500 data-9000 data-32000 data-80000
|
||||
|
||||
EXTRA_DIST = defs.inc $(TESTS) $(TEST_FILES)
|
||||
EXTRA_DIST = defs.inc run-gpg run-gpgm $(TESTS) $(TEST_FILES)
|
||||
CLEANFILES = prepared.stamp x y z out err $(DATA_FILES)
|
||||
|
||||
check: prepared.stamp
|
||||
|
||||
prepared.stamp: pubring.gpg secring.gpg gnupg.sig plain-3 \
|
||||
pubring.pkr secring.skr $(DATA_FILES)
|
||||
@set -x; \
|
||||
echo "def" | ../g10/gpg -v --no-operation; \
|
||||
@echo "def" | ../g10/gpg -v --no-operation; \
|
||||
echo timestamp >./prepared.stamp
|
||||
|
||||
pubring.gpg: pubring.asc
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#info Checking armored detached signatures
|
||||
for i in $plain_files $data_files ; do
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -sab -o x --yes $i
|
||||
run_gpg -o /dev/null --yes x <$i || error "$i: bad signature"
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -sab -o x --yes $i
|
||||
./run-gpg -o /dev/null --yes x <$i || error "$i: bad signature"
|
||||
done
|
||||
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
#info Checking armored detached signatures of multiple files
|
||||
i="$plain_files $data_files"
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -sab -o x --yes $i
|
||||
cat $i | run_gpg -o /dev/null --yes x || error "$i: bad signature"
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -sab -o x --yes $i
|
||||
cat $i | ./run-gpg -o /dev/null --yes x || error "$i: bad signature"
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#info Checking armored encryption
|
||||
for i in $plain_files $data_files ; do
|
||||
run_gpg -ea -o x --yes -r "$usrname2" $i
|
||||
run_gpg -o y --yes x
|
||||
./run-gpg -ea -o x --yes -r "$usrname2" $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
#info Checking armored encryption with a pipe
|
||||
for i in $plain_files $data_files ; do
|
||||
run_gpg -ea --yes -r "$usrname2" < $i | tee x | run_gpg -o y --yes
|
||||
./run-gpg -ea --yes -r "$usrname2" < $i | tee x | ./run-gpg -o y --yes
|
||||
cmp $i y || error "$i: mismatch"
|
||||
run_gpg --yes < x > y
|
||||
./run-gpg --yes < x > y
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
#info Checking armored signing and encryption
|
||||
for i in $plain_files $data_files ; do
|
||||
echo "$usrpass1" \
|
||||
| run_gpg --passphrase-fd 0 -sae -o x --yes -r "$usrname2" $i
|
||||
run_gpg -o y --yes x
|
||||
| ./run-gpg --passphrase-fd 0 -sae -o x --yes -r "$usrname2" $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#info Checking armored signatures
|
||||
for i in $plain_files $data_files ; do
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -sa -o x --yes $i
|
||||
run_gpg -o y --yes x
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -sa -o x --yes $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
# I know that this does not work for random data files (due to large lines
|
||||
# or what ever) - I hope we can live with it.
|
||||
for i in $plain_files; do
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -sat -o x --yes $i
|
||||
run_gpg -o y --yes x
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -sat -o x --yes $i
|
||||
./run-gpg -o y --yes x
|
||||
../tools/clean-sat < $i > z
|
||||
head -c $[ $(cat y | wc -c) - 1 ] y | diff - z || error "$i: mismatch"
|
||||
done
|
||||
|
10
checks/decrypt-dsa.test
Executable file
10
checks/decrypt-dsa.test
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
. defs.inc || exit 3
|
||||
|
||||
#info Checking decryption of supplied DSA encrypted file
|
||||
for i in "plain-1" ; do
|
||||
./run-gpg $dsa_keyrings -o y --yes $i-pgp.asc
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#info Checking decryption of supplied files
|
||||
for i in $plain_files ; do
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -o y --yes $i.asc
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -o y --yes $i.asc
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -9,10 +9,21 @@ usrname1="one"
|
||||
usrpass1="def"
|
||||
usrname2="two"
|
||||
usrpass2=""
|
||||
plain_files="plain-1 plain-2 plain-3"
|
||||
data_files="data-500 data-9000 data-32000 data-80000"
|
||||
|
||||
|
||||
dsa_usrname1="pgp5"
|
||||
# we use the sub key because we do not yet have the logic to
|
||||
# to derive the first encryption key from a keyblock (I guess)
|
||||
dsa_usrname2="0xCB879DE9"
|
||||
|
||||
dsa_keyrings="--keyring ./pubring.pkr --secret-keyring ./secring.skr"
|
||||
|
||||
|
||||
#plain_files="plain-1 plain-2 plain-3"
|
||||
plain_files="plain-1"
|
||||
#data_files="data-500 data-9000 data-32000 data-80000"
|
||||
data_files="data-500"
|
||||
exp_files=""
|
||||
#cleanup_files="x y z"
|
||||
|
||||
|
||||
#--------------------------------
|
||||
@ -47,23 +58,6 @@ chdir () {
|
||||
# cleanup_files="$cleanup_files $*"
|
||||
#}
|
||||
|
||||
run_gpg () {
|
||||
if ! eval ../g10/gpg --homedir . $* 2>err ; then
|
||||
cat err >&2
|
||||
echo "(../g10/gpg --homedir . $*) failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -v 'gpg: Good signature from' err || true
|
||||
}
|
||||
|
||||
run_gpgm () {
|
||||
if ! eval ../g10/gpgm --homedir . $* ; then
|
||||
echo "(../g10/gpgm --homedir . $*) failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
set -e
|
||||
pgmname=$(basename $0)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#info Checking detached signatures
|
||||
for i in $plain_files $data_files ; do
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -sb -o x --yes $i
|
||||
run_gpg -o /dev/null --yes x <$i || error "$i: bad signature"
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -sb -o x --yes $i
|
||||
./run-gpg -o /dev/null --yes x <$i || error "$i: bad signature"
|
||||
done
|
||||
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
#info Checking detached signatures of multiple files
|
||||
i="$plain_files $data_files"
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -sb -o x --yes $i
|
||||
cat $i | run_gpg -o /dev/null --yes x || error "$i: bad signature"
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -sb -o x --yes $i
|
||||
cat $i | ./run-gpg -o /dev/null --yes x || error "$i: bad signature"
|
||||
|
||||
|
19
checks/encrypt-dsa.test
Executable file
19
checks/encrypt-dsa.test
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
. defs.inc || exit 3
|
||||
|
||||
#info Checking encryption
|
||||
for i in $plain_files $data_files ; do
|
||||
./run-gpg $dsa_keyrings -e -o x --yes -r "$dsa_usrname2" $i
|
||||
./run-gpg $dsa_keyrings -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
# and with cast
|
||||
for i in $plain_files $data_files ; do
|
||||
./run-gpg $dsa_keyrings --cipher-algo cast -e \
|
||||
-o x --yes -r "$dsa_usrname2" $i
|
||||
./run-gpg $dsa_keyrings -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
@ -4,8 +4,13 @@
|
||||
|
||||
#info Checking encryption
|
||||
for i in $plain_files $data_files ; do
|
||||
run_gpg -e -o x --yes -r "$usrname2" $i
|
||||
run_gpg -o y --yes x
|
||||
./run-gpg -e -o x --yes -r "$usrname2" $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
for i in $plain_files $data_files ; do
|
||||
./run-gpg -e -o x --yes -r "$usrname2" --cipher-algo cast $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#info Checking encryption with a pipe
|
||||
for i in $plain_files $data_files ; do
|
||||
run_gpg -e --yes -r "$usrname2" < $i | run_gpg --yes > y
|
||||
cmp $i y || fatal "$i: mismatch"
|
||||
./run-gpg -e --yes -r "$usrname2" <$i | tee yy | ./run-gpg --yes > y
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
11
checks/run-gpg
Executable file
11
checks/run-gpg
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! ../g10/gpg --homedir . $* 2>err.tmp.$$ ; then
|
||||
echo "(../g10/gpg --homedir . $*) failed" >&2
|
||||
cat err.tmp.$$ >&2
|
||||
rm err.tmp.$$
|
||||
exit 1
|
||||
fi
|
||||
grep -v 'gpg: Good signature from' err.tmp.$$ || true
|
||||
rm err.tmp.$$
|
||||
|
10
checks/run-gpgm
Executable file
10
checks/run-gpgm
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! ../g10/gpgm --homedir . $* 2>err.tmp.$$ ; then
|
||||
echo "(../g10/gpgm --homedir . $*) failed" >&2
|
||||
cat err.tmp.$$ >&2
|
||||
rm err.tmp.$$
|
||||
exit 1
|
||||
fi
|
||||
rm err.tmp.$$
|
||||
|
22
checks/signencrypt-dsa.test
Executable file
22
checks/signencrypt-dsa.test
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
. defs.inc || exit 3
|
||||
|
||||
#info Checking signing and encryption for DSA
|
||||
for i in $plain_files $data_files ; do
|
||||
./run-gpg $dsa_keyrings -se -o x --yes \
|
||||
-u "$dsa_usrname1" -r "$dsa_usrname2" $i
|
||||
./run-gpg $dsa_keyrings -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
for da in rmd160 sha1 md5; do
|
||||
for i in $plain_files; do
|
||||
./run-gpg $dsa_keyrings -se -o x --yes --digest-algo $da \
|
||||
-u "$dsa_usrname1" -r "$dsa_usrname2" $i
|
||||
./run-gpg $dsa_keyrings -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
# process only the first one
|
||||
break
|
||||
done
|
||||
done
|
@ -6,8 +6,8 @@
|
||||
#info Checking signing and encryption
|
||||
for i in $plain_files $data_files ; do
|
||||
echo "$usrpass1" \
|
||||
| run_gpg --passphrase-fd 0 -se -o x --yes -r "$usrname2" $i
|
||||
run_gpg -o y --yes x
|
||||
| ./run-gpg --passphrase-fd 0 -se -o x --yes -r "$usrname2" $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
22
checks/sigs-dsa.test
Executable file
22
checks/sigs-dsa.test
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
. defs.inc || exit 3
|
||||
|
||||
#info Checking DSA signatures (default digest algo)
|
||||
for i in $plain_files $data_files; do
|
||||
./run-gpg $dsa_keyrings -s -o x --yes -u $dsa_usrname1 $i
|
||||
./run-gpg $dsa_keyrings -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
for da in rmd160 sha1 md5; do
|
||||
for i in $plain_files; do
|
||||
./run-gpg $dsa_keyrings --digest-algo $da \
|
||||
-s -o x --yes -u $dsa_usrname1 $i
|
||||
./run-gpg $dsa_keyrings -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
# process only the first one
|
||||
break
|
||||
done
|
||||
done
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#info Checking signatures
|
||||
for i in $plain_files $data_files; do
|
||||
echo "$usrpass1" | run_gpg --passphrase-fd 0 -s -o x --yes $i
|
||||
run_gpg -o y --yes x
|
||||
echo "$usrpass1" | ./run-gpg --passphrase-fd 0 -s -o x --yes $i
|
||||
./run-gpg -o y --yes x
|
||||
cmp $i y || error "$i: mismatch"
|
||||
done
|
||||
|
||||
|
@ -3,8 +3,7 @@
|
||||
. defs.inc || exit 3
|
||||
|
||||
# print the GPG version
|
||||
run_gpg --version
|
||||
cat err
|
||||
./run-gpg --version
|
||||
|
||||
#fixme: check that the output is correct
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user