2 # compute a simple scalar product
3 # payload for this test:
4 INPUTALICE="-k CCC -e 'AB,10;RO,-3;FL,-3;LOL,1;'"
5 INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'"
7 # necessary to make the testing prefix deterministic, so we can access the config files
8 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
10 # where can we find the peers config files?
11 CFGALICE="-c $PREFIX/0/config"
12 CFGBOB="-c $PREFIX/1/config"
14 which timeout &> /dev/null && DO_TIMEOUT="timeout 15"
16 # launch two peers in line topology non-interactively
18 # interactive mode would terminate the test immediately
19 # because the rest of the script is already in stdin,
20 # thus redirecting stdin does not suffice)
21 #GNUNET_LOG='scalarproduct;;;;DEBUG'
22 GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
24 # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
27 # get bob's peer ID, necessary for alice
28 PEERIDBOB=`${DO_TIMEOUT} gnunet-peerinfo -qs $CFGBOB`
30 #GNUNET_LOG=';;;;DEBUG'
31 ${DO_TIMEOUT} gnunet-scalarproduct $CFGBOB $INPUTBOB &
32 #RESULT=`GNUNET_LOG=';;;;DEBUG'
33 RESULT=`${DO_TIMEOUT} gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
35 # terminate the testbed
39 if [ "$RESULT" == "$EXPECTED" ]
44 echo "Result $RESULT, expected $EXPECTED NOTOK"