8266e14adc
We do not have any testing inside DIB for testing disk-image-create logic. Lets do some smoke testing for all our supported image formats. Also adding a run_functests.sh so we can extend this later without editing the jenkins job. Change-Id: Ie491e27f00bde54f73af6b47c9696ec04d973b14
35 lines
824 B
Bash
35 lines
824 B
Bash
export TEST_ELEMENTS=$(dirname $0)/elements
|
|
export DIB_ELEMENTS=$(dirname $0)/../elements
|
|
export DIB_CMD=$(dirname $0)/../bin/disk-image-create
|
|
|
|
function build_test_image() {
|
|
format=${1:-}
|
|
|
|
if [ -n "$format" ]; then
|
|
type_arg="-t $format"
|
|
else
|
|
type_arg=
|
|
format="qcow2"
|
|
fi
|
|
dest_dir=$(mktemp -d)
|
|
|
|
trap "rm -rf $dest_dir" EXIT
|
|
|
|
ELEMENTS_PATH=$DIB_ELEMENTS:$TEST_ELEMENTS \
|
|
$DIB_CMD $type_arg -o $dest_dir/image -n fake-os
|
|
|
|
format=$(echo $format | tr ',' ' ')
|
|
for format in $format; do
|
|
img_path="$dest_dir/image.$format"
|
|
if ! [ -f "$img_path" ]; then
|
|
echo "Error: No image with name $img_path found!"
|
|
exit 1
|
|
else
|
|
echo "Found image $img_path."
|
|
fi
|
|
done
|
|
|
|
trap EXIT
|
|
rm -rf $dest_dir
|
|
}
|