more work on the sp_test
[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-scalarproduct`date +%H%M%S`
5 CFGALICE="-c $GNUNET_TESTING_PREFIX/0/config"
6 CFGBOB="-c $GNUNET_TESTING_PREFIX/1/config"
7
8 ../testbed/gnunet-testbed-profiler -c test_scalarproduct.conf -p 2 2>gnunet_error.log &
9 sleep 5
10
11 PEERIDBOB=`gnunet-peerinfo -qs $CFGB`
12 INPUTALICE="-k AAAA -e 10,10,10"
13 INPUTBOB="-k AAAA -e 10,10,10"
14 EXPECTED="2C0"
15
16 gnunet-scalarproduct $CFGBOB $INPUTBOB
17 RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>client_error.log`
18
19 if [ "$RESULT" == "$EXPECTED" ]
20 then
21   echo "OK"
22   exit 0
23 else
24   echo "Result $RESULT NOTOK"
25   exit 1
26 fi
27