test_atftp.py 926 B

12345678910111213141516171819202122232425262728
  1. import os
  2. import infra.basetest
  3. class TestAtftp(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_PACKAGE_ATFTP=y
  7. # BR2_TARGET_ROOTFS_TAR is not set
  8. BR2_TARGET_ROOTFS_CPIO=y
  9. """
  10. def test_run(self):
  11. cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
  12. self.emulator.boot(arch="armv7",
  13. kernel="builtin",
  14. options=["-initrd", cpio_file])
  15. self.emulator.login()
  16. self.assertRunOk("mkdir -p /tftpboot")
  17. self.assertRunOk("echo 'Hello World' >/tftpboot/test_atftp.txt")
  18. # atftpd is launched by /etc/init.d/S80atftpd
  19. self.assertRunOk("atftp -g -r test_atftp.txt -l /tmp/test_atftp.txt localhost")
  20. output, exit_code = self.emulator.run("cat /tmp/test_atftp.txt")
  21. self.assertEqual("".join(output), "Hello World")