Merge "functests: skip qcow2 generically but add specific test"

This commit is contained in:
Jenkins 2017-03-24 01:07:10 +00:00 committed by Gerrit Code Review
commit 94e2973785
4 changed files with 34 additions and 9 deletions

View File

@ -1 +1,4 @@
Verify we can build a ubuntu-minimal image. Verify we can build a ubuntu-minimal image.
Note this test includes the vm element to test the bootloader install,
and specifies to output a .qcow2

View File

@ -35,6 +35,10 @@ DEFAULT_SKIP_TESTS=(
centos/build-succeeds centos/build-succeeds
) )
# The default output formats (specified to disk-image-create's "-t"
# command. Elements can override with a test-output-formats file
DEFAULT_OUTPUT_FORMATS="tar"
function log_with_prefix { function log_with_prefix {
local pr=$1 local pr=$1
local log local log
@ -82,13 +86,15 @@ function wait_minus_n {
fi fi
} }
# run_disk_element_test <test_element> <element> # run_disk_element_test <test_element> <element> <use_tmp> <output_formats>
# Run a disk-image-build .tar build of ELEMENT including any elements # Run a disk-image-build build of ELEMENT including any elements
# specified by TEST_ELEMENT # specified by TEST_ELEMENT. Pass OUTPUT_FORMAT to "-t"
function run_disk_element_test() { function run_disk_element_test() {
local test_element=$1 local test_element=$1
local element=$2 local element=$2
local dont_use_tmp=$3 local dont_use_tmp=$3
local output_format="$4"
local use_tmp_flag="" local use_tmp_flag=""
local dest_dir=$(mktemp -d) local dest_dir=$(mktemp -d)
@ -102,12 +108,17 @@ function run_disk_element_test() {
break_cmd="cp -v \$TMP_MOUNT_PATH/tmp/dib-test-should-fail ${dest_dir} || true" \ break_cmd="cp -v \$TMP_MOUNT_PATH/tmp/dib-test-should-fail ${dest_dir} || true" \
DIB_SHOW_IMAGE_USAGE=1 \ DIB_SHOW_IMAGE_USAGE=1 \
ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \ ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \
$DIB_CMD -x -t tar,qcow2 ${use_tmp_flag} -o $dest_dir/image -n $element $test_element 2>&1 \ $DIB_CMD -x -t ${output_format} \
${use_tmp_flag} \
-o $dest_dir/image -n $element $test_element 2>&1 \
| log_with_prefix "${element}/${test_element}"; then | log_with_prefix "${element}/${test_element}"; then
if ! [ -f "$dest_dir/image.qcow2" ]; then if [[ "qcow2" =~ "$output_format" ]]; then
echo "Error: qcow2 build failed for element: $element, test-element: $test_element." if ! [ -f "$dest_dir/image.qcow2" ]; then
echo "No image $dest_dir/image.qcow2 found!" echo "Error: qcow2 build failed for element: $element, test-element: $test_element."
echo "No image $dest_dir/image.qcow2 found!"
exit 1
fi
fi fi
# check inside the tar for sentinel files # check inside the tar for sentinel files
@ -305,16 +316,25 @@ for test in "${TESTS_TO_RUN[@]}"; do
element=${test%/*} element=${test%/*}
test_element=${test#*/} test_element=${test#*/}
element_dir=$DIB_ELEMENTS/${element}/test-elements/${test_element}/
# tests default to disk-based, but "element-type" can optionally # tests default to disk-based, but "element-type" can optionally
# override that # override that
element_type=disk element_type=disk
element_type_override=$DIB_ELEMENTS/${element}/test-elements/${test_element}/element-type element_type_override=${element_dir}/element-type
if [ -f ${element_type_override} ]; then if [ -f ${element_type_override} ]; then
element_type=$(cat ${element_type_override}) element_type=$(cat ${element_type_override})
fi fi
# override the output format if specified
element_output=${DEFAULT_OUTPUT_FORMATS}
element_output_override=${element_dir}/test-output-formats
if [ -f $element_output_override ]; then
element_output=$(cat ${element_output_override})
fi
echo "Running $test ($element_type)" echo "Running $test ($element_type)"
run_${element_type}_element_test $test_element $element ${DONT_USE_TMP} & run_${element_type}_element_test $test_element $element ${DONT_USE_TMP} "${element_output}" &
done done
# Wait for the rest of the jobs # Wait for the rest of the jobs