aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/test_scalarproduct.sh
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2013-10-18 15:13:59 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2013-10-18 15:13:59 +0000
commit96ccef162f276c2f40b09ceca59c982bbaa3709e (patch)
treea10a4fe26bfd70a9cc08359b68195a5f5d729c0c /src/scalarproduct/test_scalarproduct.sh
parent8fe29d55719cb024f2e162f1f5289ded8cf91e53 (diff)
downloadgnunet-96ccef162f276c2f40b09ceca59c982bbaa3709e.tar.gz
gnunet-96ccef162f276c2f40b09ceca59c982bbaa3709e.zip
added testcase for negative scalarproducts
added testcase for negative-zero scalarproducts
Diffstat (limited to 'src/scalarproduct/test_scalarproduct.sh')
-rwxr-xr-xsrc/scalarproduct/test_scalarproduct.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/scalarproduct/test_scalarproduct.sh b/src/scalarproduct/test_scalarproduct.sh
index 5f335db3c..82b42e992 100755
--- a/src/scalarproduct/test_scalarproduct.sh
+++ b/src/scalarproduct/test_scalarproduct.sh
@@ -1,8 +1,8 @@
1#!/bin/bash 1#!/bin/bash
2# compute a simple scalar product 2# compute a simple scalar product
3# payload for this test: 3# payload for this test:
4INPUTALICE="-k AAAA -e 3,3,-1" 4INPUTALICE="-k CCC -e 3,3,-1"
5INPUTBOB="-k AAAA -e 1000,100,24" 5INPUTBOB="-k CCC -e 1000,100,24"
6 6
7# necessary to make the testing prefix deterministic, so we can access the config files 7# necessary to make the testing prefix deterministic, so we can access the config files
8PREFIX=/tmp/test-scalarproduct`date +%H%M%S` 8PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
@@ -18,16 +18,13 @@ CFGBOB="-c $PREFIX/1/config"
18# thus redirecting stdin does not suffice) 18# thus redirecting stdin does not suffice)
19GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 2>service.log & 19GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 2>service.log &
20PID=$! 20PID=$!
21
22echo $PID
23read
24sleep 5 21sleep 5
22
25# get bob's peer ID, necessary for alice 23# get bob's peer ID, necessary for alice
26PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` 24PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
27 25
28GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log & 26GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log &
29RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log` 27RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log`
30RESULT=`printf "%X\n" "0x$RESULT"`
31 28
32cat alice.log bob.log service.log >> test_scalarproduct.log 29cat alice.log bob.log service.log >> test_scalarproduct.log
33rm -f alice.log bob.log service.log 30rm -f alice.log bob.log service.log
@@ -36,7 +33,7 @@ ISSUES=$((`grep scalarproduct test_scalarproduct.log | grep -c ERROR` + `grep sc
36# terminate the testbed 33# terminate the testbed
37kill $PID 34kill $PID
38 35
39EXPECTED="CCC" 36EXPECTED="0CCC"
40if [ "$ISSUES" -eq "0" ] 37if [ "$ISSUES" -eq "0" ]
41then 38then
42 if [ "$RESULT" == "$EXPECTED" ] 39 if [ "$RESULT" == "$EXPECTED" ]