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