From b0990df82b0e8ff831cbb01ed9fd1d6b4e592b8e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 27 Jun 2016 14:00:15 +0000 Subject: [PATCH] add timeouts to test --- src/scalarproduct/test_scalarproduct.sh | 9 +++++---- src/scalarproduct/test_scalarproduct_negative.sh | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/scalarproduct/test_scalarproduct.sh b/src/scalarproduct/test_scalarproduct.sh index dd9bb80a5..c0401beb7 100755 --- a/src/scalarproduct/test_scalarproduct.sh +++ b/src/scalarproduct/test_scalarproduct.sh @@ -25,13 +25,15 @@ echo "Waiting for peers to start..." sleep 5 echo "Running test..." +which timeout &> /dev/null && DO_TIMEOUT="timeout 15" + # get bob's peer ID, necessary for alice -PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` +PEERIDBOB=`${DO_TIMEOUT} gnunet-peerinfo -qs $CFGBOB` #GNUNET_LOG=';;;;DEBUG' -gnunet-scalarproduct $CFGBOB $INPUTBOB & +${DO_TIMEOUT} gnunet-scalarproduct $CFGBOB $INPUTBOB & #GNUNET_LOG=';;;;DEBUG' -RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` +RESULT=`${DO_TIMEOUT} gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` # terminate the testbed kill $PID @@ -44,4 +46,3 @@ else echo "Result $RESULT, expected $EXPECTED - NOTOK" exit 1 fi - diff --git a/src/scalarproduct/test_scalarproduct_negative.sh b/src/scalarproduct/test_scalarproduct_negative.sh index eb9ead4bf..cbeb1b9fd 100755 --- a/src/scalarproduct/test_scalarproduct_negative.sh +++ b/src/scalarproduct/test_scalarproduct_negative.sh @@ -11,6 +11,8 @@ PREFIX=/tmp/test-scalarproduct`date +%H%M%S` CFGALICE="-c $PREFIX/0/config" CFGBOB="-c $PREFIX/1/config" +which timeout &> /dev/null && DO_TIMEOUT="timeout 15" + # launch two peers in line topology non-interactively # # interactive mode would terminate the test immediately @@ -23,12 +25,12 @@ PID=$! sleep 5 # get bob's peer ID, necessary for alice -PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` +PEERIDBOB=`${DO_TIMEOUT} gnunet-peerinfo -qs $CFGBOB` #GNUNET_LOG=';;;;DEBUG' -gnunet-scalarproduct $CFGBOB $INPUTBOB & +${DO_TIMEOUT} gnunet-scalarproduct $CFGBOB $INPUTBOB & #RESULT=`GNUNET_LOG=';;;;DEBUG' -RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` +RESULT=`${DO_TIMEOUT} gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` # terminate the testbed kill $PID -- 2.25.1