Use system arch to determine what cirros images to use in run_tests.sh

Currently run_tests.sh hardcodes what images are downloaded and used
for testing. This patch grabs the system's arch and uses it to build
the urls and filenames for the cirros images. Additionally, ppc64le
images are not provided until 4.0 so switching cirros version based
on arch is also added here.

Change-Id: I73b65c566153c027988b5781870e44c47c6e8b1f
This commit is contained in:
Michael Turek 2018-03-26 18:44:10 +00:00
parent 519399e7d6
commit e0dca01ebd
1 changed files with 19 additions and 7 deletions

View File

@ -179,18 +179,30 @@ which pip || $SUDO easy_install pip
rm -rf /tmp/cirros
mkdir /tmp/cirros
if [ -f ~/cache/files/cirros-0.3.5-x86_64-uec.tar.gz ]; then
tar -xzvf ~/cache/files/cirros-0.3.5-x86_64-uec.tar.gz -C /tmp/cirros/
arch="$(uname -p)"
case $arch in
x86_64)
cirros_version="0.3.5"
;;
ppc64le)
cirros_version="0.4.0"
;;
esac
if [ -f ~/cache/files/cirros-$cirros_version-$arch-uec.tar.gz ]; then
tar -xzvf ~/cache/files/cirros-$cirros_version-$arch-uec.tar.gz -C /tmp/cirros/
else
echo "No pre-cached uec archive found, downloading..."
wget --tries=10 http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-uec.tar.gz -P /tmp/cirros/
tar -xzvf /tmp/cirros/cirros-0.3.5-x86_64-uec.tar.gz -C /tmp/cirros/
wget --tries=10 http://download.cirros-cloud.net/$cirros_version/cirros-$cirros_version-$arch-uec.tar.gz -P /tmp/cirros/
tar -xzvf /tmp/cirros/cirros-$cirros_version-$arch-uec.tar.gz -C /tmp/cirros/
fi
if [ -f ~/cache/files/cirros-0.3.5-x86_64-disk.img ]; then
cp -p ~/cache/files/cirros-0.3.5-x86_64-disk.img /tmp/cirros/
if [ -f ~/cache/files/cirros-$cirros_version-$arch-disk.img ]; then
cp -p ~/cache/files/cirros-$cirros_version-$arch-disk.img /tmp/cirros/
else
echo "No pre-cached disk image found, downloading..."
wget --tries=10 http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img -P /tmp/cirros/
wget --tries=10 http://download.cirros-cloud.net/$cirros_version/cirros-$cirros_version-$arch-disk.img -P /tmp/cirros/
fi
echo "Using pre-cached images:"
find /tmp/cirros -type f -printf "%m %n %u %g %s %t" -exec md5sum \{\} \;