From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBF89C27C44 for ; Sat, 1 Jun 2024 23:03:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 607D04012D; Sat, 1 Jun 2024 23:03:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id KAEUI4xG68JU; Sat, 1 Jun 2024 23:03:53 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6D77240160 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 6D77240160; Sat, 1 Jun 2024 23:03:53 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 0ED841BF396 for ; Sat, 1 Jun 2024 23:03:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EFA6680DB4 for ; Sat, 1 Jun 2024 23:03:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id FoyHmk4vLB2Z for ; Sat, 1 Jun 2024 23:03:51 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.27.42.1; helo=smtp1-g21.free.fr; envelope-from=ju.o@free.fr; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 0F49F80C3B DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0F49F80C3B Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0F49F80C3B for ; Sat, 1 Jun 2024 23:03:50 +0000 (UTC) Received: from home.juju.sh (unknown [IPv6:2a01:e0a:485:b220:8213:2270:4a8d:a1d5]) (Authenticated sender: ju.o@free.fr) by smtp1-g21.free.fr (Postfix) with ESMTPSA id 6E43EB00548; Sun, 2 Jun 2024 01:03:46 +0200 (CEST) From: Julien Olivain To: buildroot@buildroot.org Date: Sun, 2 Jun 2024 01:03:40 +0200 Message-ID: <20240601230340.1242345-1-ju.o@free.fr> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1717283027; bh=CTI2oxBxtQTK8koyYgW3LhmzGT/7V28O+76feq1AGEg=; h=From:To:Cc:Subject:Date:From; b=VDzIrvDefjUoVTiHdsrOGX6UipWBkSYjfLB/5VJJDZIluccRkooxULC4GAf7YUJ6W xkNtPoHDv2gphp80JXRtmesfLzCVX/9nXVnt2n9fw4mAyNhp87aOmKKS3x6hjdUtXw ZxsxI+vTy98Y8/+N89xdIIOxvHjkGI/NllzM/t6jaYr9ON2FNgA7sw2Sqpw2HyXNKx nJwTW9s//F4yT4NdgMbH4BFvms/2Fx/f7iR62yhbSMEyBla5VPsw77a8R9By2da/Ke VksVcXa559O+Wl+BhxZEn0wqL6X7H33xcuhUSGr7KPYoKBPH9LIfpyGxAQ6sRS6A0h A+Vs3FfFOaDCg== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=free.fr X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=free.fr header.i=@free.fr header.a=rsa-sha256 header.s=smtp-20201208 header.b=VDzIrvDe Subject: [Buildroot] [PATCH 1/1] support/testing: add mosquitto runtime test X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julien Olivain Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Signed-off-by: Julien Olivain --- DEVELOPERS | 1 + .../testing/tests/package/test_mosquitto.py | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 support/testing/tests/package/test_mosquitto.py diff --git a/DEVELOPERS b/DEVELOPERS index b9568ed7c58..5ca0662ab65 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1861,6 +1861,7 @@ F: support/testing/tests/package/test_mdadm.py F: support/testing/tests/package/test_mdadm/ F: support/testing/tests/package/test_micropython.py F: support/testing/tests/package/test_micropython/ +F: support/testing/tests/package/test_mosquitto.py F: support/testing/tests/package/test_mtools.py F: support/testing/tests/package/test_mtr.py F: support/testing/tests/package/test_ncdu.py diff --git a/support/testing/tests/package/test_mosquitto.py b/support/testing/tests/package/test_mosquitto.py new file mode 100644 index 00000000000..ba10b30b00b --- /dev/null +++ b/support/testing/tests/package/test_mosquitto.py @@ -0,0 +1,38 @@ +import os +import time + +import infra.basetest + + +class TestMosquitto(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_PACKAGE_MOSQUITTO=y + BR2_PACKAGE_MOSQUITTO_BROKER=y + 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() + + topic = "br-test-topic" + log = "mqtt.log" + msg = "Hello Buildroot!" + + # We subscribe to a topic and write one message to a log file. + self.assertRunOk(f"mosquitto_sub -t {topic} -C 1 > {log} &") + + time.sleep(1) + + # We publish a message. + self.assertRunOk(f"mosquitto_pub -t {topic} -m '{msg}'") + + # We check the log file contains our message. + out, ret = self.emulator.run(f"cat {log}") + self.assertEqual(ret, 0) + self.assertEqual(out[0], msg) -- 2.45.1 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot