From e0dca01ebdc673d41dd5e7d3d5270fdfe189f17d Mon Sep 17 00:00:00 2001 From: Michael Turek Date: Mon, 26 Mar 2018 18:44:10 +0000 Subject: [PATCH] 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 --- run_tests.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index c18420daa..4649de10b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -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 \{\} \;