- #!/usr/bin/ksh93
- # needs ksh93 for floating-point math in $((...))
- set -o errexit
- set -o xtrace
- #
- # prechecks
- #
- [[ -x '/opt/rovema/rds/start' ]] || exit 1
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rovema/lib
- modprobe -f simatic_ipc_nvram
- ulimit -c unlimited
- # variables for the test runs
- compound c=(
- typeset -r rds_output_logfile='mylog.log'
- integer rds_pid=-1
- float rds_starttime
- float rds_stoptime
- integer i
- integer runs_failed=0
- integer runs_ok=0
- )
- typeset s
- integer x
- trap "print -v c" INT
- cd '/opt/rovema/rds/'
- # rds success output: "transferDataOfPhase '4' with bReady = 1"
- # rds waiting for input "Input:"
- # rds failed to switch to phase 4: "Error during switching to CP4 in startup"
- for (( c.i=0 ; c.i < 4 ; c.i++ )) ; do
- ./rds -dl 7 >"${c.rds_output_logfile}" 2>&1 &
- (( c.rds_pid=$! ))
- (( c.rds_starttime = SECONDS ))
- for (( x=10 ; x > 0 ; x-- )) ; do
- sleep 6
- s="$( <"${c.rds_output_logfile}" )"
- if [[ "$s" == *"Input:"* ]] ; then
- printf $"Rds ready for input\n"
- (( x=0 ))
- fi
- if [[ "$s" == *"transferDataOfPhase '4' with bReady = 1"* ]] ; then
- printf $"Success: phase 4 reached\n"
- (( c.runs_ok++ ))
- (( x=0 ))
- fi
- if [[ "$s" == ~(E)(Error\ during.+to\ CP4) ]] ; then
- printf $"Failure: phase 4 not reached\n"
- (( c.runs_failed++ ))
- (( x=0 ))
- fi
- done
- #
- # wait 20 seconds for process to finish with SIGINT
- # and send him a SIGKILL when it refuses to obey
- #
- kill -s INT ${c.rds_pid}
- for (( x=10 ; x > 0 ; x-- )) ; do
- sleep 2
- [[ ! -d "/proc/${c.rds_pid}/fd" ]] && break
- done
- [[ -d "/proc/${c.rds_pid}/fd" ]] && kill -s KILL ${c.rds_pid}
- wait
- # print statistics
- printf $"#### Statistics:\n"
- print -v c
- sleep 2
- done
- #
- # done
- #
- printf $"#\n#Done:\n#\n"
- print -v c
- # EOF.
statistics rds test script for Phase4
Posted by Anonymous on Tue 14th Sep 2021 13:53
raw | new post
view followups (newest first): statistics rds test script for Phase4 by Anonymous
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.