mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
Add a basic test involving a local SSH connection (based on dropbear server). The test validates that we are able, through python-scp, to fetch the /etc/hostname file. The test needs some basic key initialization to allow connecting to the dropbear server, hence the custom run_sample_scripts method. Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> [Julien: - remove unneeded os import in test script - execute setup commands with assertRunOk() - create /root/.ssh with 0700 mode - run sample scripts using super() - check in the sample file that copied files are the same ] Signed-off-by: Julien Olivain <ju.o@free.fr>
22 lines
803 B
Python
22 lines
803 B
Python
from tests.package.test_python import TestPythonPackageBase
|
|
|
|
|
|
class TestPythonSCP(TestPythonPackageBase):
|
|
__test__ = True
|
|
config = TestPythonPackageBase.config + \
|
|
"""
|
|
BR2_PACKAGE_DROPBEAR=y
|
|
BR2_PACKAGE_PYTHON3=y
|
|
BR2_PACKAGE_PYTHON_SCP=y
|
|
"""
|
|
sample_scripts = ["tests/package/sample_python_scp.py"]
|
|
|
|
def run_sample_scripts(self):
|
|
# Allow passwordless root login in SSH server
|
|
self.assertRunOk("mkdir -m 0700 /root/.ssh")
|
|
self.assertRunOk("dropbearkey -t ed25519 -f .ssh/id_dropbear")
|
|
self.assertRunOk("dropbearkey -y -f .ssh/id_dropbear | grep '^ssh-ed25519' > .ssh/authorized_keys")
|
|
self.assertRunOk("dropbearconvert dropbear openssh .ssh/id_dropbear .ssh/id_ed25519")
|
|
|
|
super().run_sample_scripts()
|