diff options
author | dann frazier <dann.frazier@canonical.com> | 2014-04-29 10:11:58 -0600 |
---|---|---|
committer | dann frazier <dann.frazier@canonical.com> | 2014-04-29 10:11:58 -0600 |
commit | 76e0a79c93706a7476aa0bb8a7e674911b756a2a (patch) | |
tree | 7c433ee91b30033fa65501df013a473877789941 /bin/virtualization | |
parent | eebb1728a13a17708a13362b0c1c0d8519ab8e5b (diff) |
Use userspace architecture string, not kernel uname
We shouldn't assume a kernel architecture maps to a given userspace environment. We could be running in an armhf chroot on an aarch64 kernel, for example. This probably isn't a practical issue for the KVM tests since we probably wouldn't be certifying such setups, but it does let us be more explicit about arch detection (vs. relying on regex matching).
Diffstat (limited to 'bin/virtualization')
-rwxr-xr-x | bin/virtualization | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/virtualization b/bin/virtualization index 95bd706..bd1ba1c 100755 --- a/bin/virtualization +++ b/bin/virtualization @@ -57,7 +57,7 @@ class KVMTest(object): self.image = image self.timeout = timeout self.debug_file = os.path.join(os.getcwd(), debug_file) - self.arch = check_output(['arch'], universal_newlines=True) + self.arch = check_output(['dpkg', '--print-architecture'], universal_newlines=True).strip() def download_image(self): """ @@ -70,7 +70,7 @@ class KVMTest(object): # Construct URL cloud_url = "http://cloud-images.ubuntu.com" - if re.match("arm.*", self.arch): + if self.arch == 'armhf': cloud_iso = release + "-server-cloudimg-armhf.tar.gz" else: cloud_iso = release + "-server-cloudimg-i386-disk1.img" @@ -90,7 +90,7 @@ class KVMTest(object): return False # Unpack img file from tar - if re.match("arm.*", self.arch): + if self.arch == 'armhf': cloud_iso_tgz = tarfile.open(cloud_iso) cloud_iso = cloud_iso.replace('tar.gz', 'img') cloud_iso_tgz.extract(cloud_iso) @@ -119,7 +119,7 @@ class KVMTest(object): logging.debug("Attaching Cloud config disk") cloud_disk = "-drive file=seed.iso,if=virtio" - if re.match("arm.*", self.arch): + if self.arch == 'armhf': uname = check_output(['uname', '-r'], universal_newlines=True) cloud_disk = cloud_disk.replace("virtio", "sd") params = 'qemu-system-arm -machine vexpress-a15 -cpu cortex-a15 -enable-kvm -m {} -kernel /boot/vmlinuz -append "console=ttyAMA0 earlyprintk=serial root=/dev/mmcblk0 ro rootfstype=ext4" -serial stdio -dtb /lib/firmware/{}/device-tree/vexpress-v2p-ca15-tc1.dtb -initrd /boot/initrd.img -net nic -net user,net={},host={},hostfwd={} -drive file={},if=sd,cache=writeback {} -display none -nographic'.format("256", uname, netrange, image_ip, hostfwd, data_disk, cloud_disk) |