aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/test_scalarproduct.sh
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-07 00:42:31 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-07 00:42:31 +0000
commitd30f73b49715899b2aa12e4819a0e105994c5411 (patch)
treea1c2ff23e637053477334bddcbe4e8969c6cfc5d /src/scalarproduct/test_scalarproduct.sh
parent7b993324a717497da6d34573a45150c48ca8786f (diff)
downloadgnunet-d30f73b49715899b2aa12e4819a0e105994c5411.tar.gz
gnunet-d30f73b49715899b2aa12e4819a0e105994c5411.zip
-fix some of the obvious issues
Diffstat (limited to 'src/scalarproduct/test_scalarproduct.sh')
-rwxr-xr-xsrc/scalarproduct/test_scalarproduct.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/scalarproduct/test_scalarproduct.sh b/src/scalarproduct/test_scalarproduct.sh
index eed9de30f..8a34c2473 100755
--- a/src/scalarproduct/test_scalarproduct.sh
+++ b/src/scalarproduct/test_scalarproduct.sh
@@ -3,6 +3,7 @@
3# payload for this test: 3# payload for this test:
4INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'" 4INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'"
5INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'" 5INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'"
6EXPECTED="0CCC"
6 7
7# necessary to make the testing prefix deterministic, so we can access the config files 8# necessary to make the testing prefix deterministic, so we can access the config files
8PREFIX=/tmp/test-scalarproduct`date +%H%M%S` 9PREFIX=/tmp/test-scalarproduct`date +%H%M%S`
@@ -16,30 +17,31 @@ CFGBOB="-c $PREFIX/1/config"
16# interactive mode would terminate the test immediately 17# interactive mode would terminate the test immediately
17# because the rest of the script is already in stdin, 18# because the rest of the script is already in stdin,
18# thus redirecting stdin does not suffice) 19# thus redirecting stdin does not suffice)
19#GNUNET_LOG='scalarproduct;;;;DEBUG' 20GNUNET_LOG='scalarproduct*;;;;DEBUG'
20GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 & 21GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
21PID=$! 22PID=$!
22# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe 23# sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
24echo "Waiting for peers to start..."
23sleep 5 25sleep 5
26echo "Running test..."
24 27
25# get bob's peer ID, necessary for alice 28# get bob's peer ID, necessary for alice
26PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` 29PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
27 30
28#GNUNET_LOG=';;;;DEBUG' 31#GNUNET_LOG=';;;;DEBUG'
29gnunet-scalarproduct $CFGBOB $INPUTBOB & 32gnunet-scalarproduct $CFGBOB $INPUTBOB &
30GNUNET_LOG=';;;;DEBUG' 33#GNUNET_LOG=';;;;DEBUG'
31RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` 34RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
32 35
33# terminate the testbed 36# terminate the testbed
34kill $PID 37kill $PID
35 38
36EXPECTED="0CCC"
37if [ "$RESULT" == "$EXPECTED" ] 39if [ "$RESULT" == "$EXPECTED" ]
38then 40then
39 echo "OK" 41 echo "OK"
40 exit 0 42 exit 0
41else 43else
42 echo "Result $RESULT NOTOK" 44 echo "Result $RESULT, expected $EXPECTED - NOTOK"
43 exit 1 45 exit 1
44fi 46fi
45 47