aboutsummaryrefslogtreecommitdiff
path: root/src/cli/gns/test_gns_lightest.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/gns/test_gns_lightest.sh')
-rwxr-xr-xsrc/cli/gns/test_gns_lightest.sh141
1 files changed, 141 insertions, 0 deletions
diff --git a/src/cli/gns/test_gns_lightest.sh b/src/cli/gns/test_gns_lightest.sh
new file mode 100755
index 000000000..2d2203e66
--- /dev/null
+++ b/src/cli/gns/test_gns_lightest.sh
@@ -0,0 +1,141 @@
1#!/bin/sh
2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" INT
4
5LOCATION=$(which gnunet-config)
6if [ -z $LOCATION ]
7then
8 LOCATION="gnunet-config"
9fi
10$LOCATION --version 1> /dev/null
11if test $? != 0
12then
13 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
14 exit 77
15fi
16
17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
18which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
19START_EGO="startego"
20MY_EGO="test-lightest"
21LABEL="test-scheme"
22PTR_LABEL="test-ptr"
23TEST_URI="10 1 \"https://ec.europa.eu/tools/lotl/eu-lotl.xml\""
24TEST_SMIMEA="3 0 1 f7e8e4e554fb7c7a8f6f360e0ca2f59d466c8f9539a25963f5ed37e905f0c797"
25SCHEME="_scheme"
26TRUST="_trust"
27TRANSLATION="_translation"
28TEST_PTR="$SCHEME.$TRUST.$LABEL.$MY_EGO.$START_EGO"
29TEST_PTR2="$TRANSLATION.$TRUST.$LABEL.$MY_EGO.$START_EGO"
30gnunet-arm -s -c test_gns_lookup.conf
31gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
32gnunet-identity -C $START_EGO -c test_gns_lookup.conf
33PKEY=`gnunet-identity -d -e $MY_EGO -q -c test_gns_lookup.conf`
34gnunet-namestore -p -z $MY_EGO -a -n $PTR_LABEL -t BOX -V "49152 49152 12 $TEST_PTR" -e never -c test_gns_lookup.conf
35gnunet-namestore -p -z $MY_EGO -a -n $PTR_LABEL -t BOX -V "49152 49153 12 $TEST_PTR2" -e never -c test_gns_lookup.conf
36gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "49152 49152 256 $TEST_URI" -e never -c test_gns_lookup.conf
37gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "49152 49152 53 $TEST_SMIMEA" -e never -c test_gns_lookup.conf
38gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "49152 49153 256 $TEST_URI" -e never -c test_gns_lookup.conf
39gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "49152 49153 53 $TEST_SMIMEA" -e never -c test_gns_lookup.conf
40gnunet-namestore -p -z $START_EGO -a -n $MY_EGO -t PKEY -V "$PKEY" -e never -c test_gns_lookup.conf
41sleep 0.5
42PTR_SCHEME=`$DO_TIMEOUT gnunet-gns --raw -u $SCHEME.$TRUST.$PTR_LABEL.$MY_EGO.$START_EGO -t PTR -c test_gns_lookup.conf`
43PTR_TRANSLATION=`$DO_TIMEOUT gnunet-gns --raw -u $TRANSLATION.$TRUST.$PTR_LABEL.$MY_EGO.$START_EGO -t PTR -c test_gns_lookup.conf`
44
45SUCCESS=0
46if [ "$PTR_SCHEME" != "$TEST_PTR" ]
47then
48 echo "Failed to resolve to proper PTR, got '$PTR_SCHEME'."
49 SUCCESS=1
50else
51 echo "Resolved to proper PTR, got '$PTR_SCHEME'."
52fi
53
54if [ "$PTR_TRANSLATION" != "$TEST_PTR2" ]
55then
56 echo "Failed to resolve to proper PTR, got '$PTR_TRANSLATION'."
57 SUCCESS=1
58else
59 echo "Resolved to proper PTR, got '$PTR_TRANSLATION'."
60fi
61
62if [ "$SUCCESS" = "1" ]
63then
64 gnunet-namestore -z $MY_EGO -X -c test_gns_lookup.conf
65 gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
66 gnunet-arm -e -c test_gns_lookup.conf
67 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
68 exit 1
69fi
70
71
72RES_URI_SCHEME=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_SCHEME -t URI -c test_gns_lookup.conf`
73RES_SMIMEA_SCHEME=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_SCHEME -t SMIMEA -c test_gns_lookup.conf`
74
75RES_URI_TRANSLATION=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_TRANSLATION -t URI -c test_gns_lookup.conf`
76RES_SMIMEA_TRANSLATION=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_TRANSLATION -t SMIMEA -c test_gns_lookup.conf`
77
78
79if [ "$RES_URI_SCHEME" != "$TEST_URI" ]
80then
81 echo "Failed to resolve to proper URI, got '$RES_URI_SCHEME'."
82 SUCCESS=1
83else
84 echo "Resolved to proper URI, got '$RES_URI_SCHEME'."
85fi
86
87if [ "$RES_SMIMEA_SCHEME" != "$TEST_SMIMEA" ]
88then
89 echo "Failed to resolve to proper SMIMEA, got '$RES_SMIMEA_SCHEME'."
90 SUCCESS=1
91else
92 echo "Resolved to proper SMIMEA, got '$RES_SMIMEA_SCHEME'."
93fi
94
95if [ "$RES_URI_TRANSLATION" != "$TEST_URI" ]
96then
97 echo "Failed to resolve to proper URI, got '$RES_URI_TRANSLATION'."
98 SUCCESS=1
99else
100 echo "Resolved to proper URI, got '$RES_URI_TRANSLATION'."
101fi
102
103if [ "$RES_SMIMEA_TRANSLATION" != "$TEST_SMIMEA" ]
104then
105 echo "Failed to resolve to proper SMIMEA, got '$RES_SMIMEA_TRANSLATION'."
106 SUCCESS=1
107else
108 echo "Resolved to proper SMIMEA, got '$RES_SMIMEA_TRANSLATION'."
109fi
110
111gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "49152 49152 256 10 1 \"thisisnotavaliduri\"" -e never -c test_gns_lookup.conf
112status=$?
113gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "49152 49152 256 10 1 mailto:thisrecordismalformed@test.com" -e never -c test_gns_lookup.conf
114status2=$?
115
116if [ "$status" = "0" ]
117then
118 echo "Failed to detect malformed URI."
119 SUCCESS=1
120else
121 echo "Detected malformed URI."
122fi
123
124if [ "$status2" = "0" ]
125then
126 echo "Failed to detect malformed URI Record Presentation."
127 SUCCESS=1
128else
129 echo "Detected malformed URI Presentation."
130fi
131
132
133
134gnunet-namestore -z $MY_EGO -X -c test_gns_lookup.conf
135gnunet-namestore -z $START_EGO -X -c test_gns_lookup.conf
136gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
137gnunet-identity -D $START_EGO -c test_gns_lookup.conf
138gnunet-arm -e -c test_gns_lookup.conf
139rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
140
141exit $SUCCESS \ No newline at end of file