- add flat plugin config filename path
[oweals/gnunet.git] / src / namestore / test_namestore_put.sh
1 #!/bin/bash
2 CONFIGURATION="test_namestore_api.conf"
3 trap "gnunet-arm -e -c $CONFIGURATION" SIGINT
4
5 LOCATION=$(which gnunet-config)
6 if [ -z $LOCATION ]
7 then
8   LOCATION="gnunet-config"
9 fi
10 $LOCATION --version 1> /dev/null
11 if test $? != 0
12 then
13         echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
14         exit 77
15 fi
16
17 rm -rf `$LOCATION -c $CONFIGURATION -s PATHS -o GNUNET_HOME`
18 TEST_DOMAIN_PLUS="www.gnu"
19 TEST_DOMAIN_DNS="www3.gnu"
20 TEST_IP_PLUS="127.0.0.1"
21 TEST_IP_DNS="131.159.74.67"
22 TEST_RECORD_CNAME_SERVER="server"
23 TEST_RECORD_CNAME_PLUS="server.+"
24 TEST_RECORD_CNAME_DNS="gnunet.org"
25 TEST_RECORD_NAME_SERVER="server"
26 TEST_RECORD_NAME_PLUS="www"
27 TEST_RECORD_NAME_DNS="www3"
28 which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
29
30 function start_peer
31 {
32         gnunet-arm -s -c $CONFIGURATION
33         gnunet-identity -C testego -c $CONFIGURATION
34 }
35
36 function stop_peer
37 {
38         gnunet-identity -D testego -c $CONFIGURATION
39         gnunet-arm -e -c $CONFIGURATION
40 }
41
42
43 start_peer
44 # Create a public record
45 gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t A -V $TEST_IP_PLUS -e never -c $CONFIGURATION
46 NAMESTORE_RES=$?
47 stop_peer
48
49 if [ $NAMESTORE_RES == 0 ]
50 then
51   echo "PASS: Creating name in namestore"
52 else
53   echo "FAIL: Creating name in namestore failed with $NAMESTORE_RES."
54   exit 1
55 fi