[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 24/171: -add tests
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 24/171: -add tests |
Date: |
Thu, 04 Jan 2018 16:08:52 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit ad04c24e83c23302b73b176f4d36603e7d8f1134
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Dec 5 20:50:48 2016 +0100
-add tests
---
src/credential/test_credential_issue.sh | 43 ++++++++++++++++++++
src/credential/test_credential_verify_simple.sh | 52 +++++++++++++++++++++++++
2 files changed, 95 insertions(+)
diff --git a/src/credential/test_credential_issue.sh
b/src/credential/test_credential_issue.sh
new file mode 100755
index 000000000..a78bde6ed
--- /dev/null
+++ b/src/credential/test_credential_issue.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
+
+LOCATION=$(which gnunet-config)
+if [ -z $LOCATION ]
+then
+ LOCATION="gnunet-config"
+fi
+$LOCATION --version 1> /dev/null
+if test $? != 0
+then
+ echo "GNUnet command line tools cannot be found, check environmental
variables PATH and GNUNET_PREFIX"
+ exit 77
+fi
+
+rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME
-f`
+
+# (1) PKEY1.user -> PKEY2.resu.user
+# (2) PKEY2.resu -> PKEY3
+# (3) PKEY3.user -> PKEY4
+
+
+which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
+
+TEST_ATTR="test"
+gnunet-arm -s -c test_credential_lookup.conf
+gnunet-identity -C testissuer -c test_credential_lookup.conf
+gnunet-identity -C testsubject -c test_credential_lookup.conf
+SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep
testsubject | awk '{print $3}')
+ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep
testissuer | awk '{print $3}')
+EXPECTED="$SUBJECT_KEY $ISSUER_KEY $TEST_ATTR"
+#TODO1 Get credential and store it with subject (3)
+CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer
--subject=$SUBJECT_KEY --attribute=$TEST_ATTR -c test_credential_lookup.conf`
+
+gnunet-arm -e -c test_credential_lookup.conf
+
+if [ "$EXPECTED" == "$CRED" ]
+then
+ exit 0
+else
+ echo "FAIL: Failed to issue credential, got $CRED."
+ exit 1
+fi
diff --git a/src/credential/test_credential_verify_simple.sh
b/src/credential/test_credential_verify_simple.sh
new file mode 100755
index 000000000..73ea24137
--- /dev/null
+++ b/src/credential/test_credential_verify_simple.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
+
+LOCATION=$(which gnunet-config)
+if [ -z $LOCATION ]
+then
+ LOCATION="gnunet-config"
+fi
+$LOCATION --version 1> /dev/null
+if test $? != 0
+then
+ echo "GNUnet command line tools cannot be found, check environmental
variables PATH and GNUNET_PREFIX"
+ exit 77
+fi
+
+rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME
-f`
+
+# (3) Isser.user -> Subject
+
+
+which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
+gnunet-arm -s -c test_credential_lookup.conf
+gnunet-identity -C testissuer -c test_credential_lookup.conf
+gnunet-identity -C testsubject -c test_credential_lookup.conf
+
+TEST_ATTR="user"
+SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep
testsubject | awk '{print $3}')
+ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep
testissuer | awk '{print $3}')
+CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer
--subject=$SUBJECT_KEY --attribute=$TEST_ATTR -c test_credential_lookup.conf`
+
+TEST_CREDENTIAL="t1"
+gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED"
-e 5m -c test_credential_lookup.conf
+
+#TODO2 Add -z swich like in gnunet-gns
+#RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY
--attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL
-c test_credential_lookup.conf`
+valgrind gnunet-credential --verify --issuer=$ISSUER_KEY
--attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c
test_credential_lookup.conf
+
+#TODO cleanup properly
+gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c
test_credential_lookup.conf
+gnunet-identity -D testsubject -c test_credential_lookup.conf
+gnunet-arm -e -c test_credential_lookup.conf
+
+#TODO3 proper test
+exit 0
+
+if [ "$RES_CRED" == "Ok!" ]
+then
+ exit 0
+else
+ echo "FAIL: Failed to verify credential $RES_IP."
+ exit 1
+fi
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 19/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, (continued)
- [GNUnet-SVN] [gnunet] 19/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 20/171: -fix compile, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 18/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 27/171: - remove purpose from cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 25/171: -fix verifymessage, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 16/171: -update test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 21/171: - add verify and issue to cli, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 03/171: - move towards verification, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 14/171: -cleanup cli tool, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 22/171: -add issue test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 24/171: -add tests,
gnunet <=
- [GNUnet-SVN] [gnunet] 29/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 36/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 26/171: - add signature to cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 28/171: - starting backward resolution, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 31/171: Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 41/171: - fix test, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 34/171: - minor fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 33/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 32/171: -add expiration to cred, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 42/171: -add confs, gnunet, 2018/01/04