#!/bin/bash
#necessary to make the testing prefix deterministic, so we can access the config files
-GNUNET_TESTING_PREFIX=/tmp/test-scalarproduct1337
-CFGA="-c ./test_scalarproduct_alice.conf"
-CFGB="-c ./test_scalarproduct_bob.conf"
- #can't use ` directly
-SESSIONDATA="-k AAAA -e 10,10,10"
-EXPECTED="2C0"
-
-gnunet-arm -s $CFGA
-sleep 2
-gnunet-arm -s $CFGB
-sleep 2
+GNUNET_TESTING_PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
+CFGALICE="-c $GNUNET_TESTING_PREFIX/0/config"
+CFGBOB="-c $GNUNET_TESTING_PREFIX/1/config"
-IDB=`gnunet-peerinfo -s $CFGB | awk -F "\x60" '{print $2}' | awk -F "'" '{print $1}'`
+../testbed/gnunet-testbed-profiler -c test_scalarproduct.conf -p 2 2>gnunet_error.log &
+sleep 5
-gnunet-scalarproduct $CFGB $SESSIONDATA
-
-RESULT=`gnunet-scalarproduct $CFGA $SESSIONDATA -p $IDB`
+PEERIDBOB=`gnunet-peerinfo -qs $CFGB`
+INPUTALICE="-k AAAA -e 10,10,10"
+INPUTBOB="-k AAAA -e 10,10,10"
+EXPECTED="2C0"
-gnunet-arm -e $CFGA &
-gnunet-arm -e $CFGB &
+gnunet-scalarproduct $CFGBOB $INPUTBOB
+RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>client_error.log`
if [ "$RESULT" == "$EXPECTED" ]
then