瀏覽代碼

add timeouts to test

Christian Grothoff 8 年之前
父節點
當前提交
68a09c195d
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/scalarproduct/test_scalarproduct_negativezero.sh

+ 5 - 3
src/scalarproduct/test_scalarproduct_negativezero.sh

@@ -22,13 +22,15 @@ PID=$!
 # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe
 sleep 5
 
+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