1import os
2
3import infra.basetest
4
5
6class TestRdmaCore(infra.basetest.BRTest):
7
8    config = \
9        """
10        BR2_aarch64=y
11        BR2_TOOLCHAIN_EXTERNAL=y
12        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
13        BR2_LINUX_KERNEL=y
14        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
15        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.91"
16        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
17        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
18        BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{}"
19        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
20        BR2_TARGET_ROOTFS_CPIO=y
21        BR2_TARGET_ROOTFS_CPIO_GZIP=y
22        # BR2_TARGET_ROOTFS_TAR is not set
23        BR2_PACKAGE_IPROUTE2=y
24        BR2_PACKAGE_LIBMNL=y
25        BR2_PACKAGE_RDMA_CORE=y
26        """.format(
27            infra.filepath("tests/package/test_rdma_core/linux-rdma.fragment")
28        )
29
30    def test_run(self):
31        img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
32        kern = os.path.join(self.builddir, "images", "Image")
33        self.emulator.boot(arch="aarch64",
34                           kernel=kern,
35                           kernel_cmdline=["console=ttyAMA0"],
36                           options=["-M", "virt", "-cpu", "cortex-a57", "-m", "512M", "-initrd", img])
37        self.emulator.login()
38
39        # Add the rxe0 interface
40        self.assertRunOk("rdma link add rxe0 type rxe netdev eth0")
41
42        # ibv_devinfo returns 255 if no devices are found
43        self.assertRunOk("ibv_devinfo -v")
44