xref: /OK3568_Linux_fs/buildroot/support/testing/tests/package/test_redis.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1import os
2
3import infra.basetest
4
5
6class TestRedis(infra.basetest.BRTest):
7    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + """
8    BR2_TARGET_ROOTFS_CPIO=y
9    BR2_PACKAGE_REDIS=y
10    """
11
12    def test_run(self):
13        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
14        self.emulator.boot(arch="armv5",
15                           kernel="builtin",
16                           options=["-initrd", cpio_file])
17        self.emulator.login()
18
19        self.assertRunOk("redis-cli SET hello world")
20
21        output, exit_code = self.emulator.run("redis-cli GET hello")
22        self.assertEqual(exit_code, 0)
23        self.assertEqual(output[0].strip(), '"world"')
24