Merge pull request #135 from Salamandar/int_to_enum

Use text instead of integers for stop_timer argument
This commit is contained in:
Alexandre Aubin 2023-01-20 14:08:49 +01:00 committed by GitHub
commit 6197e36e21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 13 deletions

View file

@ -142,7 +142,8 @@ start_timer () {
stop_timer () {
# Ending the timer
# $1 = Type of querying
# $1 = Type of message
msg_type="${1:-}"
local finishtime=$(date +%s)
# Calculate the gap between the starting and the ending of the timer
@ -170,9 +171,9 @@ stop_timer () {
[ $seconds -gt 1 ] && pseconds="${pseconds}s" || pseconds="0s"
local time="${phours}${pminutes}${pseconds} ($(date '+%T'))"
if [ $1 -eq 2 ]; then
if [ "$msg_type" = "one_test" ]; then
log_info "Working time for this test: $time"
elif [ $1 -eq 3 ]; then
elif [ "$msg_type" = "all_tests" ]; then
log_info "Global working time for all tests: $time"
else
log_debug "Working time: $time"

View file

@ -69,7 +69,7 @@ CREATE_LXC_SNAPSHOT () {
_LXC_START_AND_WAIT $LXC_NAME
stop_timer 1
stop_timer
}
LOAD_LXC_SNAPSHOT () {
@ -104,7 +104,7 @@ LXC_EXEC () {
log_debug "Return code: $returncode"
stop_timer 1
stop_timer
# Return the exit code of the ssh command
return $returncode
}
@ -220,4 +220,3 @@ CLEAN_SWAPFILES() {
RUN_INSIDE_LXC() {
lxc exec $LXC_NAME -- "$@"
}

View file

@ -90,7 +90,7 @@ run_all_tests() {
# Restore the started time for the timer
starttime=$complete_start_timer
# End the timer for the test
stop_timer 3
stop_timer all_tests
echo "You can find the complete log of these tests in $(realpath $complete_log)"
@ -151,7 +151,7 @@ TEST_LAUNCHER () {
# Restore the started time for the timer
starttime=$global_start_timer
# End the timer for the test
stop_timer 2
stop_timer one_test
LXC_STOP $LXC_NAME
@ -256,4 +256,3 @@ path_to_install_type() {
[ "$check_path" == "/" ] && { echo "root"; return; }
echo "subdir"
}