complete testcase template, currently functionally blocked by two issues in the testb...
[oweals/gnunet.git] / src / scalarproduct / test_scalarproduct.sh
1 #!/bin/bash
2 # compute a simple scalar product
3
4 #necessary to make the testing prefix deterministic, so we can access the config files
5 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
6
7 #where can we find the peers config files?
8 CFGALICE="-c $PREFIX/0/config"
9 CFGBOB="-c $PREFIX/1/config"
10
11 #log at which loglevel?
12 LOG="-L ERROR"
13
14 #launch two peers in line topology
15 GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler $LOG -c test_scalarproduct.conf -p 2 2>gnunet_error.log &
16 sleep 5
17
18 #get bob's peer ID, necessary for alice
19 PEERIDBOB=`gnunet-peerinfo -qs $CFGB`
20
21 #payload for this test on both sides
22 INPUTALICE="-k AAAA -e 10,10,10"
23 INPUTBOB="-k AAAA -e 10,10,10"
24
25 echo "gnunet-scalarproduct $LOG $CFGBOB $INPUTBOB &"
26 echo "gnunet-scalarproduct $LOG $CFGALICE $INPUTALICE -p $PEERIDBOB -L ERROR"
27 gnunet-scalarproduct $LOG $CFGBOB $INPUTBOB 2>bob_error.log &
28 RESULT=`gnunet-scalarproduct $LOG $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice_error.log`
29
30 EXPECTED="12C"
31 if [ "$RESULT" == "$EXPECTED" ]
32 then
33   echo "OK"
34   exit 0
35 else
36   echo "Result $RESULT NOTOK"
37   exit 1
38 fi
39