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
1diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
2index 1fe041d..a81003d 100644
3--- a/tests/vmtests/__init__.py
4+++ b/tests/vmtests/__init__.py
5@@ -627,6 +627,7 @@ class VMBaseClass(TestCase):
6 # these get set from base_vm_classes
7 release = None
8 arch = None
9+ target_arch = None
10 kflavor = None
11 krel = None
12 distro = None
13@@ -653,7 +654,7 @@ class VMBaseClass(TestCase):
14 logger.debug('cls.ephemeral_ftype: %s', cls.ephemeral_ftype)
15 logger.debug('cls.target_ftype: %s', cls.target_ftype)
16 eph_img_verstr, ftypes = get_images(
17- IMAGE_SRC_URL, IMAGE_DIR, cls.distro, cls.release, cls.arch,
18+ IMAGE_SRC_URL, IMAGE_DIR, cls.distro, cls.release, cls.target_arch,
19 krel=cls.krel if cls.krel else cls.release,
20 kflavor=cls.kflavor if cls.kflavor else None,
21 subarch=cls.subarch if cls.subarch else None,
22@@ -676,7 +677,7 @@ class VMBaseClass(TestCase):
23 IMAGE_SRC_URL, IMAGE_DIR,
24 cls.target_distro,
25 cls.target_release,
26- cls.arch, subarch=cls.subarch if cls.subarch else None,
27+ cls.target_arch, subarch=cls.subarch if cls.subarch else None,
28 kflavor=cls.kflavor if cls.kflavor else None,
29 krel=cls.target_krel, sync=CURTIN_VMTEST_IMAGE_SYNC,
30 ftypes=(tftype,))
31@@ -912,7 +913,7 @@ class VMBaseClass(TestCase):
32 dowait = "--dowait"
33
34 # create launch cmd
35- cmd = ["tools/launch", "--arch=" + cls.arch, "-v", dowait,
36+ cmd = ["tools/launch", "--arch=" + cls.target_arch, "-v", dowait,
37 "--smp=" + cls.get_config_smp(), "--mem=%s" % str(cls.mem)]
38 if not cls.interactive:
39 cmd.extend(["--silent", "--power=off"])
40@@ -1317,7 +1318,7 @@ class VMBaseClass(TestCase):
41 ["--", "-smp", cls.get_config_smp(), "-m", str(cls.mem)])
42
43 if not cls.interactive:
44- if cls.arch == 's390x':
45+ if cls.target_arch == 's390x':
46 cmd.extend([
47 "-nographic", "-nodefaults", "-chardev",
48 "file,path=%s,id=charconsole0" % cls.boot_log,
49@@ -1722,7 +1723,7 @@ class VMBaseClass(TestCase):
50 raise SkipTest("kernel-img.conf not needed in non-ubuntu releases")
51 kconf = 'kernel-img.conf'
52 self.output_files_exist([kconf])
53- if self.arch in ['i386', 'amd64']:
54+ if self.target_arch in ['i386', 'amd64']:
55 self.check_file_strippedline(kconf, 'link_in_boot = no')
56 else:
57 self.check_file_strippedline(kconf, 'link_in_boot = yes')
58@@ -1845,7 +1846,7 @@ class PsuedoVMBaseClass(VMBaseClass):
59 kernel, initrd, tarball."""
60
61 def get_psuedo_path(name):
62- return os.path.join(IMAGE_DIR, cls.release, cls.arch, name)
63+ return os.path.join(IMAGE_DIR, cls.release, cls.target_arch, name)
64
65 return {
66 'squashfs': get_psuedo_path('psuedo-squashfs'),
67diff --git a/tests/vmtests/helpers.py b/tests/vmtests/helpers.py
68index 6dddcc6..835baed 100644
69--- a/tests/vmtests/helpers.py
70+++ b/tests/vmtests/helpers.py
71@@ -8,6 +8,8 @@ import signal
72 import threading
73 from unittest import TestLoader
74
75+from curtin.util import get_platform_arch
76+
77
78 class Command(object):
79 """
80@@ -135,14 +137,17 @@ def find_testcases(**kwargs):
81
82 def find_arches():
83 """
84- Return a list of uniq arch values from test cases
85+ Return a list of uniq target arch values from test cases
86 """
87- arches = []
88+ arch = get_platform_arch()
89+ target_arches = []
90 for test_case in find_testcases():
91- arch = getattr(test_case, 'arch', None)
92- if arch and arch not in arches:
93- arches.append(arch)
94- return arches
95+ if arch in getattr(test_case, 'arch_skip', None):
96+ continue
97+ target_arch = getattr(test_case, 'target_arch', None)
98+ if target_arch and target_arch not in target_arches:
99+ target_arches.append(target_arch)
100+ return target_arches
101
102
103 def find_releases_by_distro():
104diff --git a/tests/vmtests/releases.py b/tests/vmtests/releases.py
105index 6cc0d8b..16302e8 100644
106--- a/tests/vmtests/releases.py
107+++ b/tests/vmtests/releases.py
108@@ -6,6 +6,7 @@ from curtin.util import get_platform_arch
109 class _ReleaseBase(object):
110 repo = "maas-daily"
111 arch = get_platform_arch()
112+ target_arch = arch
113 mem = "1024"
114
115
116diff --git a/tests/vmtests/test_basic.py b/tests/vmtests/test_basic.py
117index 4d5008c..c15dd50 100644
118--- a/tests/vmtests/test_basic.py
119+++ b/tests/vmtests/test_basic.py
120@@ -264,7 +264,7 @@ class Centos66BionicTestBasic(centos_relbase.centos66_bionic,
121
122 class XenialGAi386TestBasic(relbase.xenial_ga, TestBasicAbs):
123 __test__ = True
124- arch = 'i386'
125+ target_arch = 'i386'
126
127
128 class XenialGATestBasic(relbase.xenial_ga, TestBasicAbs):
129diff --git a/tests/vmtests/test_old_apt_features.py b/tests/vmtests/test_old_apt_features.py
130index a114bf4..5a5415c 100644
131--- a/tests/vmtests/test_old_apt_features.py
132+++ b/tests/vmtests/test_old_apt_features.py
133@@ -56,11 +56,12 @@ class TestOldAptAbs(VMBaseClass):
134 exit 0
135 """)]
136 arch = util.get_architecture()
137- if arch in ['amd64', 'i386']:
138+ target_arch = arch
139+ if target_arch in ['amd64', 'i386']:
140 conf_file = "examples/tests/test_old_apt_features.yaml"
141 exp_mirror = "http://us.archive.ubuntu.com/ubuntu"
142 exp_secmirror = "http://archive.ubuntu.com/ubuntu"
143- if arch in ['s390x', 'arm64', 'armhf', 'powerpc', 'ppc64el']:
144+ if target_arch in ['s390x', 'arm64', 'armhf', 'powerpc', 'ppc64el']:
145 conf_file = "examples/tests/test_old_apt_features_ports.yaml"
146 exp_mirror = "http://ports.ubuntu.com/ubuntu-ports"
147 exp_secmirror = "http://ports.ubuntu.com/ubuntu-ports"
148diff --git a/tests/vmtests/test_zfsroot.py b/tests/vmtests/test_zfsroot.py
149index c0cfe01..59bb64b 100644
150--- a/tests/vmtests/test_zfsroot.py
151+++ b/tests/vmtests/test_zfsroot.py
152@@ -74,7 +74,7 @@ class UnsupportedZfs(VMBaseClass):
153 class XenialGAi386TestZfsRoot(relbase.xenial_ga, TestZfsRootAbs,
154 UnsupportedZfs):
155 __test__ = True
156- arch = 'i386'
157+ target_arch = 'i386'
158
159
160 class XenialGATestZfsRoot(relbase.xenial_ga, TestZfsRootAbs):
161@@ -115,7 +115,7 @@ class XenialGATestZfsRootFsType(relbase.xenial_ga, TestZfsRootFsTypeAbs):
162 class XenialGAi386TestZfsRootFsType(relbase.xenial_ga, TestZfsRootFsTypeAbs,
163 UnsupportedZfs):
164 __test__ = True
165- arch = 'i386'
166+ target_arch = 'i386'
167
168
169 class BionicTestZfsRootFsType(relbase.bionic, TestZfsRootFsTypeAbs):

Subscribers

People subscribed via source and target branches