1
0
mirror of https://github.com/MariaDB/server.git synced 2025-10-22 19:52:58 +03:00
Files
mariadb/mysql-test/t/kill_n_check.sh
unknown 43c8f453e5 WL#2789 "Instance Manager: test using mysql-test-run testing framework"
Add Instance Manager tests.


mysql-test/include/im_check_os.inc:
  Currently Instance Manager tests are known to work only on UNIX platform.
  This header file is included in each IM-test in order to skip the test
  on Windows.
mysql-test/r/im_daemon_life_cycle.result:
  Results file for Instance Manager daemon test.
mysql-test/r/im_life_cycle.result:
  Results file for Instance Manager life cycle test.
mysql-test/r/im_options_set.result:
  Results file for Instance Manager SET statement test.
mysql-test/r/im_options_unset.result:
  Results file for Instance Manager UNSET statement test.
mysql-test/r/im_utils.result:
  Results file for Instance Manager utils test.
mysql-test/t/im_daemon_life_cycle-im.opt:
  Options file for Instance Manager daemon test.
mysql-test/t/im_daemon_life_cycle.imtest:
  Instance Manager daemon test (mysqltestrun-part).
mysql-test/t/im_life_cycle.imtest:
  Instance Manager life cycle test.
mysql-test/t/im_options_set.imtest:
  Instance Manager SET statement test.
mysql-test/t/im_options_unset.imtest:
  Instance Manager UNSET statement test.
mysql-test/t/im_utils.imtest:
  Instance Manager utils test.
mysql-test/t/kill_n_check.sh:
  The helper script. Its main idea is to kill some process and
  check that the process will (or will not) be restarted.
2005-10-01 01:14:50 +04:00

67 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
if [ $# -ne 2 ]; then
echo "Usage: kill_n_check.sh <pid file path> killed|restarted"
exit 0
fi
pid_path="$1"
expected_result="$2"
if [ -z "$pid_path" -o ! -r "$pid_path" ]; then
echo "Error: invalid PID path ($pid_path) or PID file does not exist."
exit 0
fi
if [ "$expected_result" != "killed" -a \
"$expected_result" != "restarted" ]; then
echo "Error: expected result must be either 'killed' or 'restarted'."
exit 0
fi
# echo "PID path: '$pid_path'"
original_pid=`cat "$pid_path"`
# echo "Original PID: $original_pid"
echo "Killing the process..."
kill -9 $original_pid
echo "Sleeping..."
sleep 3
new_pid=""
[ -r "$pid_path" ] && new_pid=`cat "$pid_path"`
# echo "New PID: $new_pid"
if [ "$expected_result" == "restarted" ]; then
if [ -z "$new_pid" ]; then
echo "Error: the process was killed."
exit 0
fi
if [ "$original_pid" -eq "$new_pid" ]; then
echo "Error: the process was not restarted."
exit 0
fi
echo "Success: the process was restarted."
exit 0
else # $expected_result == killed
if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
echo "Error: the process was restarted."
exit 0
fi
echo "Success: the process was killed."
exit 0
fi