diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-10-18 15:13:59 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-10-18 15:13:59 +0000 |
commit | 96ccef162f276c2f40b09ceca59c982bbaa3709e (patch) | |
tree | a10a4fe26bfd70a9cc08359b68195a5f5d729c0c /src/scalarproduct/test_scalarproduct.sh | |
parent | 8fe29d55719cb024f2e162f1f5289ded8cf91e53 (diff) | |
download | gnunet-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-x | src/scalarproduct/test_scalarproduct.sh | 11 |
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: |
4 | INPUTALICE="-k AAAA -e 3,3,-1" | 4 | INPUTALICE="-k CCC -e 3,3,-1" |
5 | INPUTBOB="-k AAAA -e 1000,100,24" | 5 | INPUTBOB="-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 |
8 | PREFIX=/tmp/test-scalarproduct`date +%H%M%S` | 8 | PREFIX=/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) |
19 | GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 2>service.log & | 19 | GNUNET_LOG='scalarproduct;;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 2>service.log & |
20 | PID=$! | 20 | PID=$! |
21 | |||
22 | echo $PID | ||
23 | read | ||
24 | sleep 5 | 21 | sleep 5 |
22 | |||
25 | # get bob's peer ID, necessary for alice | 23 | # get bob's peer ID, necessary for alice |
26 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` | 24 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` |
27 | 25 | ||
28 | GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log & | 26 | GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log & |
29 | RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log` | 27 | RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log` |
30 | RESULT=`printf "%X\n" "0x$RESULT"` | ||
31 | 28 | ||
32 | cat alice.log bob.log service.log >> test_scalarproduct.log | 29 | cat alice.log bob.log service.log >> test_scalarproduct.log |
33 | rm -f alice.log bob.log service.log | 30 | rm -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 |
37 | kill $PID | 34 | kill $PID |
38 | 35 | ||
39 | EXPECTED="CCC" | 36 | EXPECTED="0CCC" |
40 | if [ "$ISSUES" -eq "0" ] | 37 | if [ "$ISSUES" -eq "0" ] |
41 | then | 38 | then |
42 | if [ "$RESULT" == "$EXPECTED" ] | 39 | if [ "$RESULT" == "$EXPECTED" ] |