2
1

test_dropbear.py 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import os
  2. import infra.basetest
  3. class TestDropbear(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_TARGET_GENERIC_ROOT_PASSWD="testpwd"
  7. BR2_SYSTEM_DHCP="eth0"
  8. BR2_PACKAGE_DROPBEAR=y
  9. BR2_TARGET_ROOTFS_CPIO=y
  10. # BR2_TARGET_ROOTFS_TAR is not set
  11. """
  12. def test_run(self):
  13. img = os.path.join(self.builddir, "images", "rootfs.cpio")
  14. self.emulator.boot(arch="armv5",
  15. kernel="builtin",
  16. options=["-initrd", img,
  17. "-net", "nic",
  18. "-net", "user,hostfwd=tcp::2222-:22"])
  19. self.emulator.login("testpwd")
  20. cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:22"
  21. _, exit_code = self.emulator.run(cmd)
  22. self.assertEqual(exit_code, 0)
  23. # Would be useful to try to login through SSH here, through
  24. # localhost:2222, though it is not easy to pass the ssh
  25. # password on the command line.