Files
buildroot/support/testing/tests/download/test_ssh.py
Thomas Petazzoni d26f371758 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>
2025-08-24 16:50:33 +02:00

63 lines
1.9 KiB
Python

import os
import shutil
import tests.download.sshd
import infra
class SSHTestBase(infra.basetest.BRConfigTest):
config = infra.basetest.MINIMAL_CONFIG + '''
BR2_BACKUP_SITE=""
'''
sshd_test_dir = infra.filepath("tests/download/sshd")
sshd = None
def setUp(self):
super(SSHTestBase, self).setUp()
self.show_msg("Generating keys")
tests.download.sshd.generate_keys(self.builddir, self.logtofile)
self.show_msg("Starting sshd")
self.sshd = tests.download.sshd.OpenSSHDaemon(self.builddir,
self.logtofile)
def tearDown(self):
self.show_msg("Stopping sshd")
if self.sshd:
self.sshd.stop()
super(SSHTestBase, self).tearDown()
def download_package(self, package):
self.show_msg("Downloading {}".format(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")
ssh_identity = os.path.join(self.builddir,
tests.download.sshd.SSH_CLIENT_KEY)
# enforce that we test the download
if os.path.exists(dl_dir):
shutil.rmtree(dl_dir)
env = {"BR2_DL_DIR": dl_dir,
"SSHD_PORT_NUMBER": str(self.sshd.port),
"SSHD_TEST_DIR": self.sshd_test_dir,
"SSH_IDENTITY": ssh_identity}
self.b.build(["{}-dirclean".format(package),
"{}-source".format(package)],
env)
class TestSCP(SSHTestBase):
br2_external = [infra.filepath("tests/download/br2-external/ssh")]
def test_run(self):
self.download_package("scp")
class TestSFTP(SSHTestBase):
br2_external = [infra.filepath("tests/download/br2-external/ssh")]
def test_run(self):
self.download_package("sftp")