Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin adding argon2 tests



details:   https://anonhg.NetBSD.org/src/rev/4e243aff8097
branches:  trunk
changeset: 455316:4e243aff8097
user:      jhigh <jhigh%NetBSD.org@localhost>
date:      Mon Oct 14 03:47:19 2019 +0000

description:
adding argon2 tests

diffstat:

 tests/usr.bin/Makefile           |   7 +++-
 tests/usr.bin/argon2/Atffile     |   7 ++++
 tests/usr.bin/argon2/Makefile    |   8 ++++
 tests/usr.bin/argon2/t_argon2.sh |  70 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 91 insertions(+), 1 deletions(-)

diffs (116 lines):

diff -r f0188ab45230 -r 4e243aff8097 tests/usr.bin/Makefile
--- a/tests/usr.bin/Makefile    Mon Oct 14 01:15:32 2019 +0000
+++ b/tests/usr.bin/Makefile    Mon Oct 14 03:47:19 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.28 2019/10/05 18:06:16 jhigh Exp $
+#      $NetBSD: Makefile,v 1.29 2019/10/14 03:47:19 jhigh Exp $
 #
 
 .include <bsd.own.mk>
@@ -15,4 +15,9 @@
 TESTS_SUBDIRS+=        c++
 .endif
 
+.if (defined(MKARGON2) && ${MKARGON2} != "no")
+TESTS_SUBDIRS+=        argon2
+.endif
+
+
 .include <bsd.test.mk>
diff -r f0188ab45230 -r 4e243aff8097 tests/usr.bin/argon2/Atffile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/argon2/Atffile      Mon Oct 14 03:47:19 2019 +0000
@@ -0,0 +1,7 @@
+Content-Type: application/X-atf-atffile; version="1"
+
+# Automatically generated by bsd.test.mk.
+
+prop: test-suite = "NetBSD"
+
+tp: t_argon2
diff -r f0188ab45230 -r 4e243aff8097 tests/usr.bin/argon2/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/argon2/Makefile     Mon Oct 14 03:47:19 2019 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2019/10/14 03:47:20 jhigh Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/usr.bin/argon2
+TESTS_SH=      t_argon2
+
+.include <bsd.test.mk>
diff -r f0188ab45230 -r 4e243aff8097 tests/usr.bin/argon2/t_argon2.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/argon2/t_argon2.sh  Mon Oct 14 03:47:19 2019 +0000
@@ -0,0 +1,70 @@
+atf_test_case argon2_argon2id 
+argon2_argon2id_head() {
+       atf_set "descr" "ATF test for argon2 argon2id variant"
+}
+
+argon2_argon2id_body() {
+       atf_check -s exit:0 -o match:"^\\\$argon2id\\\$" -x \
+               'echo -n 'password' | argon2 somesalt -e -id'
+}
+
+atf_test_case argon2_argon2i
+argon2_argon2i_head() {
+       atf_set "descr" "ATF test for argon2 argon2i variant"
+}
+
+argon2_argon2i_body() {
+       atf_check -s exit:0 -o match:"^\\\$argon2i\\\$" -x \
+               'echo -n 'password' | argon2 somesalt -e -i'
+}
+
+atf_test_case argon2_argon2d
+argon2_argon2d_head() {
+       atf_set "descr" "ATF test for argon2 argon2d variant"
+}
+
+argon2_argon2d_body() {
+       atf_check -s exit:0 -o match:"^\\\$argon2d\\\$" -x \
+               'echo -n 'password' | argon2 somesalt -e -d'
+}
+
+atf_test_case argon2_argon2id_k2096_p2_t3
+argon2_argon2id_k2096_p2_head() {
+       atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=2,t=3 "
+}
+
+argon2_argon2id_k2096_p2_t3_body() {
+       atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=19\\\$m=2096,t=3,p=2" -x \
+               'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 2 -t 3'
+}
+
+atf_test_case argon2_argon2i_k2096_p1_t4
+argon2_argon2i_k2096_p1_t4_head() {
+       atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,t=4 "
+}
+
+argon2_argon2i_k2096_p1_t4_body() {
+       atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=19\\\$m=2096,t=4,p=1" -x \
+               'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -t 4'
+}
+
+atf_test_case argon2_argon2d_k2096_p2_t4
+argon2_argon2d_k2096_p2_t4_head() {
+       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=2,t=4"
+}
+
+argon2_argon2d_k2096_p2_t4_body() {
+       atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=19\\\$m=2096,t=4,p=2" -x \
+               'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 2 -t 4'
+}
+
+
+atf_init_test_cases()
+{
+       atf_add_test_case argon2_argon2id
+       atf_add_test_case argon2_argon2i
+       atf_add_test_case argon2_argon2d
+       atf_add_test_case argon2_argon2id_k2096_p2_t3
+       atf_add_test_case argon2_argon2i_k2096_p1_t4
+       atf_add_test_case argon2_argon2d_k2096_p2_t4
+}



Home | Main Index | Thread Index | Old Index