Skip to contentSkip to conversation

support/testing: use virtio-rng-pci to test syslog-ng

PATCH New Ricardo Martincoski 4 participants 4 messages Jul 30, 2019 – Aug 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/testing: use virtio-rng-pci to test syslog-ng

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.

---
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/262628554

---
 .../conf/syslog-ng-kernel-fragment.config     |  3 +++
 .../testing/tests/package/test_syslog_ng.py   | 20 ++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 support/testing/conf/syslog-ng-kernel-fragment.config
support/testing/conf/syslog-ng-kernel-fragment.config new file +3 -0
new file mode 100644
index 0000000000..5b96e418be
@@ -0,0 +1,3 @@
+CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_VIRTIO=y
+CONFIG_VIRTIO_PCI=y
support/testing/tests/package/test_syslog_ng.py +17 -3
index 0155ef14e4..d1444d3d0d 100644
@@ -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"
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 support/testing: use virtio-rng-pci to test syslog-ng

Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Ricardo" == Ricardo Martincoski <[email protected]> writes:

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

Quoted 7 lines

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

---
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/262628554

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 support/testing: use virtio-rng-pci to test syslog-ng

Quoted 17 lines · On Thu, 01 Aug 2019 20:32:09 +0200 Peter Korsgaard <[email protected]> wrote:
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Ricardo" == Ricardo Martincoski <[email protected]> writes:

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.

Quoted 6 lines
Quoted 4 lines

---
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/262628554

Committed, thanks.

Longer term, probably we should rebuild newer versions of the pre-built kernels, with the appropriate config options enabled. I guess other use-cases will also need some entropy at boot time.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 support/testing: use virtio-rng-pci to test syslog-ng

Quoted 25 lines · Thomas Petazzoni
Quoted 22 lines · On Thu, 01 Aug 2019 20:32:09 +0200 Peter Korsgaard <[email protected]> wrote:
Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Ricardo" == Ricardo Martincoski <[email protected]> writes:

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.

---
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/262628554

Quoted 5 lines
Quoted 1 line

Committed, thanks.

Longer term, probably we should rebuild newer versions of the pre-built kernels, with the appropriate config options enabled. I guess other use-cases will also need some entropy at boot time.

Make that short-term, because Romain just reported such an issue [1].

Regards,
Arnout

[1] http://lists.busybox.net/pipermail/buildroot/2019-August/255550.html