aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/test_scalarproduct.sh
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2013-10-18 14:50:56 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2013-10-18 14:50:56 +0000
commit02eef607379528f1a28c8593dd98e233fcbefd69 (patch)
tree2c8e8636091779c5c6ad9347b813817a3f7c0257 /src/scalarproduct/test_scalarproduct.sh
parent17b79681e95d1e1ba5d6c410606ef2bb854f5d9f (diff)
downloadgnunet-02eef607379528f1a28c8593dd98e233fcbefd69.tar.gz
gnunet-02eef607379528f1a28c8593dd98e233fcbefd69.zip
fixed PID checking and this the kill feature
Diffstat (limited to 'src/scalarproduct/test_scalarproduct.sh')
-rwxr-xr-xsrc/scalarproduct/test_scalarproduct.sh35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/scalarproduct/test_scalarproduct.sh b/src/scalarproduct/test_scalarproduct.sh
index 0a0fc6578..5f335db3c 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 10,10,10" 4INPUTALICE="-k AAAA -e 3,3,-1"
5INPUTBOB="-k AAAA -e 10,10,10" 5INPUTBOB="-k AAAA -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`
@@ -17,25 +17,36 @@ CFGBOB="-c $PREFIX/1/config"
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)
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 &
20sleep 5 20PID=$!
21 21
22echo $PID
23read
24sleep 5
22# get bob's peer ID, necessary for alice 25# get bob's peer ID, necessary for alice
23PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` 26PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
24 27
25GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log & 28GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGBOB $INPUTBOB 2>bob.log &
26GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log 29RESULT=`GNUNET_LOG='scalarproduct;;;;DEBUG' gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB 2>alice.log`
30RESULT=`printf "%X\n" "0x$RESULT"`
31
32cat alice.log bob.log service.log >> test_scalarproduct.log
33rm -f alice.log bob.log service.log
34ISSUES=$((`grep scalarproduct test_scalarproduct.log | grep -c ERROR` + `grep scalarproduct test_scalarproduct.log | grep -c WARNING`))
27 35
28# termiante the testbed 36# terminate the testbed
29kill $( pgrep -P $$ | tr '\n' ' ' ) 37kill $PID
30#rm alice.log bob.log service.log
31 38
32EXPECTED="12C" 39EXPECTED="CCC"
33if [ "$RESULT" == "$EXPECTED" ] 40if [ "$ISSUES" -eq "0" ]
34then 41then
35 echo "OK" 42 if [ "$RESULT" == "$EXPECTED" ]
36 exit 0 43 then
44 echo "OK"
45 rm -f test_scalarproduct.log
46 exit 0
47 fi
37else 48else
38 echo "Result $RESULT NOTOK" 49 echo "Result $RESULT NOTOK, see $PWD/test_scalarproduct.log for details"
39 exit 1 50 exit 1
40fi 51fi
41 52