Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/netpgpverify Use human2atf to generate a t_net...
details: https://anonhg.NetBSD.org/src/rev/fbec18fa47a4
branches: trunk
changeset: 815728:fbec18fa47a4
user: agc <agc%NetBSD.org@localhost>
date: Wed Jun 01 06:39:11 2016 +0000
description:
Use human2atf to generate a t_netpgpverify.sh script which is half the
size of the previous one (using on-the-fly gzip compression), and includes
more cases (including a gpg-signed file for cross-testing purposes).
Add the appropriate Testspec file.
diffstat:
tests/usr.bin/netpgpverify/Testspec | 119 +
tests/usr.bin/netpgpverify/t_netpgpverify.sh | 15200 +++++++++++-------------
2 files changed, 7001 insertions(+), 8318 deletions(-)
diffs (truncated from 15419 to 300 lines):
diff -r 38b537046c3d -r fbec18fa47a4 tests/usr.bin/netpgpverify/Testspec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/netpgpverify/Testspec Wed Jun 01 06:39:11 2016 +0000
@@ -0,0 +1,119 @@
+#! /bin/sh
+
+# $NetBSD: Testspec,v 1.1 2016/06/01 06:39:11 agc Exp $
+
+# Copyright (c) 2016 Alistair Crooks <agc%NetBSD.org@localhost>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+TESTNAME=netpgpverify
+
+TESTSET_1_NAME=rsa_signatures
+TESTSET_1_FILES='
+a.gpg
+b.gpg
+det
+det.sig
+jj.asc
+pubring.gpg
+NetBSD-6.0_hashes.asc:gzip
+expected16
+expected17
+expected18
+expected19
+expected20
+expected21
+expected22
+expected23
+expected24
+expected25
+expected26
+expected27
+expected28
+expected29
+expected30
+expected31
+expected32
+expected33
+expected34
+expected35
+'
+TESTSET_1_CASE_1="-s eq:0 -o file:1.expected -e empty b2e < 1.in"
+TESTSET_1_CASE_2="-s eq:0 -o file:2.expected -e empty b2e < 2.in"
+
+TESTSET_1_CASE_1="-s eq:0 -o file:expected16 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify b.gpg"
+DISABLE_TESTSET_1_CASE_2="-s eq:0 -o file:expected17 -e empty netpgpverify -c verify a.gpg"
+TESTSET_1_CASE_3="-s eq:0 -o file:expected18 -e empty env TZ=US/Pacific netpgpverify -c verify a.gpg"
+TESTSET_1_CASE_4="-s eq:0 -o file:expected19 -e empty env TZ=US/Pacific netpgpverify -c verify NetBSD-6.0_RC2_hashes.asc"
+TESTSET_1_CASE_5="-s eq:0 -o file:expected20 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat jj.asc"
+TESTSET_1_CASE_6="-s eq:0 -o file:expected21 -e empty env TZ=US/Pacific netpgpverify < a.gpg"
+TESTSET_1_CASE_7="-s eq:0 -o file:expected22 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < jj.asc"
+TESTSET_1_CASE_8="-s eq:0 -o file:expected23 -e empty env TZ=US/Pacific netpgpverify < NetBSD-6.0_RC2_hashes.asc"
+TESTSET_1_CASE_9="-s eq:0 -o file:expected24 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < b.gpg"
+DISABLE_TESTSET_1_CASE_10="-s eq:0 -o file:expected25 -e empty netpgpverify NetBSD-6.0_RC1_hashes.gpg"
+DISABLE_TESTSET_1_CASE_11="-s eq:0 -o file:expected26 -e empty netpgpverify < NetBSD-6.0_RC1_hashes.gpg"
+TESTSET_1_CASE_12="-s eq:0 -o file:expected27 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < NetBSD-6.0_hashes.asc"
+TESTSET_1_CASE_13="-s eq:0 -o file:expected28 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg NetBSD-6.0_hashes.asc"
+DISABLE_TESTSET_1_CASE_14="-s eq:0 -o file:expected29 -e empty netpgpverify NetBSD-6.0_RC1_hashes_ascii.gpg"
+DISABLE_TESTSET_1_CASE_15="-s eq:0 -o file:expected30 -e empty netpgpverify < NetBSD-6.0_RC1_hashes_ascii.gpg"
+TESTSET_1_CASE_16="-s eq:0 -o file:expected31 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat b.gpg b.gpg b.gpg"
+TESTSET_1_CASE_17="-s eq:0 -o file:expected32 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg b.gpg b.gpg b.gpg"
+TESTSET_1_CASE_18="-s eq:0 -o file:expected33 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat b.gpg jj.asc b.gpg"
+TESTSET_1_CASE_19="-s eq:0 -o file:expected34 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg det.sig"
+TESTSET_1_CASE_20="-s eq:0 -o file:expected35 -e empty env TZ=US/Pacific netpgpverify -c cat -k pubring.gpg det.sig"
+DISABLE_TESTSET_1_CASE_21="-s eq:0 -o file:expected46 -e empty netpgpverify -k problem-pubring.gpg NetBSD-6.0_hashes.asc"
+
+TESTSET_2_NAME=dsa_signatures
+TESTSET_2_FILES='
+dsa-pubring.gpg
+in1.gpg
+in1.asc
+in2.gpg
+in2.asc
+expected36
+expected37
+expected38
+expected39
+expected40
+expected41
+expected42
+expected43
+expected44
+expected45
+expected46
+'
+TESTSET_2_CASE_1="-s eq:0 -o file:3.expected -e empty b2e < 3.in"
+TESTSET_2_CASE_2="-s eq:0 -o file:4.expected -e empty b2e < 4.in"
+DISABLE_TESTSET_2_CASE_3="-s eq:0 -o file:5.expected -e empty b2e < 5.in"
+TESTSET_2_CASE_4="-s eq:0 -o file:6.expected -e empty b2e < 6.in"
+
+TESTSET_2_CASE_1="-s eq:0 -o file:expected36 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg in1.gpg"
+TESTSET_2_CASE_2="-s eq:0 -o file:expected37 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg < in1.gpg"
+TESTSET_2_CASE_3="-s eq:0 -o file:expected38 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg in1.asc"
+TESTSET_2_CASE_4="-s eq:0 -o file:expected39 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg < in1.asc"
+TESTSET_2_CASE_5="-s eq:0 -o file:expected40 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg -c cat in1.gpg"
+TESTSET_2_CASE_6="-s eq:0 -o file:expected41 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg -c cat < in1.gpg"
+TESTSET_2_CASE_7="-s eq:0 -o file:expected42 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg -c cat in1.asc"
+TESTSET_2_CASE_8="-s eq:0 -o file:expected43 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg -c cat < in1.asc"
+TESTSET_2_CASE_9="-s eq:0 -o file:expected44 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg in2.gpg"
+TESTSET_2_CASE_10="-s eq:0 -o file:expected45 -e empty env TZ=US/Pacific netpgpverify -k dsa-pubring.gpg in2.asc"
diff -r 38b537046c3d -r fbec18fa47a4 tests/usr.bin/netpgpverify/t_netpgpverify.sh
--- a/tests/usr.bin/netpgpverify/t_netpgpverify.sh Wed Jun 01 05:40:26 2016 +0000
+++ b/tests/usr.bin/netpgpverify/t_netpgpverify.sh Wed Jun 01 06:39:11 2016 +0000
@@ -1,10 +1,14 @@
#! /bin/sh
-# $NetBSD: t_netpgpverify.sh,v 1.2 2014/11/23 01:56:35 agc Exp $
+# $NetBSD: t_netpgpverify.sh,v 1.3 2016/06/01 06:39:11 agc Exp $
-# Copyright (c) 2012 Alistair Crooks <agc%NetBSD.org@localhost>
+#
+# Copyright (c) 2016 The NetBSD Foundation, Inc.
# All rights reserved.
#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Alistair Crooks (agc%NetBSD.org@localhost)
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -14,25 +18,53 @@
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
#
-atf_test_case netpgpverify_case
+# Define test sets with atf_test_case
+# There may well be only one test set - these are tests for different
+# functionality, so netpgpverify has 2 sets, 1 for RSA and 1 for DSA
+# each test set has a
+# + *_head() function, to define the set, and
+# + *_body(), to set up the supporting input and expected output files
+# and some atf_check calls, which actually carry out the tests
+
+# any binary files should be uuencoded
+# we need to give the input and expected output files like this as tests
+# take place in a clean directory, so we need to be able to set them up
+# from the shell script
+
+# Test set 1 (rsa_signatures) for netpgpverify
+atf_test_case netpgpverify_testset_1_rsa_signatures
-netpgpverify_rsa_head() {
- atf_set "descr" "RSA signatures for netpgpverify"
+netpgpverify_testset_1_rsa_signatures_head() {
+ atf_set "descr" "Test set 1 (rsa_signatures) for netpgpverify"
}
-
-netpgpverify_rsa_body() {
+netpgpverify_testset_1_rsa_signatures_body() {
+ uudecode << EOF
+begin-base64 644 a.gpg
+owGbwMvMwMQonXHnz4HIDGXGNduSGBPD/Rq2KSuo+KWWOAW7WCn4JmanpmXmpOqU
+KRjqGSoYGRga6Rsa6hsZKBiYW5maWpmaKCSmJyu4VhQoqHBx6WXmJeeUpqQq2CQV
+p+jll+fp5WbbcXGFuAaHBLt4BtkqqFSD2U6Owa61+qXFRXpJmXn6eaklBekFZalF
+mWmVUMXxwR7atgol8ahSqMaXpBaXgM3vZJRhYWBkYmBjZQK5noGLUwDmp2X32f/X
+n4pynyaz+0jbeluli8/NgkI2bK65Ud+ecUelqkvNaXlNVo3TKyX9TuNUpmX3l7l2
+t2xy4e8veH8/OpurgK9V4EXAB98rbddTgtpzTxhuWH5x0Qf3O0xOzL5MR5SfLH7/
+zJMl72uqUExspt5UJuXIEw+LTj2JKfA7Mcl219+lKebOVlfqpA20HzSeXmaatynY
+NrX2BWfpS++vxxJiWL/wtLvzSVk/uZVunlXBsfDV/rbUxFDGPdMuNT/98f6cQ1Fz
+/+nLOY84rsk7K/NnulZuvNzb9jw3Qv58qPvep1saRDy6XhcUxhwOmZvh1DvLz/HG
+HNZMdVcl/iahoFURvHryU72zzz5eKXgoSc0SAA==
+====
+EOF
uudecode << EOF
begin-base64 644 b.gpg
xA0DAAgBG2jc/MBZaCMBy4tiAAAAAABQUk9HPXAKU1JDUz1wYXJzZS5jCldBUk5T
@@ -47,23 +79,14 @@
0c4J/4dwyMqdDuhby//52Nw=
====
EOF
- cat >det << EOF
-To Do
-=====
-tests with -k sig
-detached sigs
-DSA
-
-Done
+ uudecode << EOF
+begin-base64 644 det
+VG8gRG8KPT09PT0KdGVzdHMgd2l0aCAtayBzaWcKZGV0YWNoZWQgc2lncwpEU0EK
+CkRvbmUKPT09PQpiYXNpY3MKbG9jYWxpc2UgcGdwX3JlYWRfcGFja2V0cwpmaXgg
+bGludApXQVJOUz01CmxpYiBtYW4gcGFnZQpwcm9nIG1hbiBwYWdlCmRvIHdlIGRv
+IGl0IHN0YXRpY2FsbHkgbGlua2VkIGFzIHdlbGw/Cm11bHRpcGxlIGZpbGVzIGlu
+IG5ldHBncHZlcmlmeQo=
====
-basics
-localise pgp_read_packets
-fix lint
-WARNS=5
-lib man page
-prog man page
-do we do it statically linked as well?
-multiple files in netpgpverify
EOF
uudecode << EOF
begin-base64 644 det.sig
@@ -75,39 +98,24 @@
leNo8g9OwiJ6fMtdwTMsFkxqjjVKk5//X/6jQd/mf55XcxLOw4UK4ev5ADExnOU=
====
EOF
- cat >jj.asc << EOF
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-1. tag & 0x3f
-2. len
-
-one pass (tag 4)
-========
-b version:3
-b sig type
-b hash alg
-b pubkey alg
-8b keyid
-
-literal data (tag 11)
-=============
-b binary/text
-b length
-c string
-L mtime
-text
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.11 (NetBSD)
-
-iQEcBAEBAgAGBQJQaIZcAAoJEBto3PzAWWgj678IALbDHon3Rm6qUhn7k1TFT6D3
-yi/jzf3piSJGsgUg2wEghs175edC/cJK3lG9Gx/3/uQq06R9g37nVRX8I0sK7yT2
-XgR+RHoGh/b+CQxdRNC+ub5QoNb8LcmCb/MQGq2KK9otSExiy4WMUP4K1DblaK5L
-+Hg4VTooMot1NVqyFSoB2aZauXc2F4ZVh5q0fn8w5GEw45P+AUUbmzpgbLwXbl+I
-tMsX54V1dxyDcCYUs0xUH/VxJUQEeIlDbCOXYMbCVtggYRqKksTr+u/riw/Llnql
-jQdq5rBRW1SlD7Ll6z/LF2WBJOWtHzp4qbnBGSq5uB1q37H3mWL28f1tL//TUjM=
-=EX8W
------END PGP SIGNATURE-----
+ uudecode << EOF
+begin-base64 644 jj.asc
+LS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NBR0UtLS0tLQpIYXNoOiBTSEExCgox
+LiB0YWcgJiAweDNmCjIuIGxlb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