Files
rpi-buildroot/support/testing/tests/package/test_rust.py
Thomas Petazzoni 3a5940bc46 support/testing: use again the default BR2_BACKUP_SITE
This reverts commit 559bb33ae7, which
was disabling BR2_BACKUP_SITE in our tests with the following
reasoning:

    support/testing: do not use s.b.o

    Currently, the runtime tests will use the sources.buildroot.org backup
    mirror, which is the default setup.

    However, in some cases we do not want to use the backup site, because we
    want to ensure that the download actually works.

    This is the case for vendored packages, like cargo or golang packages,
    for whbich we want to check that gthe download still works when we
    update the rust or go versions, or when our download helpers change.

    So, disable the use of the backup site in all runtime tests, and drop
    the no-longer needed special cases.

    Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
    Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

However, not using the backup site is causing a LOT of random failures
in Gitlab CI, making the results barely usable. Since it's more
important to get real failures than random ones due to download
issues, let's re-enable BR2_BACKUP_SITE in our testing infrastructure.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
(cherry picked from commit d26f371758)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2025-09-05 17:20:04 +02:00

99 lines
2.6 KiB
Python

import os
import shutil
import infra.basetest
class TestRustBase(infra.basetest.BRTest):
def login(self):
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestRustBin(TestRustBase):
config = \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_SYSTEM_DHCP="eth0"
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_RUSTC=y
BR2_PACKAGE_RIPGREP=y
"""
def test_run(self):
self.login()
self.assertRunOk("rg Buildroot /etc/issue")
class TestRust(TestRustBase):
config = \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_SYSTEM_DHCP="eth0"
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_RUSTC=y
BR2_PACKAGE_HOST_RUST=y
BR2_PACKAGE_RIPGREP=y
"""
def test_run(self):
self.login()
self.assertRunOk("rg Buildroot /etc/issue")
class TestRustVendoring(infra.basetest.BRConfigTest):
config = \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_RUSTC=y
BR2_PACKAGE_RIPGREP=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
BR2_BACKUP_SITE=""
"""
def setUp(self):
super(TestRustVendoring, self).setUp()
def tearDown(self):
self.show_msg("Cleaning up")
if self.b and not self.keepbuilds:
self.b.delete()
def check_download(self, package):
# store downloaded tarball inside the output dir so the test infra
# cleans it up at the end
dl_dir = os.path.join(self.builddir, "dl")
# enforce we test the download
if os.path.exists(dl_dir):
shutil.rmtree(dl_dir)
env = {"BR2_DL_DIR": dl_dir}
self.b.build(["{}-dirclean".format(package),
"{}-legal-info".format(package)],
env)
def test_run(self):
self.check_download("ripgrep")
self.check_download("python-cryptography")