diff options
Diffstat (limited to 'src/cli/namestore/test_namestore_put_stdin.sh')
-rwxr-xr-x | src/cli/namestore/test_namestore_put_stdin.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/cli/namestore/test_namestore_put_stdin.sh b/src/cli/namestore/test_namestore_put_stdin.sh new file mode 100755 index 000000000..deb7bc4cb --- /dev/null +++ b/src/cli/namestore/test_namestore_put_stdin.sh | |||
@@ -0,0 +1,68 @@ | |||
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="www3" | ||
19 | TEST_RECORD_NAME2="www" | ||
20 | TEST_IP="8.7.6.5" | ||
21 | TEST_IP2="1.2.3.4" | ||
22 | |||
23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | ||
24 | |||
25 | function start_peer | ||
26 | { | ||
27 | gnunet-arm -s -c $CONFIGURATION | ||
28 | gnunet-identity -C testego -c $CONFIGURATION | ||
29 | gnunet-identity -C testego2 -c $CONFIGURATION | ||
30 | } | ||
31 | |||
32 | function stop_peer | ||
33 | { | ||
34 | gnunet-identity -D testego -c $CONFIGURATION | ||
35 | gnunet-identity -D testego2 -c $CONFIGURATION | ||
36 | gnunet-arm -e -c $CONFIGURATION | ||
37 | } | ||
38 | |||
39 | |||
40 | start_peer | ||
41 | # Create a public record | ||
42 | EGOKEY=`gnunet-identity -d | grep testego2 | cut -d' ' -f3` | ||
43 | gnunet-namestore -a -c $CONFIGURATION -S <<EOF | ||
44 | $TEST_RECORD_NAME.testego: | ||
45 | A 3600000000 [pr] $TEST_IP | ||
46 | TXT 21438201833 [r] $TEST_IP2 | ||
47 | |||
48 | TXT 21438201833 [r] aslkdj asdlkjaslkd 232! | ||
49 | |||
50 | $TEST_RECORD_NAME2.testego: | ||
51 | AAAA 324241223 [prS] ::dead:beef | ||
52 | A 111324241223000000 [pC] 1.1.1.1 | ||
53 | |||
54 | www7.$EGOKEY: | ||
55 | A 3600000000 [pr] $TEST_IP | ||
56 | |||
57 | EOF | ||
58 | NAMESTORE_RES=$? | ||
59 | gnunet-namestore -D -r -c $CONFIGURATION | ||
60 | stop_peer | ||
61 | |||
62 | if [ $NAMESTORE_RES = 0 ] | ||
63 | then | ||
64 | echo "PASS: Creating name in namestore" | ||
65 | else | ||
66 | echo "FAIL: Creating name in namestore failed with $NAMESTORE_RES." | ||
67 | exit 1 | ||
68 | fi | ||