support/testing: add atftp test

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Brandon Maier
2024-07-02 15:18:45 +00:00
committed by Thomas Petazzoni
parent e912b3bcfa
commit 6b625b42aa
2 changed files with 29 additions and 0 deletions

View File

@@ -551,6 +551,7 @@ F: package/python-pysensors/
F: package/qoriq-fm-ucode/
F: package/unifdef/
F: package/vmtouch/
F: support/testing/tests/package/test_atftp.py
F: support/testing/tests/package/test_zip.py
N: Brock Williams <brock@cottonwoodcomputer.com>

View File

@@ -0,0 +1,28 @@
import os
import infra.basetest
class TestAtftp(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_PACKAGE_ATFTP=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_ROOTFS_CPIO=y
"""
def test_run(self):
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", cpio_file])
self.emulator.login()
self.assertRunOk("mkdir -p /tftpboot")
self.assertRunOk("echo 'Hello World' >/tftpboot/test_atftp.txt")
# atftpd is launched by /etc/init.d/S80atftpd
self.assertRunOk("atftp -g -r test_atftp.txt -l /tmp/test_atftp.txt localhost")
output, exit_code = self.emulator.run("cat /tmp/test_atftp.txt")
self.assertEqual("".join(output), "Hello World")