diff options
Diffstat (limited to 'src/scalarproduct/test_scalarproduct_negative.sh')
-rwxr-xr-x | src/scalarproduct/test_scalarproduct_negative.sh | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/scalarproduct/test_scalarproduct_negative.sh b/src/scalarproduct/test_scalarproduct_negative.sh index 27fd345cc..1267a41ca 100755 --- a/src/scalarproduct/test_scalarproduct_negative.sh +++ b/src/scalarproduct/test_scalarproduct_negative.sh | |||
@@ -16,34 +16,26 @@ CFGBOB="-c $PREFIX/1/config" | |||
16 | # interactive mode would terminate the test immediately | 16 | # interactive mode would terminate the test immediately |
17 | # because the rest of the script is already in stdin, | 17 | # because the rest of the script is already in stdin, |
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=';;;;DEBUG' GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 & |
20 | PID=$! | 20 | PID=$! |
21 | # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe | ||
21 | sleep 5 | 22 | sleep 5 |
22 | 23 | ||
23 | # get bob's peer ID, necessary for alice | 24 | # get bob's peer ID, necessary for alice |
24 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` | 25 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` |
25 | 26 | ||
26 | GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log & | 27 | GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB & |
27 | RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log` | 28 | RESULT=`GNUNET_LOG=';;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` |
28 | |||
29 | cat alice.log bob.log service.log >> test_scalarproduct.log | ||
30 | rm -f alice.log bob.log service.log | ||
31 | ISSUES=$((`grep scalarproduct test_scalarproduct.log | grep -c ERROR` + `grep scalarproduct test_scalarproduct.log | grep -c WARNING`)) | ||
32 | 29 | ||
33 | # terminate the testbed | 30 | # terminate the testbed |
34 | kill $PID | 31 | kill $PID |
35 | 32 | ||
36 | EXPECTED="-0CCC" | 33 | EXPECTED="-0CCC" |
37 | if [ "$ISSUES" -eq "0" ] | 34 | if [ "$RESULT" == "$EXPECTED" ] |
38 | then | 35 | then |
39 | if [ "$RESULT" == "$EXPECTED" ] | 36 | echo "OK" |
40 | then | 37 | exit 0 |
41 | echo "OK" | ||
42 | rm -f test_scalarproduct.log | ||
43 | exit 0 | ||
44 | fi | ||
45 | else | 38 | else |
46 | echo "Result $RESULT NOTOK, see $PWD/test_scalarproduct.log for details" | 39 | echo "Result $RESULT NOTOK" |
47 | exit 1 | 40 | exit 1 |
48 | fi | 41 | fi |
49 | |||