Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/crypto/libcrypto Do not use awk to generate the test p...



details:   https://anonhg.NetBSD.org/src/rev/df72f2a248a5
branches:  trunk
changeset: 756281:df72f2a248a5
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Sat Jul 10 16:43:25 2010 +0000

description:
Do not use awk to generate the test program.  Instead, just expand the
code.

While doing this, split the big monolithic test program into more granular
but cohesive test programs.

diffstat:

 tests/crypto/libcrypto/Atffile         |    4 +
 tests/crypto/libcrypto/Makefile        |   14 +-
 tests/crypto/libcrypto/t_certs.sh      |   41 ++++++++
 tests/crypto/libcrypto/t_ciphers.sh    |  113 +++++++++++++++++++++++
 tests/crypto/libcrypto/t_hashes.sh     |  111 +++++++++++++++++++++++
 tests/crypto/libcrypto/t_libcrypto.awk |   65 -------------
 tests/crypto/libcrypto/t_libcrypto.in  |  157 ---------------------------------
 tests/crypto/libcrypto/t_libcrypto.sh  |  108 ++++++++++++++++++++++
 tests/crypto/libcrypto/t_pubkey.sh     |   96 ++++++++++++++++++++
 9 files changed, 479 insertions(+), 230 deletions(-)

diffs (truncated from 759 to 300 lines):

diff -r da65dc9a855a -r df72f2a248a5 tests/crypto/libcrypto/Atffile
--- a/tests/crypto/libcrypto/Atffile    Sat Jul 10 16:16:12 2010 +0000
+++ b/tests/crypto/libcrypto/Atffile    Sat Jul 10 16:43:25 2010 +0000
@@ -2,4 +2,8 @@
 
 prop: test-suite = "NetBSD"
 
+tp: t_certs
+tp: t_ciphers
+tp: t_hashes
 tp: t_libcrypto
+tp: t_pubkey
diff -r da65dc9a855a -r df72f2a248a5 tests/crypto/libcrypto/Makefile
--- a/tests/crypto/libcrypto/Makefile   Sat Jul 10 16:16:12 2010 +0000
+++ b/tests/crypto/libcrypto/Makefile   Sat Jul 10 16:43:25 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2009/02/13 22:01:49 jmmv Exp $
+# $NetBSD: Makefile,v 1.4 2010/07/10 16:43:25 jmmv Exp $
 
 .include <bsd.own.mk>
 
@@ -17,13 +17,11 @@
 
 TESTSDIR=      ${TESTSBASE}/crypto/libcrypto
 
-TESTS_SH=      t_libcrypto
-
-CLEANFILES+=   t_libcrypto.sh
-t_libcrypto.sh: t_libcrypto.awk t_libcrypto.in
-       ${TOOL_AWK} -f ${.CURDIR}/t_libcrypto.awk ${.CURDIR}/t_libcrypto.in \
-           >t_libcrypto.sh.tmp
-       mv t_libcrypto.sh.tmp t_libcrypto.sh
+TESTS_SH=      t_certs
+TESTS_SH+=     t_ciphers
+TESTS_SH+=     t_hashes
+TESTS_SH+=     t_libcrypto
+TESTS_SH+=     t_pubkey
 
 .include <bsd.subdir.mk>
 .include <bsd.test.mk>
diff -r da65dc9a855a -r df72f2a248a5 tests/crypto/libcrypto/t_certs.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/crypto/libcrypto/t_certs.sh Sat Jul 10 16:43:25 2010 +0000
@@ -0,0 +1,41 @@
+# $NetBSD: t_certs.sh,v 1.1 2010/07/10 16:43:25 jmmv Exp $
+#
+# Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
+# 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 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 x509v3
+x509v3_head()
+{
+       atf_set "descr" "Checks x509v3 certificates"
+}
+x509v3_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_x509v3test"
+}
+
+atf_init_test_cases()
+{
+       atf_add_test_case x509v3
+}
diff -r da65dc9a855a -r df72f2a248a5 tests/crypto/libcrypto/t_ciphers.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/crypto/libcrypto/t_ciphers.sh       Sat Jul 10 16:43:25 2010 +0000
@@ -0,0 +1,113 @@
+# $NetBSD: t_ciphers.sh,v 1.1 2010/07/10 16:43:25 jmmv Exp $
+#
+# Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
+# 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 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 bf
+bf_head()
+{
+       atf_set "descr" "Checks blowfish cipher"
+}
+bf_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_bftest"
+}
+
+atf_test_case cast
+cast_head()
+{
+       atf_set "descr" "Checks CAST cipher"
+}
+cast_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_casttest"
+}
+
+atf_test_case des
+des_head()
+{
+       atf_set "descr" "Checks DES cipher (libdes)"
+}
+des_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_destest"
+}
+
+atf_test_case rc2
+rc2_head()
+{
+       atf_set "descr" "Checks RC2 cipher"
+}
+rc2_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_rc2test"
+}
+
+atf_test_case rc4
+rc4_head()
+{
+       atf_set "descr" "Checks RC4 cipher"
+}
+rc4_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_rc4test"
+}
+
+atf_test_case idea
+idea_head()
+{
+       atf_set "descr" "Checks IDEA cipher"
+}
+idea_body()
+{
+       [ -x "$(atf_get_srcdir)/h_ideatest" ] \
+           || atf_skip "IDEA support not available; system built" \
+                       "with MKCRYPTO_IDEA=no"
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_ideatest"
+}
+
+atf_test_case rc5
+rc5_head()
+{
+       atf_set "descr" "Checks RC5 cipher"
+}
+rc5_body()
+{
+       [ -x "$(atf_get_srcdir)/h_rc5test" ] \
+           || atf_skip "RC5 support not available; system built" \
+                       "with MKCRYPTO_RC5=no"
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_rc5test"
+}
+
+atf_init_test_cases()
+{
+       atf_add_test_case bf
+       atf_add_test_case cast
+       atf_add_test_case des
+       atf_add_test_case rc2
+       atf_add_test_case rc4
+       atf_add_test_case idea
+       atf_add_test_case rc5
+}
diff -r da65dc9a855a -r df72f2a248a5 tests/crypto/libcrypto/t_hashes.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/crypto/libcrypto/t_hashes.sh        Sat Jul 10 16:43:25 2010 +0000
@@ -0,0 +1,111 @@
+# $NetBSD: t_hashes.sh,v 1.1 2010/07/10 16:43:25 jmmv Exp $
+#
+# Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
+# 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 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 hmac
+hmac_head()
+{
+       atf_set "descr" "Checks HMAC message authentication code"
+}
+hmac_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_hmactest"
+}
+
+atf_test_case md2
+md2_head()
+{
+       atf_set "descr" "Checks MD2 digest"
+}
+md2_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_md2test"
+}
+
+atf_test_case md4
+md4_head()
+{
+       atf_set "descr" "Checks MD4 digest"
+}
+md4_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_md4test"
+}
+
+atf_test_case md5
+md5_head()
+{
+       atf_set "descr" "Checks MD5 digest"
+}
+md5_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_md5test"
+}
+
+atf_test_case ripemd
+ripemd_head()
+{
+       atf_set "descr" "Checks RMD-160 digest"
+}
+ripemd_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_ripemdtest"
+}
+
+atf_test_case sha
+sha_head()
+{
+       atf_set "descr" "Checks SHA-1 digest"
+}
+sha_body()
+{
+       atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_shatest"
+}
+
+
+atf_test_case mdc2
+mdc2_head()
+{
+       atf_set "descr" "Checks MDC2 digest"
+}
+mdc2_body()



Home | Main Index | Thread Index | Old Index