2013-07-04 08:05:39 +00:00
|
|
|
#!/bin/bash
|
2013-12-10 14:32:40 +00:00
|
|
|
# Copyright 2010-2013 Frank Liepold / 1&1 Internet AG
|
|
|
|
#
|
|
|
|
# Email: frank.liepold@1und1.de
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
#####################################################################
|
2013-07-04 08:05:39 +00:00
|
|
|
|
|
|
|
## the base directory of all .sh and .conf files
|
2013-12-10 11:55:20 +00:00
|
|
|
main_base_directory=/home/fl/mars/mars-git-hub/test_suite
|
2013-07-04 08:05:39 +00:00
|
|
|
|
2013-09-17 10:41:17 +00:00
|
|
|
## hosts the tests are running on. The first host is initially always used as
|
|
|
|
## primary host
|
2014-01-07 15:24:33 +00:00
|
|
|
main_host_list=("istore-test-bs7" "istore-test-bap7")
|
2013-08-06 12:29:21 +00:00
|
|
|
|
2013-11-07 09:33:43 +00:00
|
|
|
## file to implement a primitive locking mechanism to avoid concurrent runs
|
|
|
|
## of the test suite on the same host
|
|
|
|
declare -g -A main_lock_file_list
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## if main_host_list is changed in a *.conf file we need to recompute the values
|
|
|
|
## of all dependent globals.
|
2013-11-07 09:33:43 +00:00
|
|
|
function main_set_globals_depending_on_main_host_list
|
|
|
|
{
|
|
|
|
eval main_lock_file_list=($(for h in "${main_host_list[@]}";do printf "[$h]=/tmp/test-suite_on.$h ";done))
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
# see default-cluster.conf
|
|
|
|
# we construct the expression cluster_mars_dir_lv_name_list=([host-1]=$cluster_mars_dir_lv [host-2]=$cluster_mars_dir_lv ...)
|
2013-11-07 09:33:43 +00:00
|
|
|
if declare -p cluster_mars_dir_lv_name_list 2>/dev/null |\
|
|
|
|
grep 'declare -A' >/dev/null
|
|
|
|
then
|
2013-12-10 14:32:40 +00:00
|
|
|
eval cluster_mars_dir_lv_name_list=($(x=(${main_host_list[@]/#/[}); y=(${x[@]/%/]=$cluster_mars_dir_lv}); echo ${y[@]}))
|
2013-11-07 09:33:43 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
main_set_globals_depending_on_main_host_list
|
|
|
|
|
|
|
|
## errorcode to prevent lib_exit from removing lock files
|
2013-12-10 14:32:40 +00:00
|
|
|
## (main_lock_file_list)
|
2013-11-07 09:33:43 +00:00
|
|
|
main_prevent_remove_lock_files_code=42
|
|
|
|
|
2013-12-30 14:58:22 +00:00
|
|
|
## stack level from which the callstack should be printed in function
|
|
|
|
## lib_vmsg
|
|
|
|
## As default we skip the top three, because in general these are constantly
|
|
|
|
## stdin, start_test.sh and 00_main.sh
|
|
|
|
main_min_stack_level=3
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## host indexed list of bootloaders. In case of lilo we check after installing
|
|
|
|
## a kernel, that the label given in main_host_bootloader_label_list exists
|
|
|
|
## in /etc/lilo.conf and call lilo -R <label>. For all other bootloaders we do
|
|
|
|
## nothing. It's your responsibility to boot the correct kernel.
|
2013-08-06 12:29:21 +00:00
|
|
|
declare -g -A main_host_bootloader_list
|
2013-09-17 10:41:17 +00:00
|
|
|
main_host_bootloader_list=(\
|
|
|
|
[istore-test-bs7]=grub \
|
|
|
|
[istore-test-bap7]=lilo \
|
2013-11-07 09:33:43 +00:00
|
|
|
[istore-test-bs4]=lilo \
|
|
|
|
[istore-test-bap4]=lilo \
|
|
|
|
[istore-test-bs2]=lilo \
|
|
|
|
[ovzd-test-bs1]=grub \
|
|
|
|
[ovzd-test-bap1]=grub \
|
2013-09-17 10:41:17 +00:00
|
|
|
)
|
2013-08-06 12:29:21 +00:00
|
|
|
|
|
|
|
declare -g -A main_host_bootloader_label_list
|
2013-09-17 10:41:17 +00:00
|
|
|
main_host_bootloader_label_list=(\
|
|
|
|
[istore-test-bs7]=no_label \
|
|
|
|
[istore-test-bap7]=mars \
|
2013-11-07 09:33:43 +00:00
|
|
|
[istore-test-bs4]=mars \
|
|
|
|
[istore-test-bap4]=mars \
|
|
|
|
[istore-test-bs2]=mars \
|
|
|
|
[ovzd-test-bs1]=no_label \
|
|
|
|
[ovzd-test-bap1]=no_label \
|
2013-09-17 10:41:17 +00:00
|
|
|
)
|
2013-07-04 08:05:39 +00:00
|
|
|
|
|
|
|
## associative array containing functions (as indexes) to be called in case of
|
|
|
|
## unexpected errors or signals. See also lib_exit
|
|
|
|
## The values of the array are the parameter lists for the function calls
|
|
|
|
|
|
|
|
declare -g -A main_error_recovery_functions
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## for batch ssh access from our work station to the involved hosts we need a
|
|
|
|
## id file without password.
|
2013-07-04 08:05:39 +00:00
|
|
|
|
|
|
|
main_ssh_idfile_opt="-i $HOME/.ssh/id_dsa_no_pw"
|
|
|
|
|
|
|
|
|
|
|
|
main_mars_directory="/mars"
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## filesystem type of /mars
|
2013-08-06 12:29:21 +00:00
|
|
|
main_mars_fs_type="ext4"
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## egrep patterns to check for messsage categories
|
2013-11-07 09:33:43 +00:00
|
|
|
main_mars_errmsg_prefix='(XIO|MARS)_error'
|
|
|
|
main_mars_wrnmsg_prefix='(XIO|MARS)_warn'
|
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## egrep pattern for error messages which are likely to appear only in
|
|
|
|
## lib_err_total_log_file (5.total.log)
|
|
|
|
main_errors_only_in_total_log_pattern='[A-Z]_error'
|
|
|
|
|
2013-11-07 09:33:43 +00:00
|
|
|
## to be able to kill all scripts started on a remote host these scripts
|
|
|
|
## must have a fixed pattern in their name
|
|
|
|
main_prefix_scripts='MARS-TEST-SCRIPT'
|
2013-07-04 08:05:39 +00:00
|
|
|
|
2013-12-10 14:32:40 +00:00
|
|
|
## results of checks of symlinks
|
2013-07-04 08:05:39 +00:00
|
|
|
declare -g -A main_link_status
|
|
|
|
main_link_status=(["link_ok"]=0 ["link_does_not_exist"]=1 \
|
|
|
|
["link_has_wrong_value"]=2)
|
|
|
|
|