diff options
author | Werner Koch <wk@gnupg.org> | 1998-04-08 21:42:07 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1998-04-08 21:42:07 +0200 |
commit | 8ab0adb9f8e5fe4a4c5aa7097b7084ee6b44c17c (patch) | |
tree | 59c6d36289751a95c1755035ed369a40325b850c /checks | |
parent | test file (diff) | |
download | gnupg2-8ab0adb9f8e5fe4a4c5aa7097b7084ee6b44c17c.tar.xz gnupg2-8ab0adb9f8e5fe4a4c5aa7097b7084ee6b44c17c.zip |
New tests
Diffstat (limited to 'checks')
-rw-r--r-- | checks/Makefile.am | 21 | ||||
-rwxr-xr-x | checks/armdetach.test | 4 | ||||
-rwxr-xr-x | checks/armdetachm.test | 4 | ||||
-rwxr-xr-x | checks/armencrypt.test | 4 | ||||
-rwxr-xr-x | checks/armencryptp.test | 4 | ||||
-rwxr-xr-x | checks/armsignencrypt.test | 4 | ||||
-rwxr-xr-x | checks/armsigs.test | 4 | ||||
-rwxr-xr-x | checks/clearsig.test | 4 | ||||
-rwxr-xr-x | checks/decrypt-dsa.test | 10 | ||||
-rwxr-xr-x | checks/decrypt.test | 2 | ||||
-rwxr-xr-x | checks/defs.inc | 34 | ||||
-rwxr-xr-x | checks/detach.test | 4 | ||||
-rwxr-xr-x | checks/detachm.test | 4 | ||||
-rwxr-xr-x | checks/encrypt-dsa.test | 19 | ||||
-rwxr-xr-x | checks/encrypt.test | 9 | ||||
-rwxr-xr-x | checks/encryptp.test | 4 | ||||
-rwxr-xr-x | checks/run-gpg | 11 | ||||
-rwxr-xr-x | checks/run-gpgm | 10 | ||||
-rwxr-xr-x | checks/signencrypt-dsa.test | 22 | ||||
-rwxr-xr-x | checks/signencrypt.test | 4 | ||||
-rwxr-xr-x | checks/sigs-dsa.test | 22 | ||||
-rwxr-xr-x | checks/sigs.test | 4 | ||||
-rwxr-xr-x | checks/version.test | 3 |
23 files changed, 153 insertions, 58 deletions
diff --git a/checks/Makefile.am b/checks/Makefile.am index 964725383..b4a830b42 100644 --- a/checks/Makefile.am +++ b/checks/Makefile.am @@ -1,28 +1,31 @@ ## 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 timestamp >./prepared.stamp + @echo "def" | ../g10/gpg -v --no-operation; \ + echo timestamp >./prepared.stamp pubring.gpg: pubring.asc ../g10/gpgm --yes --dearmor -o pubring.gpg pubring.asc diff --git a/checks/armdetach.test b/checks/armdetach.test index f09fc2b40..0e22cb574 100755 --- a/checks/armdetach.test +++ b/checks/armdetach.test @@ -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 diff --git a/checks/armdetachm.test b/checks/armdetachm.test index eb245aabb..dcbab1c47 100755 --- a/checks/armdetachm.test +++ b/checks/armdetachm.test @@ -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" diff --git a/checks/armencrypt.test b/checks/armencrypt.test index 5ab80fe9e..c82cd1158 100755 --- a/checks/armencrypt.test +++ b/checks/armencrypt.test @@ -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 diff --git a/checks/armencryptp.test b/checks/armencryptp.test index a67e3c7e4..4452d0534 100755 --- a/checks/armencryptp.test +++ b/checks/armencryptp.test @@ -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 diff --git a/checks/armsignencrypt.test b/checks/armsignencrypt.test index 3b87b2580..c9bdb1bd9 100755 --- a/checks/armsignencrypt.test +++ b/checks/armsignencrypt.test @@ -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 diff --git a/checks/armsigs.test b/checks/armsigs.test index 16b709685..2cba37de9 100755 --- a/checks/armsigs.test +++ b/checks/armsigs.test @@ -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 diff --git a/checks/clearsig.test b/checks/clearsig.test index 6cb8c7aeb..75802cf79 100755 --- a/checks/clearsig.test +++ b/checks/clearsig.test @@ -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 diff --git a/checks/decrypt-dsa.test b/checks/decrypt-dsa.test new file mode 100755 index 000000000..bd3f4b99e --- /dev/null +++ b/checks/decrypt-dsa.test @@ -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 + diff --git a/checks/decrypt.test b/checks/decrypt.test index b7a089bab..edd32a24a 100755 --- a/checks/decrypt.test +++ b/checks/decrypt.test @@ -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 diff --git a/checks/defs.inc b/checks/defs.inc index 241d4a07d..fe602a145 100755 --- a/checks/defs.inc +++ b/checks/defs.inc @@ -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) diff --git a/checks/detach.test b/checks/detach.test index d9f44db12..de5fefb60 100755 --- a/checks/detach.test +++ b/checks/detach.test @@ -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 diff --git a/checks/detachm.test b/checks/detachm.test index 60f2e75b0..4130ea33f 100755 --- a/checks/detachm.test +++ b/checks/detachm.test @@ -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" diff --git a/checks/encrypt-dsa.test b/checks/encrypt-dsa.test new file mode 100755 index 000000000..d506e8890 --- /dev/null +++ b/checks/encrypt-dsa.test @@ -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 + diff --git a/checks/encrypt.test b/checks/encrypt.test index b6920814f..daf3be6ee 100755 --- a/checks/encrypt.test +++ b/checks/encrypt.test @@ -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 diff --git a/checks/encryptp.test b/checks/encryptp.test index ac86fb54e..f9b66792f 100755 --- a/checks/encryptp.test +++ b/checks/encryptp.test @@ -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 diff --git a/checks/run-gpg b/checks/run-gpg new file mode 100755 index 000000000..3420bf98e --- /dev/null +++ b/checks/run-gpg @@ -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.$$ + diff --git a/checks/run-gpgm b/checks/run-gpgm new file mode 100755 index 000000000..847ce15b9 --- /dev/null +++ b/checks/run-gpgm @@ -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.$$ + diff --git a/checks/signencrypt-dsa.test b/checks/signencrypt-dsa.test new file mode 100755 index 000000000..d556f58f7 --- /dev/null +++ b/checks/signencrypt-dsa.test @@ -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 diff --git a/checks/signencrypt.test b/checks/signencrypt.test index 1cf038c56..9a0418779 100755 --- a/checks/signencrypt.test +++ b/checks/signencrypt.test @@ -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 diff --git a/checks/sigs-dsa.test b/checks/sigs-dsa.test new file mode 100755 index 000000000..6f07288f4 --- /dev/null +++ b/checks/sigs-dsa.test @@ -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 + diff --git a/checks/sigs.test b/checks/sigs.test index bc49c4c20..15c464f1e 100755 --- a/checks/sigs.test +++ b/checks/sigs.test @@ -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 diff --git a/checks/version.test b/checks/version.test index 6d04385df..d7845bbc1 100755 --- a/checks/version.test +++ b/checks/version.test @@ -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 |