diff options
Diffstat (limited to 'gr-blocks/python/blocks/qa_pdu.py')
-rw-r--r--[-rwxr-xr-x] | gr-blocks/python/blocks/qa_pdu.py | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/gr-blocks/python/blocks/qa_pdu.py b/gr-blocks/python/blocks/qa_pdu.py index bbee3605ba..3ee5e576ea 100755..100644 --- a/gr-blocks/python/blocks/qa_pdu.py +++ b/gr-blocks/python/blocks/qa_pdu.py @@ -20,6 +20,7 @@ # Boston, MA 02110-1301, USA. # + import time from gnuradio import gr, gr_unittest, blocks @@ -55,18 +56,17 @@ class test_pdu(gr_unittest.TestCase): self.tb.connect(src, snk2) self.tb.connect(src, snk3) self.tb.msg_connect(snk3, "pdus", dbg, "store") - self.tb.start() # make our reference and message pmts port = pmt.intern("pdus") msg = pmt.cons( pmt.PMT_NIL, pmt.make_u8vector(16, 0xFF)) # post the message - src.to_basic_block()._post(port, msg) # eww, what's that smell? + src.to_basic_block()._post(port, msg) + src.to_basic_block()._post(pmt.intern("system"), + pmt.cons(pmt.intern("done"), pmt.PMT_T)) - while dbg.num_messages() < 1: - time.sleep(0.1) - self.tb.stop() + self.tb.start() self.tb.wait() # Get the vector of data from the vector sink @@ -80,7 +80,7 @@ class test_pdu(gr_unittest.TestCase): # Convert the PMT vector into a Python list msg_data = [] - for i in xrange(16): + for i in range(16): msg_data.append(pmt.u8vector_ref(msg_vec, i)) actual_data = 16*[0xFF,] @@ -98,18 +98,18 @@ class test_pdu(gr_unittest.TestCase): msg = pmt.cons( pmt.PMT_NIL, pmt.init_f32vector(10, src_data)) src.to_basic_block()._post(port, msg) + src.to_basic_block()._post(pmt.intern("system"), + pmt.cons(pmt.intern("done"), pmt.PMT_T)) self.tb.start() - #ideally, would wait until we get ten samples - time.sleep(0.2) - self.tb.stop() + self.tb.wait() self.assertEqual(src_data, list(snk.data()) ) def test_002_tags_plus_data(self): packet_len = 16 - src_data = range(packet_len) + src_data = list(range(packet_len)) tag1 = gr.tag_t() tag1.offset = 0 tag1.key = pmt.string_to_symbol('spam') @@ -125,9 +125,6 @@ class test_pdu(gr_unittest.TestCase): self.tb.connect(src, s2ts, ts2pdu) self.tb.msg_connect(ts2pdu, "pdus", dbg, "store") self.tb.start() - while dbg.num_messages() < 1: - time.sleep(0.1) - self.tb.stop() self.tb.wait() result_msg = dbg.get_message(0) metadata = pmt.to_python(pmt.car(result_msg)) @@ -138,4 +135,3 @@ class test_pdu(gr_unittest.TestCase): if __name__ == '__main__': gr_unittest.run(test_pdu, "test_pdu.xml") - |