Module Name: src
Committed By: jmmv
Date: Sat Jul 10 16:43:26 UTC 2010
Modified Files:
src/tests/crypto/libcrypto: Atffile Makefile
Added Files:
src/tests/crypto/libcrypto: t_certs.sh t_ciphers.sh t_hashes.sh
t_libcrypto.sh t_pubkey.sh
Removed Files:
src/tests/crypto/libcrypto: t_libcrypto.awk t_libcrypto.in
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/crypto/libcrypto/Atffile
cvs rdiff -u -r1.3 -r1.4 src/tests/crypto/libcrypto/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/crypto/libcrypto/t_certs.sh \
src/tests/crypto/libcrypto/t_ciphers.sh \
src/tests/crypto/libcrypto/t_hashes.sh \
src/tests/crypto/libcrypto/t_libcrypto.sh \
src/tests/crypto/libcrypto/t_pubkey.sh
cvs rdiff -u -r1.1 -r0 src/tests/crypto/libcrypto/t_libcrypto.awk
cvs rdiff -u -r1.3 -r0 src/tests/crypto/libcrypto/t_libcrypto.in
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/crypto/libcrypto/Atffile
diff -u src/tests/crypto/libcrypto/Atffile:1.1 src/tests/crypto/libcrypto/Atffile:1.2
--- src/tests/crypto/libcrypto/Atffile:1.1 Fri Feb 13 20:58:14 2009
+++ src/tests/crypto/libcrypto/Atffile Sat Jul 10 16:43:25 2010
@@ -2,4 +2,8 @@
prop: test-suite = "NetBSD"
+tp: t_certs
+tp: t_ciphers
+tp: t_hashes
tp: t_libcrypto
+tp: t_pubkey
Index: src/tests/crypto/libcrypto/Makefile
diff -u src/tests/crypto/libcrypto/Makefile:1.3 src/tests/crypto/libcrypto/Makefile:1.4
--- src/tests/crypto/libcrypto/Makefile:1.3 Fri Feb 13 22:01:49 2009
+++ src/tests/crypto/libcrypto/Makefile Sat Jul 10 16:43:25 2010
@@ -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>
Added files:
Index: src/tests/crypto/libcrypto/t_certs.sh
diff -u /dev/null src/tests/crypto/libcrypto/t_certs.sh:1.1
--- /dev/null Sat Jul 10 16:43:26 2010
+++ src/tests/crypto/libcrypto/t_certs.sh Sat Jul 10 16:43:25 2010
@@ -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
+}
Index: src/tests/crypto/libcrypto/t_ciphers.sh
diff -u /dev/null src/tests/crypto/libcrypto/t_ciphers.sh:1.1
--- /dev/null Sat Jul 10 16:43:26 2010
+++ src/tests/crypto/libcrypto/t_ciphers.sh Sat Jul 10 16:43:25 2010
@@ -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
+}
Index: src/tests/crypto/libcrypto/t_hashes.sh
diff -u /dev/null src/tests/crypto/libcrypto/t_hashes.sh:1.1
--- /dev/null Sat Jul 10 16:43:26 2010
+++ src/tests/crypto/libcrypto/t_hashes.sh Sat Jul 10 16:43:25 2010
@@ -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()
+{
+ [ -x "$(atf_get_srcdir)/h_mdc2test" ] \
+ || atf_skip "MDC2 support not available; system built" \
+ "with MKCRYPTO_MDC2=no"
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_mdc2test"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case hmac
+ atf_add_test_case md2
+ atf_add_test_case md4
+ atf_add_test_case md5
+ atf_add_test_case ripemd
+ atf_add_test_case sha
+ atf_add_test_case mdc2
+}
Index: src/tests/crypto/libcrypto/t_libcrypto.sh
diff -u /dev/null src/tests/crypto/libcrypto/t_libcrypto.sh:1.1
--- /dev/null Sat Jul 10 16:43:26 2010
+++ src/tests/crypto/libcrypto/t_libcrypto.sh Sat Jul 10 16:43:25 2010
@@ -0,0 +1,108 @@
+# $NetBSD: t_libcrypto.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 engine
+engine_head()
+{
+ atf_set "descr" "Checks ENGINE framework"
+}
+engine_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_enginetest"
+}
+
+atf_test_case rand
+rand_head()
+{
+ atf_set "descr" "Checks peudo-random number generator"
+}
+rand_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_randtest"
+}
+
+atf_test_case bn
+bn_head()
+{
+ atf_set "descr" "Checks BIGNUM library"
+}
+bn_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_bntest"
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_divtest"
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_exptest"
+}
+
+atf_test_case conf
+conf_head()
+{
+ atf_set "descr" "Checks configuration modules"
+ atf_set "use.fs" "true"
+}
+conf_body()
+{
+ cp $(atf_get_srcdir)/d_conf_ssleay.cnf ssleay.cnf
+
+ atf_check -o file:$(atf_get_srcdir)/d_conf.out \
+ $(atf_get_srcdir)/h_conftest
+}
+
+atf_test_case lhash
+lhash_head()
+{
+ atf_set "descr" "Checks lhash - dynamic hash tables"
+}
+lhash_body()
+{
+ atf_check -o ignore -e ignore -x \
+ "echo hoge | $(atf_get_srcdir)/h_lhashtest"
+}
+
+atf_test_case threads
+threads_head()
+{
+ atf_set "descr" "Checks threading"
+ atf_set "use.fs" "true"
+}
+threads_body()
+{
+ $(atf_get_srcdir)/h_threadstest \
+ -cert $(atf_get_srcdir)/d_server.pem \
+ -ccert $(atf_get_srcdir)/d_client.pem \
+ 2>&1 | tee out
+ atf_check -s eq:1 -o empty -e empty grep :error: out
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case engine
+ atf_add_test_case rand
+ atf_add_test_case bn
+ atf_add_test_case conf
+ atf_add_test_case lhash
+ atf_add_test_case threads
+}
Index: src/tests/crypto/libcrypto/t_pubkey.sh
diff -u /dev/null src/tests/crypto/libcrypto/t_pubkey.sh:1.1
--- /dev/null Sat Jul 10 16:43:26 2010
+++ src/tests/crypto/libcrypto/t_pubkey.sh Sat Jul 10 16:43:25 2010
@@ -0,0 +1,96 @@
+# $NetBSD: t_pubkey.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 dsa
+dsa_head()
+{
+ atf_set "descr" "Checks DSA cipher"
+}
+dsa_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_dsatest"
+}
+
+atf_test_case dh
+dh_head()
+{
+ atf_set "descr" "Checks Diffie-Hellman key agreement protocol"
+}
+dh_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_dhtest"
+}
+
+atf_test_case rsa
+rsa_head()
+{
+ atf_set "descr" "Checks RSA"
+}
+rsa_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_rsatest"
+}
+
+atf_test_case ec
+ec_head()
+{
+ atf_set "descr" "Checks EC cipher"
+}
+ec_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_ectest"
+}
+
+atf_test_case ecdh
+ecdh_head()
+{
+ atf_set "descr" "Checks ECDH key agreement protocol"
+}
+ecdh_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_ecdhtest"
+}
+
+atf_test_case ecdsa
+ecdsa_head()
+{
+ atf_set "descr" "Checks ECDSA algorithm"
+}
+ecdsa_body()
+{
+ atf_check -o ignore -e ignore "$(atf_get_srcdir)/h_ecdsatest"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case dsa
+ atf_add_test_case dh
+ atf_add_test_case rsa
+ atf_add_test_case ec
+ atf_add_test_case ecdh
+ atf_add_test_case ecdsa
+}