rsyslog/tests/mysqld-start.sh
Rainer Gerhards 41a1abcb2d
testbench: provide diagnostic info on mysql startup error
This also extends the testbench framework with the ability to define
test-specific custom exit handlers.
2018-11-03 14:12:53 +01:00

25 lines
719 B
Bash
Executable File

#!/bin/bash
# This is not a real test, but a script to start mysql. It is
# implemented as test so that we can start mysql at the time we need
# it (do so via Makefile.am).
# Copyright (C) 2018 Rainer Gerhards and Adiscon GmbH
# Released under ASL 2.0
. ${srcdir:=.}/diag.sh init
if [ "$MYSQLD_START_CMD" == "" ]; then
exit_test # no start needed
fi
test_error_exit_handler() {
set -x; set -v
printf 'mysqld startup failed, log is:\n'
$SUDO cat /var/log/mysql/error.log
}
printf 'starting mysqld...\n'
$MYSQLD_START_CMD &
wait_startup_pid /var/run/mysqld/mysqld.pid
printf 'preparing mysqld for testbench use...\n'
$SUDO ${srcdir}/../devtools/prep-mysql-db.sh
printf 'done, mysql ready for testbench\n'
exit_test