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