Merge ~paride/curtin:target_arch into curtin:master

Proposed by Paride Legovini
Status: Merged
Approved by: Ryan Harper
Approved revision: a6c1772acca7653955076204ee2a15ce80e549a9
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~paride/curtin:target_arch
Merge into: curtin:master
Diff against target: 169 lines (+25/-17)
6 files modified
tests/vmtests/__init__.py (+7/-6)
tests/vmtests/helpers.py (+11/-6)
tests/vmtests/releases.py (+1/-0)
tests/vmtests/test_basic.py (+1/-1)
tests/vmtests/test_old_apt_features.py (+3/-2)
tests/vmtests/test_zfsroot.py (+2/-2)
Reviewer Review Type Date Requested Status
Ryan Harper (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+372974@code.launchpad.net

Commit message

vmtests: separate arch and target_arch in tests

In tests 'arch' is now the arch of the host system, while target_arch
is the architecture the test targets. By default target_arch = arch.

Modify find_arches() to return all the target arches which not excluded
with arch_skip.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paride Legovini (paride) wrote :

I tested this branch by:

 - running the full test_basic.py on amd64
 - running test_basic.py:XenialGAi386TestBasic on amd64
 - running the full test_basic.py on ppc64el with the
   lp:~legovini/curtin:vmtests-ppc64 adapted and merged in

I'm adding an inline comment too.

Revision history for this message
Paride Legovini (paride) wrote :

Also tested:

 - test_old_apt_features.py on amd64 (succeeds)
 - test_old_apt_features.py on ppc64el (fails, but fails
   in the exact same way without this branch applied,
   and I don't think the fix belongs here)

Also tested that the i386 image is not downloaded by vmtest-sync-images on ppc64el. This happened before because of the tests setting 'arch = i386'.

Revision history for this message
Ryan Harper (raharper) wrote :

A couple of questions in line.

Revision history for this message
Paride Legovini (paride) :
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks as we discussed, the Apt class can't use the base-class target arch since it's being used to build class attributes outside of an __init__ method. And I agree that it's really target_arch value being selected (where target_arch == host_arch). Thanks for clarifying.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
index 1fe041d..a81003d 100644
--- a/tests/vmtests/__init__.py
+++ b/tests/vmtests/__init__.py
@@ -627,6 +627,7 @@ class VMBaseClass(TestCase):
627 # these get set from base_vm_classes627 # these get set from base_vm_classes
628 release = None628 release = None
629 arch = None629 arch = None
630 target_arch = None
630 kflavor = None631 kflavor = None
631 krel = None632 krel = None
632 distro = None633 distro = None
@@ -653,7 +654,7 @@ class VMBaseClass(TestCase):
653 logger.debug('cls.ephemeral_ftype: %s', cls.ephemeral_ftype)654 logger.debug('cls.ephemeral_ftype: %s', cls.ephemeral_ftype)
654 logger.debug('cls.target_ftype: %s', cls.target_ftype)655 logger.debug('cls.target_ftype: %s', cls.target_ftype)
655 eph_img_verstr, ftypes = get_images(656 eph_img_verstr, ftypes = get_images(
656 IMAGE_SRC_URL, IMAGE_DIR, cls.distro, cls.release, cls.arch,657 IMAGE_SRC_URL, IMAGE_DIR, cls.distro, cls.release, cls.target_arch,
657 krel=cls.krel if cls.krel else cls.release,658 krel=cls.krel if cls.krel else cls.release,
658 kflavor=cls.kflavor if cls.kflavor else None,659 kflavor=cls.kflavor if cls.kflavor else None,
659 subarch=cls.subarch if cls.subarch else None,660 subarch=cls.subarch if cls.subarch else None,
@@ -676,7 +677,7 @@ class VMBaseClass(TestCase):
676 IMAGE_SRC_URL, IMAGE_DIR,677 IMAGE_SRC_URL, IMAGE_DIR,
677 cls.target_distro,678 cls.target_distro,
678 cls.target_release,679 cls.target_release,
679 cls.arch, subarch=cls.subarch if cls.subarch else None,680 cls.target_arch, subarch=cls.subarch if cls.subarch else None,
680 kflavor=cls.kflavor if cls.kflavor else None,681 kflavor=cls.kflavor if cls.kflavor else None,
681 krel=cls.target_krel, sync=CURTIN_VMTEST_IMAGE_SYNC,682 krel=cls.target_krel, sync=CURTIN_VMTEST_IMAGE_SYNC,
682 ftypes=(tftype,))683 ftypes=(tftype,))
@@ -912,7 +913,7 @@ class VMBaseClass(TestCase):
912 dowait = "--dowait"913 dowait = "--dowait"
913914
914 # create launch cmd915 # create launch cmd
915 cmd = ["tools/launch", "--arch=" + cls.arch, "-v", dowait,916 cmd = ["tools/launch", "--arch=" + cls.target_arch, "-v", dowait,
916 "--smp=" + cls.get_config_smp(), "--mem=%s" % str(cls.mem)]917 "--smp=" + cls.get_config_smp(), "--mem=%s" % str(cls.mem)]
917 if not cls.interactive:918 if not cls.interactive:
918 cmd.extend(["--silent", "--power=off"])919 cmd.extend(["--silent", "--power=off"])
@@ -1317,7 +1318,7 @@ class VMBaseClass(TestCase):
1317 ["--", "-smp", cls.get_config_smp(), "-m", str(cls.mem)])1318 ["--", "-smp", cls.get_config_smp(), "-m", str(cls.mem)])
13181319
1319 if not cls.interactive:1320 if not cls.interactive:
1320 if cls.arch == 's390x':1321 if cls.target_arch == 's390x':
1321 cmd.extend([1322 cmd.extend([
1322 "-nographic", "-nodefaults", "-chardev",1323 "-nographic", "-nodefaults", "-chardev",
1323 "file,path=%s,id=charconsole0" % cls.boot_log,1324 "file,path=%s,id=charconsole0" % cls.boot_log,
@@ -1722,7 +1723,7 @@ class VMBaseClass(TestCase):
1722 raise SkipTest("kernel-img.conf not needed in non-ubuntu releases")1723 raise SkipTest("kernel-img.conf not needed in non-ubuntu releases")
1723 kconf = 'kernel-img.conf'1724 kconf = 'kernel-img.conf'
1724 self.output_files_exist([kconf])1725 self.output_files_exist([kconf])
1725 if self.arch in ['i386', 'amd64']:1726 if self.target_arch in ['i386', 'amd64']:
1726 self.check_file_strippedline(kconf, 'link_in_boot = no')1727 self.check_file_strippedline(kconf, 'link_in_boot = no')
1727 else:1728 else:
1728 self.check_file_strippedline(kconf, 'link_in_boot = yes')1729 self.check_file_strippedline(kconf, 'link_in_boot = yes')
@@ -1845,7 +1846,7 @@ class PsuedoVMBaseClass(VMBaseClass):
1845 kernel, initrd, tarball."""1846 kernel, initrd, tarball."""
18461847
1847 def get_psuedo_path(name):1848 def get_psuedo_path(name):
1848 return os.path.join(IMAGE_DIR, cls.release, cls.arch, name)1849 return os.path.join(IMAGE_DIR, cls.release, cls.target_arch, name)
18491850
1850 return {1851 return {
1851 'squashfs': get_psuedo_path('psuedo-squashfs'),1852 'squashfs': get_psuedo_path('psuedo-squashfs'),
diff --git a/tests/vmtests/helpers.py b/tests/vmtests/helpers.py
index 6dddcc6..835baed 100644
--- a/tests/vmtests/helpers.py
+++ b/tests/vmtests/helpers.py
@@ -8,6 +8,8 @@ import signal
8import threading8import threading
9from unittest import TestLoader9from unittest import TestLoader
1010
11from curtin.util import get_platform_arch
12
1113
12class Command(object):14class Command(object):
13 """15 """
@@ -135,14 +137,17 @@ def find_testcases(**kwargs):
135137
136def find_arches():138def find_arches():
137 """139 """
138 Return a list of uniq arch values from test cases140 Return a list of uniq target arch values from test cases
139 """141 """
140 arches = []142 arch = get_platform_arch()
143 target_arches = []
141 for test_case in find_testcases():144 for test_case in find_testcases():
142 arch = getattr(test_case, 'arch', None)145 if arch in getattr(test_case, 'arch_skip', None):
143 if arch and arch not in arches:146 continue
144 arches.append(arch)147 target_arch = getattr(test_case, 'target_arch', None)
145 return arches148 if target_arch and target_arch not in target_arches:
149 target_arches.append(target_arch)
150 return target_arches
146151
147152
148def find_releases_by_distro():153def find_releases_by_distro():
diff --git a/tests/vmtests/releases.py b/tests/vmtests/releases.py
index 6cc0d8b..16302e8 100644
--- a/tests/vmtests/releases.py
+++ b/tests/vmtests/releases.py
@@ -6,6 +6,7 @@ from curtin.util import get_platform_arch
6class _ReleaseBase(object):6class _ReleaseBase(object):
7 repo = "maas-daily"7 repo = "maas-daily"
8 arch = get_platform_arch()8 arch = get_platform_arch()
9 target_arch = arch
9 mem = "1024"10 mem = "1024"
1011
1112
diff --git a/tests/vmtests/test_basic.py b/tests/vmtests/test_basic.py
index 4d5008c..c15dd50 100644
--- a/tests/vmtests/test_basic.py
+++ b/tests/vmtests/test_basic.py
@@ -264,7 +264,7 @@ class Centos66BionicTestBasic(centos_relbase.centos66_bionic,
264264
265class XenialGAi386TestBasic(relbase.xenial_ga, TestBasicAbs):265class XenialGAi386TestBasic(relbase.xenial_ga, TestBasicAbs):
266 __test__ = True266 __test__ = True
267 arch = 'i386'267 target_arch = 'i386'
268268
269269
270class XenialGATestBasic(relbase.xenial_ga, TestBasicAbs):270class XenialGATestBasic(relbase.xenial_ga, TestBasicAbs):
diff --git a/tests/vmtests/test_old_apt_features.py b/tests/vmtests/test_old_apt_features.py
index a114bf4..5a5415c 100644
--- a/tests/vmtests/test_old_apt_features.py
+++ b/tests/vmtests/test_old_apt_features.py
@@ -56,11 +56,12 @@ class TestOldAptAbs(VMBaseClass):
56 exit 056 exit 0
57 """)]57 """)]
58 arch = util.get_architecture()58 arch = util.get_architecture()
59 if arch in ['amd64', 'i386']:59 target_arch = arch
60 if target_arch in ['amd64', 'i386']:
60 conf_file = "examples/tests/test_old_apt_features.yaml"61 conf_file = "examples/tests/test_old_apt_features.yaml"
61 exp_mirror = "http://us.archive.ubuntu.com/ubuntu"62 exp_mirror = "http://us.archive.ubuntu.com/ubuntu"
62 exp_secmirror = "http://archive.ubuntu.com/ubuntu"63 exp_secmirror = "http://archive.ubuntu.com/ubuntu"
63 if arch in ['s390x', 'arm64', 'armhf', 'powerpc', 'ppc64el']:64 if target_arch in ['s390x', 'arm64', 'armhf', 'powerpc', 'ppc64el']:
64 conf_file = "examples/tests/test_old_apt_features_ports.yaml"65 conf_file = "examples/tests/test_old_apt_features_ports.yaml"
65 exp_mirror = "http://ports.ubuntu.com/ubuntu-ports"66 exp_mirror = "http://ports.ubuntu.com/ubuntu-ports"
66 exp_secmirror = "http://ports.ubuntu.com/ubuntu-ports"67 exp_secmirror = "http://ports.ubuntu.com/ubuntu-ports"
diff --git a/tests/vmtests/test_zfsroot.py b/tests/vmtests/test_zfsroot.py
index c0cfe01..59bb64b 100644
--- a/tests/vmtests/test_zfsroot.py
+++ b/tests/vmtests/test_zfsroot.py
@@ -74,7 +74,7 @@ class UnsupportedZfs(VMBaseClass):
74class XenialGAi386TestZfsRoot(relbase.xenial_ga, TestZfsRootAbs,74class XenialGAi386TestZfsRoot(relbase.xenial_ga, TestZfsRootAbs,
75 UnsupportedZfs):75 UnsupportedZfs):
76 __test__ = True76 __test__ = True
77 arch = 'i386'77 target_arch = 'i386'
7878
7979
80class XenialGATestZfsRoot(relbase.xenial_ga, TestZfsRootAbs):80class XenialGATestZfsRoot(relbase.xenial_ga, TestZfsRootAbs):
@@ -115,7 +115,7 @@ class XenialGATestZfsRootFsType(relbase.xenial_ga, TestZfsRootFsTypeAbs):
115class XenialGAi386TestZfsRootFsType(relbase.xenial_ga, TestZfsRootFsTypeAbs,115class XenialGAi386TestZfsRootFsType(relbase.xenial_ga, TestZfsRootFsTypeAbs,
116 UnsupportedZfs):116 UnsupportedZfs):
117 __test__ = True117 __test__ = True
118 arch = 'i386'118 target_arch = 'i386'
119119
120120
121class BionicTestZfsRootFsType(relbase.bionic, TestZfsRootFsTypeAbs):121class BionicTestZfsRootFsType(relbase.bionic, TestZfsRootFsTypeAbs):

Subscribers

People subscribed via source and target branches