|
@@ -25,13 +25,19 @@ class TestMosquitto(infra.basetest.BRTest):
|
|
msg = "Hello Buildroot!"
|
|
msg = "Hello Buildroot!"
|
|
|
|
|
|
# We subscribe to a topic and write one message to a log file.
|
|
# We subscribe to a topic and write one message to a log file.
|
|
- self.assertRunOk(f"mosquitto_sub -t {topic} -C 1 > {log} &")
|
|
|
|
|
|
+ cmd = f"( mosquitto_sub -t {topic} -C 1 > {log} 2> /dev/null & )"
|
|
|
|
+ self.assertRunOk(cmd)
|
|
|
|
|
|
- time.sleep(1)
|
|
|
|
|
|
+ # We give some time to the subscriber process to settle.
|
|
|
|
+ time.sleep(5)
|
|
|
|
|
|
# We publish a message.
|
|
# We publish a message.
|
|
self.assertRunOk(f"mosquitto_pub -t {topic} -m '{msg}'")
|
|
self.assertRunOk(f"mosquitto_pub -t {topic} -m '{msg}'")
|
|
|
|
|
|
|
|
+ # We give some more time to the subscriber process to write
|
|
|
|
+ # the log and quit.
|
|
|
|
+ time.sleep(5)
|
|
|
|
+
|
|
# We check the log file contains our message.
|
|
# We check the log file contains our message.
|
|
out, ret = self.emulator.run(f"cat {log}")
|
|
out, ret = self.emulator.run(f"cat {log}")
|
|
self.assertEqual(ret, 0)
|
|
self.assertEqual(ret, 0)
|