xref: /OK3568_Linux_fs/buildroot/support/testing/tests/package/test_execline.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyunimport os
2*4882a593Smuzhiyun
3*4882a593Smuzhiyunimport infra.basetest
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun
6*4882a593Smuzhiyunclass TestExecline(infra.basetest.BRTest):
7*4882a593Smuzhiyun    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
8*4882a593Smuzhiyun        """
9*4882a593Smuzhiyun        BR2_PACKAGE_EXECLINE=y
10*4882a593Smuzhiyun        BR2_TARGET_ROOTFS_CPIO=y
11*4882a593Smuzhiyun        # BR2_TARGET_ROOTFS_TAR is not set
12*4882a593Smuzhiyun        """
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun    def test_run(self):
15*4882a593Smuzhiyun        img = os.path.join(self.builddir, "images", "rootfs.cpio")
16*4882a593Smuzhiyun        self.emulator.boot(arch="armv5",
17*4882a593Smuzhiyun                           kernel="builtin",
18*4882a593Smuzhiyun                           options=["-initrd", img])
19*4882a593Smuzhiyun        self.emulator.login()
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun        output, exit_code = self.emulator.run("execlineb -c 'echo hello world'")
22*4882a593Smuzhiyun        self.assertEqual(exit_code, 0)
23*4882a593Smuzhiyun        self.assertEqual(output[0].strip(), "hello world")
24