projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- rename
[oweals/gnunet.git]
/
src
/
scalarproduct
/
test_scalarproduct.sh
diff --git
a/src/scalarproduct/test_scalarproduct.sh
b/src/scalarproduct/test_scalarproduct.sh
index 0a0fc65782325dd7290ff626b05eb68f9d994448..eed9de30fe41cedf3c8d5559da1708917353a978 100755
(executable)
--- a/
src/scalarproduct/test_scalarproduct.sh
+++ b/
src/scalarproduct/test_scalarproduct.sh
@@
-1,8
+1,8
@@
#!/bin/bash
# compute a simple scalar product
# payload for this test:
#!/bin/bash
# compute a simple scalar product
# payload for this test:
-INPUTALICE="-k
AAAA -e 10,10,10
"
-INPUTBOB="-k
AAAA -e 10,10,10
"
+INPUTALICE="-k
CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'
"
+INPUTBOB="-k
CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'
"
# necessary to make the testing prefix deterministic, so we can access the config files
PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
# necessary to make the testing prefix deterministic, so we can access the config files
PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
@@
-13,29
+13,33
@@
CFGBOB="-c $PREFIX/1/config"
# launch two peers in line topology non-interactively
#
# launch two peers in line topology non-interactively
#
-# interactive mode would terminate the test immediately
-# because the rest of the script is already in stdin,
+# interactive mode would terminate the test immediately
+# because the rest of the script is already in stdin,
# thus redirecting stdin does not suffice)
# thus redirecting stdin does not suffice)
-GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 2>service.log &
+#GNUNET_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
sleep 5
# get bob's peer ID, necessary for alice
PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
sleep 5
# get bob's peer ID, necessary for alice
PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
-GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log &
-GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log
+#GNUNET_LOG=';;;;DEBUG'
+gnunet-scalarproduct $CFGBOB $INPUTBOB &
+GNUNET_LOG=';;;;DEBUG'
+RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
-# termiante the testbed
-kill $( pgrep -P $$ | tr '\n' ' ' )
-#rm alice.log bob.log service.log
+# terminate the testbed
+kill $PID
-EXPECTED="
12
C"
+EXPECTED="
0CC
C"
if [ "$RESULT" == "$EXPECTED" ]
then
if [ "$RESULT" == "$EXPECTED" ]
then
- echo "OK"
- exit 0
+
echo "OK"
+
exit 0
else
else
- echo "Result $RESULT NOTOK"
- exit 1
+
echo "Result $RESULT NOTOK"
+
exit 1
fi
fi