diskimage-builder/tests/test_elements.bash
Dmitry Tantsur 0e122e8e35 Add a tox target to run functional tests locally
Now 'tox -efunc' can be invoked to run all functional tests in
the 'venv' tox environment. Also `tox -efunc element-name` can be
used to run function tests for one element (e.g. ironic-agent).

Change-Id: Ia685d1b2a7deef2f8b98876ac09792134dd30f2f
2015-10-23 12:05:23 +02:00

34 lines
903 B
Bash
Executable File

#!/bin/bash
set -eux
set -o pipefail
basedir=$(dirname $0)
requested_element=${1:-}
source $basedir/test_functions.bash
function run_on_element {
test_element=$1
# our element name is two dirs up
local element_name=$(basename $(dirname $(dirname $test_element)))
local element_type=disk
if [ -f "$test_element/element-type" ]; then
element_type=$(cat "$test_element/element-type")
fi
run_${element_type}_element_test "$(basename $test_element)" "$element_name"
}
if [ -z $requested_element ]; then
for test_element in $basedir/../elements/*/test-elements/*; do
if [ -d "$test_element" ]; then
run_on_element "$test_element"
fi
done
else
for test_element in $basedir/../elements/$requested_element/test-elements/*; do
if [ -d "$test_element" ]; then
run_on_element "$test_element"
fi
done
fi