aboutsummaryrefslogtreecommitdiff
path: root/src/credential/test_credential_lookup.sh
blob: 216c281d7a0c3a4d99c7d21308577b968da4044e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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`
which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
TEST_CREDENTIAL="keySub keyIss credName"
gnunet-arm -s -c test_credential_lookup.conf
gnunet-identity -C testsubject -c test_credential_lookup.conf

#TODO1 Plugin serialization functions see REVERSE in gns/plugin_gnsrecord_gns.c
gnunet-namestore -p -z testsubject -a -n newcred -t CRED -V $TEST_CREDENTIAL -e never -c test_credential_lookup.conf

#TODO2 Add -z swich like in gnunet-gns
RES_IP=`$DO_TIMEOUT gnunet-credential -z testsubject -s testsubject -u credName -c test_credential_lookup.conf`
gnunet-namestore -z testsubject -d -n newcred -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_IP" == "$TEST_CRED" ]
#then
#  exit 0
#else
#  echo "FAIL: Failed to resolve to proper IP, got $RES_IP."
#  exit 1
#fi