#!/bin/bash # Run Robot Framework tests for vpp-containerlab. # Arguments: # $1 - container runtime: [docker, podman] # $2 - test suite path (directory or .robot file) # # Environment variables: # CLAB_BIN - path to containerlab binary (default: containerlab) # IMAGE - docker image to use in topology (must be set) set -e if [ -z "${CLAB_BIN}" ]; then CLAB_BIN=containerlab fi # IMAGE is optional — some test suites (e.g. 02-maglevd) don't need it. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" mkdir -p "${SCRIPT_DIR}/out" source "${SCRIPT_DIR}/.venv/bin/activate" function get_logname() { path=$1 filename=$(basename "$path") if [[ "$filename" == *.* ]]; then dirname=$(dirname "$path") basename=$(basename "$path" | cut -d. -f1) echo "${dirname##*/}-${basename}" else echo "${filename}" fi } IMAGE_VAR="" if [ -n "${IMAGE}" ]; then IMAGE_VAR="--variable IMAGE:${IMAGE}" fi robot --consolecolors on -r none \ --variable CLAB_BIN:"${CLAB_BIN}" \ --variable runtime:"$1" \ ${IMAGE_VAR} \ -l "${SCRIPT_DIR}/out/$(get_logname $2)-$1-log" \ --output "${SCRIPT_DIR}/out/$(get_logname $2)-$1-out.xml" \ "$2"