test_suite: refactoring

This commit is contained in:
Frank Liepold 2014-02-03 08:21:06 +01:00
parent 5857f7b148
commit f9d42097c8
32 changed files with 50 additions and 32 deletions

View File

@ -28,6 +28,7 @@ Contents
9. Starting the whole test suite via cronjob
10. Concurrent test runs
11. Firewalls
12. Programming hints and conventions
1. Running a test
-----------------
@ -248,7 +249,8 @@ build_test_environment/install_mars
It's a must to read default-checkout_mars.conf, default-make_mars.conf,
default-install_mars.conf and the *.conf files in the directories above
otherwise you risk damage of the boot information on your work station and/or the test hosts.
otherwise you risk damage of the boot information on your work station and/or
the test hosts.
After these three tests (which you should call one after the other!) you can
reboot the test hosts with the new kernel.
@ -301,6 +303,19 @@ This flag leads to deletion of *all* iptable chains on the test hosts.
If you do not want this behaviour set net_clear_iptables_in_prepare_phase=0.
12. Programming hints and conventions
-------------------------------------
- all global variables should be defined and explained in a
default-<module_name>.conf file
- the names of all global variables resp. all functions should have as prefix the
module name of the default-*.conf file resp. of the <module>.sh file which they
are defined in.
- in case of an error certain cleanup functions may be called (e.g. if
a network connection is cut during a test case it should be restored).
The associotive array main_error_recovery_functions has function names as
index an function parameters as values. In lib_exit each function contained
in main_error_recovery_functions is called with it's corresponding arguments.

View File

@ -2,5 +2,5 @@
run_list="resource_leave_all lib_general_checks_after_every_test"
run_list="resource_leave_all lib_general_mars_checks_after_every_test"

View File

@ -18,4 +18,4 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
run_list="cluster_run lib_general_checks_after_every_test"
run_list="cluster_run lib_general_mars_checks_after_every_test"

View File

@ -18,5 +18,5 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
run_list="resource_prepare resource_run_first lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first lib_general_mars_checks_after_every_test"

View File

@ -117,3 +117,6 @@ declare -g -A main_link_status
main_link_status=(["link_ok"]=0 ["link_does_not_exist"]=1 \
["link_has_wrong_value"]=2)
## function called in lib_exit to run general checks (e.g. for kernel stacks
## caused by a test case)
lib_general_checks_after_every_test=lib_general_mars_checks_after_every_test

View File

@ -66,7 +66,7 @@ function lib_check_for_kernel_oops_after_start_time
}
function lib_general_checks_after_every_test
function lib_general_mars_checks_after_every_test
{
echo "================= General checks of error and log files ========================"
lib_err_check_and_copy_global_err_files_all

View File

@ -71,7 +71,7 @@ function lib_exit
exit $rc
fi
export lib_exit_recursion=1
lib_general_checks_after_every_test
eval $lib_general_checks_after_every_test_function
if [ ${#main_error_recovery_functions[*]} -ge 0 ]; then
local func args
for func in "${!main_error_recovery_functions[@]}"; do

View File

@ -24,4 +24,4 @@
apply_fetch_running_action="apply"
run_list="resource_prepare resource_run_first apply_fetch_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first apply_fetch_run lib_general_mars_checks_after_every_test"

View File

@ -53,5 +53,5 @@ resource_maxtime_sync=300
## to declare the sync process as inactive
resource_time_constant_sync=10
run_list="resource_write_and_check lib_general_checks_after_every_test"
run_list="resource_write_and_check lib_general_mars_checks_after_every_test"

View File

@ -24,4 +24,4 @@
apply_fetch_running_action="fetch"
run_list="resource_prepare resource_run_first apply_fetch_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first apply_fetch_run lib_general_mars_checks_after_every_test"

View File

@ -27,4 +27,4 @@ resize_time_constant_sync=20
## maxtime to wait for sync to stop
resize_maxtime_sync=400
run_list="resize_prepare resize_run lib_general_checks_after_every_test"
run_list="resize_prepare resize_run lib_general_mars_checks_after_every_test"

View File

@ -21,4 +21,4 @@
run_list="resource_quick_prepare_first_resource resource_recreate_standalone lib_general_checks_after_every_test"
run_list="resource_quick_prepare_first_resource resource_recreate_standalone lib_general_mars_checks_after_every_test"

View File

@ -2,4 +2,4 @@
run_list="resource_prepare resource_run_first resource_recreate_all lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first resource_recreate_all lib_general_mars_checks_after_every_test"

View File

@ -21,4 +21,4 @@
run_list="resource_quick_prepare_first_resource resource_leave_while_sync lib_general_checks_after_every_test"
run_list="resource_quick_prepare_first_resource resource_leave_while_sync lib_general_mars_checks_after_every_test"

View File

@ -19,4 +19,4 @@
logrotate_with_deletes=1
run_list="resource_prepare resource_run_first logrotate_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first logrotate_run lib_general_mars_checks_after_every_test"

View File

@ -17,4 +17,4 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
run_list="resource_prepare resource_run_first logrotate_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first logrotate_run lib_general_mars_checks_after_every_test"

View File

@ -20,4 +20,4 @@
#####################################################################
run_list="resource_quick_prepare_first_resource switch2primary_run lib_general_checks_after_every_test"
run_list="resource_quick_prepare_first_resource switch2primary_run lib_general_mars_checks_after_every_test"

View File

@ -24,4 +24,4 @@ switch2primary_force=1
lib_rw_part_of_device_size_written_per_loop=10
logrotate_number_of_rotates_before_delete=2
run_list="resource_quick_prepare_first_resource switch2primary_run lib_general_checks_after_every_test"
run_list="resource_quick_prepare_first_resource switch2primary_run lib_general_mars_checks_after_every_test"

View File

@ -24,4 +24,4 @@ main_host_list[${#main_host_list[@]}]="istore-test-bs2"
main_set_globals_depending_on_main_host_list
run_list="resource_write_and_check lib_general_checks_after_every_test"
run_list="resource_write_and_check lib_general_mars_checks_after_every_test"

View File

@ -40,7 +40,7 @@ remote_dev_maxtime_to_wait_for_errmsg=600
## see comment in default-crash.conf
crash_print_linktree_during_reboot=0
run_list="resource_prepare resource_run_first remote_dev_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first remote_dev_run lib_general_mars_checks_after_every_test"
# Since commit

View File

@ -26,4 +26,4 @@ resource_set_globals_depending_on_resource_name_list
resource_fs_on_data_device_necessary=0
run_list="resource_prepare memleak_run lib_general_checks_after_every_test"
run_list="resource_prepare memleak_run lib_general_mars_checks_after_every_test"

View File

@ -22,4 +22,4 @@
run_list="resource_prepare resource_run_first file_destroy_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first file_destroy_run lib_general_mars_checks_after_every_test"

View File

@ -29,4 +29,4 @@ mars_dir_full_maxtime_state_constant=60
cluster_mars_dir_lv_name_list=([${main_host_list[0]}]=lv-5-10 [${main_host_list[1]}]=lv-6-100)
run_list="resource_prepare resource_run_first resource_fill_mars_dir lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first resource_fill_mars_dir lib_general_mars_checks_after_every_test"

View File

@ -29,4 +29,4 @@ perftest_maxtime_apply=300
resource_fs_on_data_device_necessary=0
run_list="perftest_run lib_general_checks_after_every_test"
run_list="perftest_run lib_general_mars_checks_after_every_test"

View File

@ -36,4 +36,4 @@ lib_rw_part_of_device_size_written_per_loop=8
resource_fs_on_data_device_necessary=1
run_list="perftest_run lib_general_checks_after_every_test"
run_list="perftest_run lib_general_mars_checks_after_every_test"

View File

@ -30,4 +30,4 @@ perftest_maxtime_apply=300
resource_fs_on_data_device_necessary=0
run_list="perftest_run lib_general_checks_after_every_test"
run_list="perftest_run lib_general_mars_checks_after_every_test"

View File

@ -40,4 +40,4 @@ perftest_maxtime_apply=300
resource_fs_on_data_device_necessary=0
run_list="perftest_run lib_general_checks_after_every_test"
run_list="perftest_run lib_general_mars_checks_after_every_test"

View File

@ -32,4 +32,4 @@ perftest_data_file=$main_mars_directory/file_to_sync
resource_fs_on_data_device_necessary=0
run_list="resource_prepare resource_run_first perftest_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first perftest_run lib_general_mars_checks_after_every_test"

View File

@ -18,4 +18,4 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
run_list="resource_prepare resource_run_first crash_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first crash_run lib_general_mars_checks_after_every_test"

View File

@ -20,4 +20,4 @@
crash_aio_sync_mode=2
run_list="resource_prepare resource_run_first crash_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first crash_run lib_general_mars_checks_after_every_test"

View File

@ -21,4 +21,4 @@
crash_logger_completion_semantics=2
crash_aio_sync_mode=2
run_list="resource_prepare resource_run_first crash_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first crash_run lib_general_mars_checks_after_every_test"

View File

@ -20,4 +20,4 @@
crash_logger_completion_semantics=2
run_list="resource_prepare resource_run_first crash_run lib_general_checks_after_every_test"
run_list="resource_prepare resource_run_first crash_run lib_general_mars_checks_after_every_test"