discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unit testing of message passing blocks


From: Vasil Velichkov
Subject: Re: Unit testing of message passing blocks
Date: Wed, 8 Sep 2021 09:54:52 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Hi Malte,

Welcome to GNU Radio!

On 07/09/2021 23.42, Malte Lenhart wrote:
> This pattern does not seem to be uncommon, but I did not find a single
> instance with existing unit tests unfortunately..

Have a look at gr-zeromq's unit tests - [1], [2].

> Problem: when executing the python unit test, self.tb.run() blocks
> forever as the thread does not terminate. This only happens if the block
> is connected to another one in the flow graph.

Instead of tb.run() you can use tb.start(), tb.stop() and tb.wait()

[1] 
https://github.com/gnuradio/gnuradio/blob/4c6ae3a386ec19698a8c01144c4e8a52fc113404/gr-zeromq/python/zeromq/qa_zeromq_sub.py#L43-L49
[2] 
https://github.com/gnuradio/gnuradio/blob/4c6ae3a386ec19698a8c01144c4e8a52fc113404/gr-zeromq/python/zeromq/qa_zeromq_pull_msg_source.py#L35-L40

Regards,
Vasil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]