- debug
[oweals/gnunet.git] / src / scalarproduct / test_scalarproduct.sh
index 0ac0d82fcb0997e5d666886b29b2a4fa92404a40..29f78ef9bd8a8dca53f28eba3511c6847820fa99 100755 (executable)
@@ -1,21 +1,33 @@
 #!/bin/bash
+# compute a simple scalar product
 
 #necessary to make the testing prefix deterministic, so we can access the config files
-GNUNET_TESTING_PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
-CFGALICE="-c $GNUNET_TESTING_PREFIX/0/config"
-CFGBOB="-c $GNUNET_TESTING_PREFIX/1/config"
+PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
 
-../testbed/gnunet-testbed-profiler -c test_scalarproduct.conf -p 2 2>gnunet_error.log &
+#where can we find the peers config files?
+CFGALICE="-c $PREFIX/0/config"
+CFGBOB="-c $PREFIX/1/config"
+
+#log at which loglevel?
+LOG="-L ERROR"
+
+#launch two peers in line topology
+GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler $LOG -c test_scalarproduct.conf -p 2 2>gnunet_error.log &
 sleep 5
 
+#get bob's peer ID, necessary for alice
 PEERIDBOB=`gnunet-peerinfo -qs $CFGB`
+
+#payload for this test on both sides
 INPUTALICE="-k AAAA -e 10,10,10"
 INPUTBOB="-k AAAA -e 10,10,10"
-EXPECTED="2C0"
 
-gnunet-scalarproduct $CFGBOB $INPUTBOB
-RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>client_error.log`
+echo "gnunet-scalarproduct $LOG $CFGBOB $INPUTBOB &"
+echo "gnunet-scalarproduct $LOG $CFGALICE $INPUTALICE -p $PEERIDBOB -L ERROR"
+gnunet-scalarproduct $LOG $CFGBOB $INPUTBOB 2>bob_error.log &
+RESULT=`gnunet-scalarproduct $LOG $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice_error.log`
 
+EXPECTED="12C"
 if [ "$RESULT" == "$EXPECTED" ]
 then
   echo "OK"