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

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                    |  2 +
 support/testing/tests/package/test_netsnmp.py | 44 +++++++++++++++++++
 .../rootfs-overlay/etc/snmp/snmpd.conf        |  4 ++
 3 files changed, 50 insertions(+)
 create mode 100644 support/testing/tests/package/test_netsnmp.py
 create mode 100644 support/testing/tests/package/test_netsnmp/rootfs-overlay/etc/snmp/snmpd.conf

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..0b258e3cb96 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1831,6 +1831,8 @@ F:	support/testing/tests/package/test_mtools.py
 F:	support/testing/tests/package/test_mtr.py
 F:	support/testing/tests/package/test_ncdu.py
 F:	support/testing/tests/package/test_netcat.py
+F:	support/testing/tests/package/test_netsnmp.py
+F:	support/testing/tests/package/test_netsnmp/
 F:	support/testing/tests/package/test_nftables.py
 F:	support/testing/tests/package/test_nftables/
 F:	support/testing/tests/package/test_ngrep.py
diff --git a/support/testing/tests/package/test_netsnmp.py b/support/testing/tests/package/test_netsnmp.py
new file mode 100644
index 00000000000..9561e49828d
--- /dev/null
+++ b/support/testing/tests/package/test_netsnmp.py
@@ -0,0 +1,44 @@
+import os
+
+import infra.basetest
+
+
+class TestNetSNMP(infra.basetest.BRTest):
+    rootfs_overlay = \
+        infra.filepath("tests/package/test_netsnmp/rootfs-overlay")
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        f"""
+        BR2_PACKAGE_NETSNMP=y
+        BR2_ROOTFS_OVERLAY="{rootfs_overlay}"
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        # We check the daemon and a client program can execute.
+        self.assertRunOk("snmpd --version")
+        self.assertRunOk("snmpget --version")
+
+        # The daemon is supposed to be started by the initscript,
+        # since we included a /etc/snmp/snmpd.conf file. We should be
+        # able to walk through the SNMPv2 system MIB.
+        self.assertRunOk("snmpwalk -v 2c -c public 127.0.0.1 system")
+
+        # We check few OIDs has the expected values. sysContact and
+        # sysLocation are set in the snmpd.conf file.
+        tests = [
+            ("system.sysName.0", "STRING: buildroot"),
+            ("system.sysContact.0", "STRING: Buildroot Test User"),
+            ("system.sysLocation.0", "STRING: Buildroot Test Infra")
+        ]
+        for oid, expected_out in tests:
+            cmd = f"snmpget -v 2c -c public -Ov 127.0.0.1 {oid}"
+            out, ret = self.emulator.run(cmd)
+            self.assertEqual(ret, 0)
+            self.assertEqual(out[0], expected_out)
diff --git a/support/testing/tests/package/test_netsnmp/rootfs-overlay/etc/snmp/snmpd.conf b/support/testing/tests/package/test_netsnmp/rootfs-overlay/etc/snmp/snmpd.conf
new file mode 100644
index 00000000000..63a33694f19
--- /dev/null
+++ b/support/testing/tests/package/test_netsnmp/rootfs-overlay/etc/snmp/snmpd.conf
@@ -0,0 +1,4 @@
+# This is a simple configuration for testing.
+syslocation Buildroot Test Infra
+syscontact Buildroot Test User
+rocommunity public default system
-- 
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 netsnmp runtime test
  2024-04-17 22:06 [Buildroot] [PATCH 1/1] support/testing: add netsnmp runtime test Julien Olivain
@ 2024-05-09 15:17 ` Thomas Petazzoni via buildroot
  2024-05-31 16:52 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-09 15:17 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Thu, 18 Apr 2024 00:06:10 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                    |  2 +
>  support/testing/tests/package/test_netsnmp.py | 44 +++++++++++++++++++
>  .../rootfs-overlay/etc/snmp/snmpd.conf        |  4 ++
>  3 files changed, 50 insertions(+)
>  create mode 100644 support/testing/tests/package/test_netsnmp.py
>  create mode 100644 support/testing/tests/package/test_netsnmp/rootfs-overlay/etc/snmp/snmpd.conf

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 netsnmp runtime test
  2024-04-17 22:06 [Buildroot] [PATCH 1/1] support/testing: add netsnmp runtime test Julien Olivain
  2024-05-09 15:17 ` Thomas Petazzoni via buildroot
@ 2024-05-31 16:52 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-05-31 16:52 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>

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 16:52 UTC | newest]

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

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