X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fdeployments%2Fft-client%2Ftests%2Fexperiment1%2Fcommon.sh;fp=example%2Fdiameter%2Flauncher%2Fdeployments%2Fft-client%2Ftests%2Fexperiment1%2Fcommon.sh;h=0000000000000000000000000000000000000000;hb=4c3f0a4d7e4db76996404d80c6f939548fca656f;hp=d84149130b66f02272dab168dd195e0ecbbca630;hpb=c82a3818b279727e943a76343f3cf1a278ac9e19;p=anna.git diff --git a/example/diameter/launcher/deployments/ft-client/tests/experiment1/common.sh b/example/diameter/launcher/deployments/ft-client/tests/experiment1/common.sh deleted file mode 100755 index d841491..0000000 --- a/example/diameter/launcher/deployments/ft-client/tests/experiment1/common.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -############# -# FUNCTIONS # -############# - -_exit () { - echo - echo $1 - echo - exit 1 -} - -sigint_handler() { - _exit "Script interrupted. Cleanup & exit ..." -} - -# $1: hex formatted file to send to the server -send_xml () { - ../../operation.sh "sendxml|$1" -} - -send_hex () { - sleep 1 - ../../operation.sh "sendhex|$1" -} - -# $1: pattern; $2: file -check_pattern () { - echo "Matching pattern '$1' ..." - cat $2 | tr '\n' ' ' | egrep "$1" >/dev/null - res=${PIPESTATUS[2]} - [ $? -ne 0 ] && _exit "Test failed: miss pattern !!" -} - -test_ok () { - echo - echo $1 - echo "Test OK !" - echo - exit 0 -} - -test_failed () { - echo - echo $1 - echo "Test FAILED !" - echo - exit 1 -} - - -# $1: traffic log to monitor -# $2: timeout (request expiration) in seconds -# Result: cats the message when completed -monitor_4_message () { - 0>$1 - rm -f .msg_received - - [ -z "$2" ] && _exit "ERROR: must provide '$FUNCNAME' timeout (second argument)" - sleep $2 & - local timerPid=$! - - # Monitor for incoming message: - tail -n0 -F --pid=$timerPid $1 | while read line - do - if echo $line | grep "^" >/dev/null; then - echo "Message received" - # stop the timer - kill -13 $timerPid - touch .msg_received - fi - done - - if [ ! -f .msg_received ]; then - echo "Timeout expired" - return 1 - fi - - return 0 -} - -############# -# EXECUTION # -############# - -# Trap sigint signal: -trap sigint_handler SIGINT -