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.sh135
1 files changed, 135 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..03c313a7b
--- /dev/null
+++ b/src/cli/gns/test_gns_lightest.sh
@@ -0,0 +1,135 @@
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"
19MY_EGO="test-lightest"
20LABEL="test-scheme"
21PTR_LABEL="test-ptr"
22TEST_URI="10 1 \"https://ec.europa.eu/tools/lotl/eu-lotl.xml\""
23TEST_SMIMEA="3 0 1 f7e8e4e554fb7c7a8f6f360e0ca2f59d466c8f9539a25963f5ed37e905f0c797"
24SCHEME="_scheme"
25TRUST="_trust"
26TRUSTLIST="_trustlist"
27TEST_PTR="$SCHEME.$TRUST.$LABEL.$MY_EGO"
28TEST_PTR2="$TRUSTLIST.$TRUST.$LABEL.$MY_EGO"
29gnunet-arm -s -c test_gns_lookup.conf
30gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
31gnunet-namestore -p -z $MY_EGO -a -n $PTR_LABEL -t BOX -V "242 1003 12 $TEST_PTR" -e never -c test_gns_lookup.conf
32gnunet-namestore -p -z $MY_EGO -a -n $PTR_LABEL -t BOX -V "242 1002 12 $TEST_PTR2" -e never -c test_gns_lookup.conf
33gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "242 1003 256 $TEST_URI" -e never -c test_gns_lookup.conf
34gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "242 1003 53 $TEST_SMIMEA" -e never -c test_gns_lookup.conf
35gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "242 1002 256 $TEST_URI" -e never -c test_gns_lookup.conf
36gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "242 1002 53 $TEST_SMIMEA" -e never -c test_gns_lookup.conf
37sleep 0.5
38PTR_SCHEME=`$DO_TIMEOUT gnunet-gns --raw -u $SCHEME.$TRUST.$PTR_LABEL.$MY_EGO -t PTR -c test_gns_lookup.conf`
39PTR_TRUSTLIST=`$DO_TIMEOUT gnunet-gns --raw -u $TRUSTLIST.$TRUST.$PTR_LABEL.$MY_EGO -t PTR -c test_gns_lookup.conf`
40
41SUCCESS=0
42if [ "$PTR_SCHEME" != "$TEST_PTR" ]
43then
44 echo "Failed to resolve to proper PTR, got '$PTR_SCHEME'."
45 SUCCESS=1
46else
47 echo "Resolved to proper PTR, got '$PTR_SCHEME'."
48fi
49
50if [ "$PTR_TRUSTLIST" != "$TEST_PTR2" ]
51then
52 echo "Failed to resolve to proper PTR, got '$PTR_TRUSTLIST'."
53 SUCCESS=1
54else
55 echo "Resolved to proper PTR, got '$PTR_TRUSTLIST'."
56fi
57
58if [ "$SUCCESS" = "1" ]
59then
60 gnunet-namestore -z $MY_EGO -X -c test_gns_lookup.conf
61 gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
62 gnunet-arm -e -c test_gns_lookup.conf
63 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
64 exit 1
65fi
66
67
68RES_URI_SCHEME=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_SCHEME -t URI -c test_gns_lookup.conf`
69RES_SMIMEA_SCHEME=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_SCHEME -t SMIMEA -c test_gns_lookup.conf`
70
71RES_URI_TRUSTLIST=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_TRUSTLIST -t URI -c test_gns_lookup.conf`
72RES_SMIMEA_TRUSTLIST=`$DO_TIMEOUT gnunet-gns --raw -u $PTR_TRUSTLIST -t SMIMEA -c test_gns_lookup.conf`
73
74
75if [ "$RES_URI_SCHEME" != "$TEST_URI" ]
76then
77 echo "Failed to resolve to proper URI, got '$RES_URI_SCHEME'."
78 SUCCESS=1
79else
80 echo "Resolved to proper URI, got '$RES_URI_SCHEME'."
81fi
82
83if [ "$RES_SMIMEA_SCHEME" != "$TEST_SMIMEA" ]
84then
85 echo "Failed to resolve to proper SMIMEA, got '$RES_SMIMEA_SCHEME'."
86 SUCCESS=1
87else
88 echo "Resolved to proper SMIMEA, got '$RES_SMIMEA_SCHEME'."
89fi
90
91if [ "$RES_URI_TRUSTLIST" != "$TEST_URI" ]
92then
93 echo "Failed to resolve to proper URI, got '$RES_URI_TRUSTLIST'."
94 SUCCESS=1
95else
96 echo "Resolved to proper URI, got '$RES_URI_TRUSTLIST'."
97fi
98
99if [ "$RES_SMIMEA_TRUSTLIST" != "$TEST_SMIMEA" ]
100then
101 echo "Failed to resolve to proper SMIMEA, got '$RES_SMIMEA_TRUSTLIST'."
102 SUCCESS=1
103else
104 echo "Resolved to proper SMIMEA, got '$RES_SMIMEA_TRUSTLIST'."
105fi
106
107gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "242 1003 256 10 1 \"thisisnotavaliduri\"" -e never -c test_gns_lookup.conf
108status=$?
109gnunet-namestore -p -z $MY_EGO -a -n $LABEL -t BOX -V "242 1003 256 10 1 mailto:thisrecordismilformed@test.com" -e never -c test_gns_lookup.conf
110status2=$?
111
112if [ "$status" = "0" ]
113then
114 echo "Failed to detect malformed URI."
115 SUCCESS=1
116else
117 echo "Detected malformed URI."
118fi
119
120if [ "$status2" = "0" ]
121then
122 echo "Failed to detect malformed URI Record Presentation."
123 SUCCESS=1
124else
125 echo "Detected malformed URI Presentation."
126fi
127
128
129
130gnunet-namestore -z $MY_EGO -X -c test_gns_lookup.conf
131gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
132gnunet-arm -e -c test_gns_lookup.conf
133rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
134
135exit $SUCCESS \ No newline at end of file