diff options
Diffstat (limited to 'src/identity/test_identity_messages.sh')
-rwxr-xr-x | src/identity/test_identity_messages.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/identity/test_identity_messages.sh b/src/identity/test_identity_messages.sh new file mode 100755 index 000000000..250c6a6f1 --- /dev/null +++ b/src/identity/test_identity_messages.sh | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/bin/bash | ||
2 | trap "gnunet-arm -e -c test_identity.conf" SIGINT | ||
3 | |||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1> /dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_identity.conf -s PATHS -o GNUNET_HOME -f` | ||
17 | |||
18 | which timeout >/dev/null 2>&1 && DO_TIMEOUT="timeout 30" | ||
19 | |||
20 | TEST_MSG="This is a test message. 123" | ||
21 | gnunet-arm -s -c test_identity.conf | ||
22 | gnunet-identity -C recipientego -c test_identity.conf | ||
23 | RECIPIENT_KEY=$(gnunet-identity -d -e recipientego -q -c test_identity.conf) | ||
24 | MSG_ENC=$(gnunet-identity -W "$TEST_MSG" -k $RECIPIENT_KEY -c test_identity.conf) | ||
25 | MSG_DEC=$(gnunet-identity -R "$MSG_ENC" -e recipientego -c test_identity.conf) | ||
26 | |||
27 | if test "$TEST_MSG" != "$MSG_DEC" | ||
28 | then | ||
29 | echo "Failed - $TEST_MSG != $MSG_DEC" | ||
30 | exit 1 | ||
31 | fi | ||
32 | |||
33 | gnunet-identity -D recipientego -c test_identity.conf | ||
34 | gnunet-arm -e -c test_identity.conf | ||