Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing: add ethtool runtime test
@ 2024-04-16 21:39 Julien Olivain
  2024-05-09 14:34 ` Thomas Petazzoni via buildroot
  2024-05-31 15:33 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2024-04-16 21:39 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                    |  2 +
 support/testing/tests/package/test_ethtool.py | 71 +++++++++++++++++++
 .../test_ethtool/linux-e1000e.fragment        |  1 +
 3 files changed, 74 insertions(+)
 create mode 100644 support/testing/tests/package/test_ethtool.py
 create mode 100644 support/testing/tests/package/test_ethtool/linux-e1000e.fragment

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..a1b87b363eb 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1784,6 +1784,8 @@ F:	support/testing/tests/package/test_ddrescue.py
 F:	support/testing/tests/package/test_ddrescue/
 F:	support/testing/tests/package/test_dos2unix.py
 F:	support/testing/tests/package/test_ed.py
+F:	support/testing/tests/package/test_ethtool.py
+F:	support/testing/tests/package/test_ethtool/
 F:	support/testing/tests/package/test_file.py
 F:	support/testing/tests/package/test_file/
 F:	support/testing/tests/package/test_fluidsynth.py
diff --git a/support/testing/tests/package/test_ethtool.py b/support/testing/tests/package/test_ethtool.py
new file mode 100644
index 00000000000..7a2627c6e9e
--- /dev/null
+++ b/support/testing/tests/package/test_ethtool.py
@@ -0,0 +1,71 @@
+import os
+
+import infra.basetest
+
+
+class TestEthtool(infra.basetest.BRTest):
+    # This ethtool test uses an emulated Intel e1000e adapted (which
+    # is well supported by Qemu, the Kernel and ethtool). We are not
+    # using the usual virtio_net because it's not supporting some
+    # ethtool features like adapter testing. For that reason, we need
+    # to compile a Kernel.
+    kernel_fragment = \
+        infra.filepath("tests/package/test_ethtool/linux-e1000e.fragment")
+    config = \
+        f"""
+        BR2_aarch64=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.27"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+        BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{kernel_fragment}"
+        BR2_PACKAGE_ETHTOOL=y
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_4=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        drive = os.path.join(self.builddir, "images", "rootfs.ext4")
+        kern = os.path.join(self.builddir, "images", "Image")
+        self.emulator.boot(arch="aarch64",
+                           kernel=kern,
+                           kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
+                           options=["-M", "virt",
+                                    "-cpu", "cortex-a57",
+                                    "-m", "256M",
+                                    "-netdev", "user,id=test_net",
+                                    "-net", "nic,model=e1000e,netdev=test_net",
+                                    "-drive", f"file={drive},if=virtio,format=raw"])
+        self.emulator.login()
+
+        # We check the program can run.
+        self.assertRunOk("ethtool --version")
+
+        # We check a simple query runs correctly.
+        self.assertRunOk("ethtool eth0")
+
+        # We query the driver name and check it's the expected e1000e.
+        out, ret = self.emulator.run("ethtool -i eth0")
+        self.assertEqual(ret, 0)
+        self.assertEqual(out[0], "driver: e1000e")
+
+        # We request an adapter online self test.
+        self.assertRunOk("ethtool -t eth0 online", timeout=30)
+
+        # We query offload parameters and check TSO are enabled (this
+        # is the driver default).
+        out, ret = self.emulator.run("ethtool -k eth0")
+        self.assertEqual(ret, 0)
+        self.assertIn("tcp-segmentation-offload: on", out)
+
+        # We request to disable TSO.
+        self.assertRunOk("ethtool -K eth0 tcp-segmentation-offload off")
+
+        # We check again. TSO should now be disabled.
+        out, ret = self.emulator.run("ethtool -k eth0")
+        self.assertEqual(ret, 0)
+        self.assertIn("tcp-segmentation-offload: off", out)
diff --git a/support/testing/tests/package/test_ethtool/linux-e1000e.fragment b/support/testing/tests/package/test_ethtool/linux-e1000e.fragment
new file mode 100644
index 00000000000..cc3fe0047ee
--- /dev/null
+++ b/support/testing/tests/package/test_ethtool/linux-e1000e.fragment
@@ -0,0 +1 @@
+CONFIG_E1000E=y
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/testing: add ethtool runtime test
  2024-04-16 21:39 [Buildroot] [PATCH 1/1] support/testing: add ethtool runtime test Julien Olivain
@ 2024-05-09 14:34 ` Thomas Petazzoni via buildroot
  2024-05-31 15:33 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-09 14:34 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Tue, 16 Apr 2024 23:39:58 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                    |  2 +
>  support/testing/tests/package/test_ethtool.py | 71 +++++++++++++++++++
>  .../test_ethtool/linux-e1000e.fragment        |  1 +
>  3 files changed, 74 insertions(+)
>  create mode 100644 support/testing/tests/package/test_ethtool.py
>  create mode 100644 support/testing/tests/package/test_ethtool/linux-e1000e.fragment

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/testing: add ethtool runtime test
  2024-04-16 21:39 [Buildroot] [PATCH 1/1] support/testing: add ethtool runtime test Julien Olivain
  2024-05-09 14:34 ` Thomas Petazzoni via buildroot
@ 2024-05-31 15:33 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-05-31 15:33 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

>>>>> "Julien" == Julien Olivain <ju.o@free.fr> writes:

 > Signed-off-by: Julien Olivain <ju.o@free.fr>
 > ---
 >  DEVELOPERS                                    |  2 +
 >  support/testing/tests/package/test_ethtool.py | 71 +++++++++++++++++++
 >  .../test_ethtool/linux-e1000e.fragment        |  1 +
 >  3 files changed, 74 insertions(+)
 >  create mode 100644 support/testing/tests/package/test_ethtool.py
 >  create mode 100644 support/testing/tests/package/test_ethtool/linux-e1000e.fragment

Committed to 2024.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-31 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-16 21:39 [Buildroot] [PATCH 1/1] support/testing: add ethtool runtime test Julien Olivain
2024-05-09 14:34 ` Thomas Petazzoni via buildroot
2024-05-31 15:33 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox