mariadb/mysql-test/t/wait_for_process.sh
unknown 0ff8d48661 Fix of test suite in scope of fixing BUG#18023: IM: instance
can be started several times; monitor interval must be > 2sec


mysql-test/r/im_daemon_life_cycle.result:
  Updated result file.
mysql-test/r/im_life_cycle.result:
  Updated result file.
mysql-test/r/im_utils.result:
  Updated result file.
mysql-test/t/im_daemon_life_cycle-im.opt:
  Set monitoring interval to 1 second in order to:
    - be consistent with 5.1;
    - speed up tests;
mysql-test/t/im_daemon_life_cycle.imtest:
  1. Use wait_for_start.sh script to minimize chance of race condition.
  2. Polishing.
mysql-test/t/im_life_cycle.imtest:
  1. Use wait_for_start.sh and wait_for_stop.sh scripts to
     minimize chance of race condition;
  2. Remove some statements, because there is no way now to
     stabilize their output.
  3. Polishing;
mysql-test/t/im_utils.imtest:
  1. Use wait_for_start.sh script to minimize chance of race condition.
  2. Polishing.
mysql-test/t/kill_n_check.sh:
  1. Make timeout configurable by command-line argument;
  2. Change algorithm of waiting for process to restart to be
     more robust.
mysql-test/t/im_life_cycle-im.opt:
  Set monitoring interval to 1 second in order to:
    - be consistent with 5.1;
    - speed up tests;
mysql-test/t/im_utils-im.opt:
  Set monitoring interval to 1 second in order to:
    - be consistent with 5.1;
    - speed up tests;
mysql-test/t/wait_for_process.sh:
  A new helper script, intended to be used instead of dummy "sleep"
  when waiting for some process to start or stop.
2006-06-19 14:13:34 +04:00

66 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
###########################################################################
pid_path="$1"
total_attempts="$2"
event="$3"
case "$3" in
started)
check_fn='check_started';
;;
stopped)
check_fn='check_stopped';
;;
*)
echo "Error: invalid third argument ('started' or 'stopped' expected)."
exit 0
esac
###########################################################################
check_started()
{
[ ! -r "$pid_path" ] && return 1
new_pid=`cat "$pid_path" 2>/dev/null`
[ $? -eq 0 -a "$original_pid" = "$new_pid" ] && return 1
return 0
}
###########################################################################
check_stopped()
{
[ -r "$pid_path" ] && return 1
return 0
}
###########################################################################
cur_attempt=1
while true; do
if ( eval $check_fn ); then
echo "Success: the process has been $event."
exit 0
fi
[ $cur_attempt -ge $total_attempts ] && break
sleep 1
cur_attempt=`expr $cur_attempt + 1`
done
echo "Error: the process has not been $event in $total_attempts secs."
exit 0