support/testing: use virtio-rng-pci to test syslog-ng
authorRicardo Martincoski <ricardo.martincoski@gmail.com>
Tue, 30 Jul 2019 23:13:21 +0000 (20:13 -0300)
committerPeter Korsgaard <peter@korsgaard.com>
Thu, 1 Aug 2019 18:31:54 +0000 (20:31 +0200)
Recent versions of syslog-ng need some entropy on startup.
So use VirtIORNG to provide it. In order to accomplish this:
 - build the kernel containing the driver;
 - pass '-device virtio-rng-pci' to qemu.

Use the same kernel version and kernel config as qemu_arm_versatile.
It already has PCI enabled but it does not have HW_RANDOM_VIRTIO, so add
a defconfig fragment to enable the drivers.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/259856394

At the same time, fix a typo (missing '#') that resulted in the
generation of root.tar. This file is not used in the test.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
support/testing/conf/syslog-ng-kernel-fragment.config [new file with mode: 0644]
support/testing/tests/package/test_syslog_ng.py

diff --git a/support/testing/conf/syslog-ng-kernel-fragment.config b/support/testing/conf/syslog-ng-kernel-fragment.config
new file mode 100644 (file)
index 0000000..5b96e41
--- /dev/null
@@ -0,0 +1,3 @@
+CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_VIRTIO=y
+CONFIG_VIRTIO_PCI=y
index 0155ef14e4dcd680a6da62804eb6eb4b12496c24..d1444d3d0ddc2fa9317b49c1d9540ab199aac004 100644 (file)
@@ -6,15 +6,29 @@ import infra.basetest
 class TestSyslogNg(infra.basetest.BRTest):
     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
         """
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.16"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/arm-versatile/linux.config"
+        BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{}"
+        BR2_LINUX_KERNEL_DTS_SUPPORT=y
+        BR2_LINUX_KERNEL_INTREE_DTS_NAME="versatile-pb"
         BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
         BR2_PACKAGE_SYSLOG_NG=y
         BR2_TARGET_ROOTFS_CPIO=y
-        BR2_TARGET_ROOTFS_TAR is not set
-        """
+        BR2_TARGET_ROOTFS_TAR is not set
+        """.format(infra.filepath("conf/syslog-ng-kernel-fragment.config"))
 
     def test_run(self):
+        kernel = os.path.join(self.builddir, "images", "zImage")
         cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
-        self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file])
+        dtb = os.path.join(self.builddir, "images", "versatile-pb.dtb")
+        options = ["-M", "versatilepb",
+                   "-dtb", dtb,
+                   "-initrd", cpio_file,
+                   "-device", "virtio-rng-pci"]
+        self.emulator.boot(arch="armv5", kernel=kernel, options=options)
         self.emulator.login()
 
         cmd = "grep syslog-ng /var/log/messages | grep starting"