aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function/common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash/function/common.sh')
-rw-r--r--resources/libraries/bash/function/common.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh
index acd3a4be0b..44149ca6e1 100644
--- a/resources/libraries/bash/function/common.sh
+++ b/resources/libraries/bash/function/common.sh
@@ -93,6 +93,12 @@ function activate_docker_topology () {
cat ${WORKING_TOPOLOGY} | grep -v password || {
die "Topology read failed!"
}
+
+ # Subfunctions to update data that may depend on topology reserved.
+ set_environment_variables || die
+ select_tags || die
+ compose_robot_arguments || die
+
}
@@ -257,6 +263,10 @@ function common_dirs () {
function compose_robot_arguments () {
+ # This function is called by run_tests function.
+ # The reason is that some jobs (bisect) perform reservation multiple times,
+ # so WORKING_TOPOLOGY can be different each time.
+ #
# Variables read:
# - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
# - DUT - CSIT test/ subdirectory, set while processing tags.
@@ -274,6 +284,8 @@ function compose_robot_arguments () {
ROBOT_ARGS=("--loglevel" "TRACE")
ROBOT_ARGS+=("--variable" "TOPOLOGY_PATH:${WORKING_TOPOLOGY}")
+ # TODO: The rest does not need to be recomputed on each reservation.
+ # Refactor TEST_CODE so this part can be called only once.
case "${TEST_CODE}" in
*"device"*)
ROBOT_ARGS+=("--suite" "tests.${DUT}.device")
@@ -717,6 +729,9 @@ function reserve_and_cleanup_testbed () {
# When cleanup fails, remove from topologies and keep retrying
# until all topologies are removed.
#
+ # Multiple other functions are called from here,
+ # as they set variables that depend on reserved topology data.
+ #
# Variables read:
# - TOPOLOGIES - Array of paths to topology yaml to attempt reservation on.
# - PYTHON_SCRIPTS_DIR - Path to directory holding the reservation script.
@@ -785,6 +800,11 @@ function reserve_and_cleanup_testbed () {
echo "Sleeping ${sleep_time}"
sleep "${sleep_time}" || die "Sleep failed."
done
+
+ # Subfunctions to update data that may depend on topology reserved.
+ set_environment_variables || die
+ select_tags || die
+ compose_robot_arguments || die
}
@@ -792,12 +812,23 @@ function run_robot () {
# Run robot with options based on input variables.
#
+ # Testbed has to be reserved already,
+ # as some data may have changed between reservations,
+ # for example excluded NICs.
+ #
# Variables read:
# - CSIT_DIR - Path to existing root of local CSIT git repository.
# - ARCHIVE_DIR - Path to store robot result files in.
# - ROBOT_ARGS, EXPANDED_TAGS - See compose_robot_arguments.sh
# - GENERATED_DIR - Tests are assumed to be generated under there.
+ # - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
+ # - DUT - CSIT test/ subdirectory, set while processing tags.
+ # - TAGS - Array variable holding selected tag boolean expressions.
+ # - TOPOLOGIES_TAGS - Tag boolean expression filtering tests for topology.
+ # - TEST_CODE - The test selection string from environment or argument.
# Variables set:
+ # - ROBOT_ARGS - String holding part of all arguments for robot.
+ # - EXPANDED_TAGS - Array of string robot arguments compiled from tags.
# - ROBOT_EXIT_STATUS - Exit status of most recent robot invocation.
# Functions called:
# - die - Print to stderr and exit.
@@ -864,6 +895,9 @@ function select_arch_os () {
function select_tags () {
+ # Only to be called from the reservation function,
+ # as resulting tags may change based on topology data.
+ #
# Variables read:
# - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
# - TEST_CODE - String affecting test selection, usually jenkins job name.
@@ -1276,6 +1310,9 @@ function set_environment_variables () {
# Depending on testbed topology, overwrite defaults set in the
# resources/libraries/python/Constants.py file
#
+ # Only to be called from the reservation function,
+ # as resulting values may change based on topology data.
+ #
# Variables read:
# - TEST_CODE - String affecting test selection, usually jenkins job name.
# Variables set: