updated test-config template for scalarproduct
[oweals/gnunet.git] / src / scalarproduct / test_scalarproduct.sh
1 #!/bin/bash
2
3 #necessary to make the testing prefix deterministic, so we can access the config files
4 GNUNET_TESTING_PREFIX=/tmp/test-scalarproduct1337
5 CFGA="-c ./test_scalarproduct_alice.conf"
6 CFGB="-c ./test_scalarproduct_bob.conf"
7                                         #can't use ` directly
8 SESSIONDATA="-k AAAA -e 10,10,10"
9 EXPECTED="2C0"
10
11 gnunet-arm -s $CFGA
12 sleep 2
13 gnunet-arm -s $CFGB
14 sleep 2
15
16 IDB=`gnunet-peerinfo -s $CFGB | awk -F "\x60" '{print $2}' | awk -F "'" '{print $1}'`
17
18 gnunet-scalarproduct $CFGB $SESSIONDATA
19
20 RESULT=`gnunet-scalarproduct $CFGA $SESSIONDATA -p $IDB`
21
22 gnunet-arm -e $CFGA &
23 gnunet-arm -e $CFGB &
24
25 if [ "$RESULT" == "$EXPECTED" ]
26 then
27   echo "OK"
28   exit 0
29 else
30   echo "Result $RESULT NOTOK"
31   exit 1
32 fi
33