diff options
Diffstat (limited to 'src/cli/namestore/test_namestore_box_lightest.sh')
-rwxr-xr-x | src/cli/namestore/test_namestore_box_lightest.sh | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/cli/namestore/test_namestore_box_lightest.sh b/src/cli/namestore/test_namestore_box_lightest.sh new file mode 100755 index 000000000..3c8ad2799 --- /dev/null +++ b/src/cli/namestore/test_namestore_box_lightest.sh | |||
@@ -0,0 +1,63 @@ | |||
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_RECORD_NAME_DNS="trust" | ||
19 | TEST_RECORD_VALUE_SMIMEA="49152 49153 53 0 0 1 d2abde240d7cd3ee6b4b28c54df034b97983a1d16e8a410e4561cb106618e971" | ||
20 | TEST_RECORD_VALUE_URI="49152 49152 256 10 10 \"http://lightest.nletlabs.nl/\"" | ||
21 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | ||
22 | |||
23 | function start_peer | ||
24 | { | ||
25 | gnunet-arm -s -c $CONFIGURATION | ||
26 | gnunet-identity -C testego -c $CONFIGURATION | ||
27 | } | ||
28 | |||
29 | function stop_peer | ||
30 | { | ||
31 | gnunet-identity -D testego -c $CONFIGURATION | ||
32 | gnunet-arm -e -c $CONFIGURATION | ||
33 | } | ||
34 | |||
35 | |||
36 | start_peer | ||
37 | # Create a public SMIMEA record | ||
38 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t BOX -V "$TEST_RECORD_VALUE_SMIMEA" -e never -c $CONFIGURATION | ||
39 | NAMESTORE_RES=$? | ||
40 | |||
41 | if [ $NAMESTORE_RES = 0 ] | ||
42 | then | ||
43 | echo "PASS: Creating boxed name in namestore SMIMEA" | ||
44 | else | ||
45 | echo "FAIL: Creating boxed name in namestore failed with $NAMESTORE_RES." | ||
46 | stop_peer | ||
47 | exit 1 | ||
48 | fi | ||
49 | |||
50 | # Create a public URI record | ||
51 | gnunet-namestore -p -z testego -a -n $TEST_RECORD_NAME_DNS -t BOX -V "$TEST_RECORD_VALUE_URI" -e never -c $CONFIGURATION | ||
52 | NAMESTORE_RES=$? | ||
53 | |||
54 | if [ $NAMESTORE_RES = 0 ] | ||
55 | then | ||
56 | echo "PASS: Creating boxed name in namestore URI" | ||
57 | else | ||
58 | echo "FAIL: Creating boxed name in namestore failed with $NAMESTORE_RES." | ||
59 | stop_peer | ||
60 | exit 1 | ||
61 | fi | ||
62 | |||
63 | stop_peer \ No newline at end of file | ||