From 529fb591de9376a365b454f4373ff78d91bec5cf Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 22 Mar 2021 14:27:39 +0100 Subject: [PATCH 1/4] fix double quotes around lxc exec --- lib/lxc.sh | 2 +- lib/tests.sh | 4 ++-- lib/tests_coordination.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/lxc.sh b/lib/lxc.sh index 26915c6..5932959 100644 --- a/lib/lxc.sh +++ b/lib/lxc.sh @@ -91,7 +91,7 @@ LXC_EXEC () { start_timer # Execute the command given in argument in the container and log its results. - lxc exec $LXC_NAME --env PACKAGE_CHECK_EXEC=1 -t -- $cmd | tee -a "$complete_log" $current_test_log + lxc exec $LXC_NAME --env PACKAGE_CHECK_EXEC=1 -t -- /bin/bash -c "$cmd" | tee -a "$complete_log" $current_test_log # Store the return code of the command local returncode=${PIPESTATUS[0]} diff --git a/lib/tests.sh b/lib/tests.sh index a0a9c23..9d087d6 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -80,8 +80,8 @@ _INSTALL_APP () { done # Install the application in a LXC container - log_info "Running: yunohost app install --force /app_folder -a $install_args" - _RUN_YUNOHOST_CMD "app install --force /app_folder -a $install_args" + log_info "Running: yunohost app install --force /app_folder -a \"$install_args\"" + _RUN_YUNOHOST_CMD "app install --force /app_folder -a \"$install_args\"" local ret=$? [ $ret -eq 0 ] && log_debug "Installation successful." || log_error "Installation failed." diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index d643bbd..d8a6fe6 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -78,7 +78,7 @@ parse_check_process() { # Looking like domain=foo.com&path=/bar&password=stuff # "Standard" arguments like domain/path will later be overwritten # during tests - local install_args=$( extract_check_process_section "^; Manifest" "^; " $test_serie_rawconf | awk '{print $1}' | tr -d '"' | tr '\n' '&') + local install_args=$( extract_check_process_section "^; Manifest" "^; " $test_serie_rawconf | tr '\n' '&') local preinstall_template=$(extract_check_process_section "^; pre-install" "^; " $test_serie_rawconf) local action_infos=$( extract_check_process_section "^; Actions" "^; " $test_serie_rawconf) local configpanel_infos=$( extract_check_process_section "^; Config_panel" "^; " $test_serie_rawconf) From ee6c5571ade8241b48e45024e7e3c355af170042 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 22 Mar 2021 14:36:17 +0100 Subject: [PATCH 2/4] use commit as name if the folder doesn't exist --- lib/tests_coordination.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index d8a6fe6..90b87db 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -108,10 +108,14 @@ parse_check_process() { # Upgrades with a specific commit if [[ "$test_type" == "TEST_UPGRADE" ]] && [[ -n "$test_arg" ]] then - local specific_upgrade_install_args="$(grep "^manifest_arg=" "$TEST_CONTEXT/upgrades/$test_arg" | cut -d'=' -f2-)" - [[ -n "$specific_upgrade_install_args" ]] && _install_args="$specific_upgrade_install_args" + if [ -f "$TEST_CONTEXT/upgrades/$test_arg" ]; then + local specific_upgrade_install_args="$(grep "^manifest_arg=" "$TEST_CONTEXT/upgrades/$test_arg" | cut -d'=' -f2-)" + [[ -n "$specific_upgrade_install_args" ]] && _install_args="$specific_upgrade_install_args" - local upgrade_name="$(grep "^name=" "$TEST_CONTEXT/upgrades/$test_arg" | cut -d'=' -f2)" + local upgrade_name="$(grep "^name=" "$TEST_CONTEXT/upgrades/$test_arg" | cut -d'=' -f2)" + else + local upgrade_name="$test_arg" + fi extra="$(jq -n --arg upgrade_name "$upgrade_name" '{ $upgrade_name }')" elif [[ "$test_type" == "ACTIONS_CONFIG_PANEL" ]] && [[ "$test_arg" == "actions" ]] then From b18ac0b157e50af898f270de0feb1cb214b5ded4 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 22 Mar 2021 14:53:09 +0100 Subject: [PATCH 3/4] double quotes action/config tests args --- lib/tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tests.sh b/lib/tests.sh index 9d087d6..4cbafd2 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -886,12 +886,12 @@ ACTIONS_CONFIG_PANEL () { then # Build the argument from a value from the check_process local action_config_actual_argument="$(echo "$actions_config_arguments_specifics" | cut -d'|' -f $j)" - action_config_argument_built="--args $action_config_argument_name=$action_config_actual_argument" + action_config_argument_built="--args \"$action_config_argument_name=$action_config_actual_argument\"" elif [ -n "$action_config_argument_default" ] then # Build the argument from the default value local action_config_actual_argument="$action_config_argument_default" - action_config_argument_built="--args $action_config_argument_name=$action_config_actual_argument" + action_config_argument_built="--args \"$action_config_argument_name=$action_config_actual_argument\"" else log_warning "> No argument into the check_process to use or default argument for \"$action_config_name\"..." action_config_actual_argument="" From af9fab5bfa4ef2edd8d19f5eec51e8f0e27bd969 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 23 Mar 2021 00:37:30 +0100 Subject: [PATCH 4/4] Revert the removal of awk/tr, needed because there are some stupid trailing (DOMAIN) and similar stuff ... Gotta see later how to handle properly args containing spaces --- lib/tests_coordination.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index 90b87db..a7c02f3 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -78,7 +78,7 @@ parse_check_process() { # Looking like domain=foo.com&path=/bar&password=stuff # "Standard" arguments like domain/path will later be overwritten # during tests - local install_args=$( extract_check_process_section "^; Manifest" "^; " $test_serie_rawconf | tr '\n' '&') + local install_args=$( extract_check_process_section "^; Manifest" "^; " $test_serie_rawconf | awk '{print $1}' | tr -d '"' | tr '\n' '&') local preinstall_template=$(extract_check_process_section "^; pre-install" "^; " $test_serie_rawconf) local action_infos=$( extract_check_process_section "^; Actions" "^; " $test_serie_rawconf) local configpanel_infos=$( extract_check_process_section "^; Config_panel" "^; " $test_serie_rawconf)