-improve indentation, reduce duplication of PIDs in core's neighbour map
[oweals/gnunet.git] / src / scalarproduct / test_scalarproduct.sh
index 4a3b77428fba4f4d6c930f90067e2d07d3095728..dd9bb80a5490ed41e5c1d65c4f4bd19e41cd1bf0 100755 (executable)
@@ -1,8 +1,9 @@
 #!/bin/bash
 # compute a simple scalar product
 # payload for this test:
-INPUTALICE="-k CCC -e 3,3,-1"
-INPUTBOB="-k CCC -e 1000,100,24"
+INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'"
+INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'"
+EXPECTED="0CCC"
 
 # necessary to make the testing prefix deterministic, so we can access the config files
 PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
@@ -16,30 +17,31 @@ CFGBOB="-c $PREFIX/1/config"
 # interactive mode would terminate the test immediately
 # because the rest of the script is already in stdin,
 # thus redirecting stdin does not suffice)
-#GNUNET_LOG='scalarproduct;;;;DEBUG'
+# GNUNET_FORCE_LOG='scalarproduct*;;;;DEBUG'
 GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
 PID=$!
 # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
+echo "Waiting for peers to start..."
 sleep 5
+echo "Running test..."
 
 # get bob's peer ID, necessary for alice
 PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
 
 #GNUNET_LOG=';;;;DEBUG'
 gnunet-scalarproduct $CFGBOB $INPUTBOB &
-GNUNET_LOG=';;;;DEBUG'
+#GNUNET_LOG=';;;;DEBUG'
 RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
 
 # terminate the testbed
 kill $PID
 
-EXPECTED="0CCC"
 if [ "$RESULT" == "$EXPECTED" ]
 then
        echo "OK"
        exit 0
 else
-       echo "Result $RESULT NOTOK"
+       echo "Result $RESULT, expected $EXPECTED - NOTOK"
        exit 1
 fi