fixed type in SP-test template
[oweals/gnunet.git] / src / scalarproduct / test_scalarproduct.sh
1 #!/bin/bash
2 # compute a simple scalar product
3 # payload for this test:
4 INPUTALICE="-k AAAA -e 10,10,10"
5 INPUTBOB="-k AAAA -e 10,10,10"
6
7 # necessary to make the testing prefix deterministic, so we can access the config files
8 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
9
10 # where can we find the peers config files?
11 CFGALICE="-c $PREFIX/0/config"
12 CFGBOB="-c $PREFIX/1/config"
13
14 # launch two peers in line topology non-interactively
15 #
16 # interactive mode would terminate the test immediately 
17 # because the rest of the script is already in stdin, 
18 # thus redirecting stdin does not suffice)
19 GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 2>service.log &
20 sleep 5
21
22 # get bob's peer ID, necessary for alice
23 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
24
25 GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log &
26 GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log
27
28 # termiante the testbed
29 kill $( pgrep -P $$ | tr '\n' ' ' )
30 #rm alice.log bob.log service.log
31
32 EXPECTED="12C"
33 if [ "$RESULT" == "$EXPECTED" ]
34 then
35   echo "OK"
36   exit 0
37 else
38   echo "Result $RESULT NOTOK"
39   exit 1
40 fi
41