Skip to content

Commit b2f109e

Browse files
committed
test: split cross-arch test into its own file
This commit moves the cross arch build into its own file so that it ran run in parallel in the GH runners. Its is a relatively expensive test (~20min on my machine, ~30min on GH) so moving it out should save quite a bit of time.
1 parent 70d63cc commit b2f109e

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

test/test_build_cross.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import platform
2+
3+
import pytest
4+
5+
from testcases import gen_testcases
6+
7+
from test_build_disk import ( # pylint: disable=unused-import
8+
assert_disk_image_boots,
9+
build_container_fixture,
10+
gpg_conf_fixture,
11+
image_type_fixture,
12+
registry_conf_fixture,
13+
shared_tmpdir_fixture,
14+
)
15+
16+
17+
# This testcase is not part of "test_build_disk.py:test_image_boots"
18+
# because it takes ~30min on the GH runners so moving it into a
19+
# separate file ensures it is run in parallel on GH.
20+
@pytest.mark.skipif(platform.system() != "Linux", reason="boot test only runs on linux right now")
21+
@pytest.mark.parametrize("image_type", gen_testcases("qemu-cross"), indirect=["image_type"])
22+
def test_image_boots_cross(image_type):
23+
assert_disk_image_boots(image_type)

test/test_build_disk.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ def assert_kernel_args(test_vm, image_type):
520520
@pytest.mark.skipif(platform.system() != "Linux", reason="boot test only runs on linux right now")
521521
@pytest.mark.parametrize("image_type", gen_testcases("qemu-boot"), indirect=["image_type"])
522522
def test_image_boots(image_type):
523+
assert_disk_image_boots(image_type)
524+
525+
526+
def assert_disk_image_boots(image_type):
523527
with QEMU(image_type.img_path, arch=image_type.img_arch) as test_vm:
524528
# user/password login works
525529
exit_status, _ = test_vm.run("true", user=image_type.username, password=image_type.password)

test/testcases.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,24 @@ def gen_testcases(what): # pylint: disable=too-many-return-statements
100100
TestCaseC9S(image="anaconda-iso"),
101101
TestCaseC10S(image="anaconda-iso"),
102102
]
103+
if what == "qemu-cross":
104+
test_cases = []
105+
if platform.machine() == "x86_64":
106+
test_cases.append(
107+
TestCaseC9S(image="raw", target_arch="arm64"))
108+
elif platform.machine() == "arm64":
109+
# TODO: add arm64->x86_64 cross build test too
110+
pass
111+
return test_cases
103112
if what == "qemu-boot":
104-
test_cases = [
113+
return [
105114
# test default partitioning
106115
TestCaseFedora(image="qcow2"),
107116
# test with custom disk configs
108117
TestCaseC9S(image="qcow2", disk_config="swap"),
109118
TestCaseFedora(image="raw", disk_config="btrfs"),
110119
TestCaseC9S(image="raw", disk_config="lvm"),
111120
]
112-
# do a cross arch test too
113-
if platform.machine() == "x86_64":
114-
test_cases.append(
115-
TestCaseC9S(image="raw", target_arch="arm64"))
116-
elif platform.machine() == "arm64":
117-
# TODO: add arm64->x86_64 cross build test too
118-
pass
119-
return test_cases
120121
if what == "all":
121122
return [
122123
klass(image=img)

0 commit comments

Comments
 (0)