Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Marcus Hoffmann <marcus.hoffmann@othermo.de>
Cc: Davide Viti <zinosat@gmail.com>, Asaf Kahlon <asafka7@gmail.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [next v2 2/2] support/testing/tests/package/test_python_paho_mqtt: new runtime test
Date: Wed, 31 Aug 2022 21:42:43 +0200	[thread overview]
Message-ID: <20220831194243.GH68979@scaer> (raw)
In-Reply-To: <20220829171820.130690-1-marcus.hoffmann@othermo.de>

Markus, All,

On 2022-08-29 19:18 +0200, Marcus Hoffmann spake thusly:
> Signed-off-by: Marcus Hoffmann <marcus.hoffmann@othermo.de>
> Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
[--SNIP--]
> diff --git a/support/testing/tests/package/test_python_paho_mqtt.py b/support/testing/tests/package/test_python_paho_mqtt.py
> new file mode 100644
> index 0000000000..b1e2b8fb42
> --- /dev/null
> +++ b/support/testing/tests/package/test_python_paho_mqtt.py
> @@ -0,0 +1,29 @@
[--SNIP--]
> +    def test_run(self):
> +        self.login()
> +        self.check_sample_scripts_exist()
> +        cmd = "mosquitto > /dev/null 2>&1 &"
> +        _, exit_code = self.emulator.run(cmd, timeout=self.timeout)

No need to manually start it, it is already started with a startu
script, as can be seen n the run log:

    Starting mosquitto: OK

And indeed, manually running the qemu on the test image, and trying to
launch mosquitto yields an error:

    [...]
    Starting network: OK
    Starting mosquitto: OK

    Welcome to Buildroot
    buildroot login: root
    # mosquitto
    [...]
    11: Opening ipv4 listen socket on port 1883.
    11: Error: Address already in use
    11: Opening ipv6 listen socket on port 1883.
    11: Error: Address already in use

So I dropped, that.

> +        # Give some time for mosquitto broker to start up
> +        time.sleep(1)

And thus, that too.

> +        cmd = "%s %s" % (self.interpreter, os.path.basename(self.sample_scripts[0]))
> +        output, exit_code = self.emulator.run(cmd, timeout=self.timeout)

The test class does not provide its own timeout, so it inherits the one
from its base classs, which defines it as -1, which means no timeout, as
is the default for emulator.run(), so I also dropped it.

Applied to master with the above changes, thanks.

Regards,
Yann E. MORIN.

> +        self.assertEqual(exit_code, 0)
> +        self.assertEqual(output[0], "Hello, World!")
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-08-31 19:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 17:18 [Buildroot] [next v2 2/2] support/testing/tests/package/test_python_paho_mqtt: new runtime test Marcus Hoffmann
2022-08-31 19:42 ` Yann E. MORIN [this message]
2022-08-31 19:44   ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220831194243.GH68979@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=asafka7@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=marcus.hoffmann@othermo.de \
    --cc=zinosat@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox