From: "Alexis Lothoré via buildroot" <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: "James Hilliard" <james.hilliard1@gmail.com>,
"Alexis Lothoré" <alexis.lothore@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH 2/2] support/testing: add runtime tests for python-scp
Date: Fri, 17 Oct 2025 09:42:47 +0200 [thread overview]
Message-ID: <20251017-python-scp-v1-2-b45644fa9afb@bootlin.com> (raw)
In-Reply-To: <20251017-python-scp-v1-0-b45644fa9afb@bootlin.com>
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>
---
support/testing/tests/package/sample_python_scp.py | 10 +++++++++
support/testing/tests/package/test_python_scp.py | 24 ++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/support/testing/tests/package/sample_python_scp.py b/support/testing/tests/package/sample_python_scp.py
new file mode 100644
index 0000000000000000000000000000000000000000..fdb4b720a9e6346a650e6d90120c598af9f2988d
--- /dev/null
+++ b/support/testing/tests/package/sample_python_scp.py
@@ -0,0 +1,10 @@
+from paramiko import SSHClient
+from paramiko.client import AutoAddPolicy
+from scp import SCPClient
+
+ssh_client = SSHClient()
+ssh_client.load_system_host_keys()
+ssh_client.set_missing_host_key_policy(AutoAddPolicy)
+ssh_client.connect('127.0.0.1', username='root')
+scp_client = SCPClient(ssh_client.get_transport())
+scp_client.get("/etc/hostname", "/tmp/hostname")
diff --git a/support/testing/tests/package/test_python_scp.py b/support/testing/tests/package/test_python_scp.py
new file mode 100644
index 0000000000000000000000000000000000000000..2cb4f1e67e6e74c643167f4c621e18895d36e6f6
--- /dev/null
+++ b/support/testing/tests/package/test_python_scp.py
@@ -0,0 +1,24 @@
+import os
+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
+ output, exit_code = self.emulator.run('mkdir /root/.ssh')
+ output, exit_code = self.emulator.run('dropbearkey -t ed25519 -f .ssh/id_dropbear')
+ output, exit_code = self.emulator.run('dropbearkey -y -f .ssh/id_dropbear|grep "^ssh-ed25519" > .ssh/authorized_keys')
+ output, exit_code = self.emulator.run('dropbearconvert dropbear openssh .ssh/id_dropbear .ssh/id_ed25519')
+
+ for script in self.sample_scripts:
+ cmd = self.interpreter + " " + os.path.basename(script)
+ self.assertRunOk(cmd, timeout=self.timeout)
--
2.51.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2025-10-17 7:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 7:42 [Buildroot] [PATCH 0/2] package/python-scp: new package Alexis Lothoré via buildroot
2025-10-17 7:42 ` [Buildroot] [PATCH 1/2] " Alexis Lothoré via buildroot
2025-10-18 14:42 ` Julien Olivain via buildroot
2025-10-19 8:40 ` Alexis Lothoré via buildroot
2025-10-17 7:42 ` Alexis Lothoré via buildroot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251017-python-scp-v1-2-b45644fa9afb@bootlin.com \
--to=buildroot@buildroot.org \
--cc=alexis.lothore@bootlin.com \
--cc=james.hilliard1@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.