+pip install -r ${SCRIPT_DIR}/requirements.txt
+
+for index in "${!VIRL_SERVER[@]}"; do
+ pykwalify -s ${SCRIPT_DIR}/resources/topology_schemas/3_node_topology.sch.yaml \
+ -s ${SCRIPT_DIR}/resources/topology_schemas/topology.sch.yaml \
+ -d ${SCRIPT_DIR}/topologies/enabled/topology${index}.yaml \
+ -vvv
+ if [ "$?" -ne "0" ]; then
+ echo "Topology${index} schema validation failed."
+ echo "However, the tests will start."
+ fi
+done
+
+function run_test_set() {
+ set +x
+ OLDIFS=$IFS
+ IFS=","
+ nr=$(echo $1)
+ rm -f ${LOG_PATH}/test_run${nr}.log
+ exec &> >(while read line; do echo "$(date +'%H:%M:%S') $line" \
+ >> ${LOG_PATH}/test_run${nr}.log; done;)
+ suite_str=""
+ for suite in ${TEST_GROUPS[${nr}]}; do
+ suite_str="${suite_str} --suite ${SUITE_PATH}.${suite}"
+ done
+ IFS=$OLDIFS
+
+ echo "PYTHONPATH=`pwd` pybot -L TRACE -W 136\
+ -v TOPOLOGY_PATH:${SCRIPT_DIR}/topologies/enabled/topology${nr}.yaml \
+ ${suite_str} \
+ --include vm_envAND3_node_single_link_topo \
+ --include vm_envAND3_node_double_link_topo \
+ --exclude PERFTEST \
+ --exclude ${SKIP_PATCH} \
+ --noncritical EXPECTED_FAILING \
+ --output ${LOG_PATH}/log_test_set_run${nr} \
+ tests/"
+
+ PYTHONPATH=`pwd` pybot -L TRACE -W 136\
+ -v TOPOLOGY_PATH:${SCRIPT_DIR}/topologies/enabled/topology${nr}.yaml \
+ ${suite_str} \
+ --include vm_envAND3_node_single_link_topo \
+ --include vm_envAND3_node_double_link_topo \
+ --exclude PERFTEST \
+ --exclude ${SKIP_PATCH} \
+ --noncritical EXPECTED_FAILING \
+ --output ${LOG_PATH}/log_test_set_run${nr} \
+ tests/
+
+ local local_run_rc=$?
+ set -x
+ echo ${local_run_rc} > ${SHARED_MEMORY_PATH}/rc_test_run${nr}
+}
+
+set +x
+# Send to background an instance of the run_test_set() function for each number,
+# record the pid.
+for index in "${!VIRL_SERVER[@]}"; do
+ run_test_set ${index} &
+ pid=$!
+ echo "Sent to background: Test_set${index} (pid=$pid)"
+ pids[$pid]=$index
+done
+
+echo
+echo -n "Waiting..."
+
+# Watch the stable of background processes.
+# If a pid goes away, remove it from the array.
+while [ -n "${pids[*]}" ]; do
+ for i in $(seq 0 9); do
+ sleep 1
+ echo -n "."
+ done
+ for pid in "${!pids[@]}"; do
+ if ! ps "$pid" >/dev/null; then
+ echo -e "\n"
+ echo "Test_set${pids[$pid]} with PID $pid finished."
+ unset pids[$pid]
+ fi
+ done
+ if [ -z "${!pids[*]}" ]; then
+ break
+ fi
+ echo -n -e "\nStill waiting for test set(s): ${pids[*]} ..."
+done