test: add cross-build end-to-end test
This commit uses the new `build --arch=` support to perform a cross arch build for aarch64, ppc64le, riscv64, s390x on fedora. We could do also centos-9 each arch is already 20min.
This commit is contained in:
parent
8e6a6673f5
commit
cd1b5bae64
3 changed files with 30 additions and 0 deletions
|
|
@ -96,3 +96,29 @@ def test_container_with_progress(tmp_path, build_fake_container, progress, needl
|
|||
], text=True)
|
||||
assert needle in output
|
||||
assert forbidden not in output
|
||||
|
||||
|
||||
# only test a subset here to avoid overly long runtimes
|
||||
@pytest.mark.parametrize("arch", ["aarch64", "ppc64le", "riscv64", "s390x"])
|
||||
def test_container_cross_build(tmp_path, build_container, arch):
|
||||
# this is only here to speed up builds by sharing downloaded stuff
|
||||
# when this is run locally (we could cache via GH action though)
|
||||
os.makedirs("/var/cache/image-builder/store", exist_ok=True)
|
||||
output_dir = tmp_path / "output"
|
||||
output_dir.mkdir()
|
||||
subprocess.check_call([
|
||||
"podman", "run",
|
||||
"--privileged",
|
||||
"-v", "/var/lib/containers/storage:/var/lib/containers/storage",
|
||||
"-v", "/var/cache/image-builder/store:/var/cache/image-builder/store",
|
||||
"-v", f"{output_dir}:/output",
|
||||
build_container,
|
||||
"build",
|
||||
"--progress=verbose",
|
||||
"--output-dir=/output",
|
||||
"container",
|
||||
"--distro", "fedora-41",
|
||||
# selecting a foreign arch here automatically triggers a cross-build
|
||||
f"--arch={arch}",
|
||||
], text=True)
|
||||
assert os.path.exists(output_dir / f"fedora-41-container-{arch}.tar")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue