[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 07/18: blocks: use possibility to shutdown
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 07/18: blocks: use possibility to shutdown flow graph in unit tests |
Date: |
Fri, 1 Jul 2016 16:25:44 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch next
in repository gnuradio.
commit d35dcb7bc60e46f410b774c61aa8e5d69580a5de
Author: Bastian Bloessl <address@hidden>
Date: Thu Apr 21 09:26:40 2016 +0200
blocks: use possibility to shutdown flow graph in unit tests
---
gr-blocks/python/blocks/qa_pdu.py | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/gr-blocks/python/blocks/qa_pdu.py
b/gr-blocks/python/blocks/qa_pdu.py
index bbee360..79d39df 100755
--- a/gr-blocks/python/blocks/qa_pdu.py
+++ b/gr-blocks/python/blocks/qa_pdu.py
@@ -55,18 +55,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
@@ -98,11 +97,11 @@ 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()) )
@@ -125,9 +124,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 +134,3 @@ class test_pdu(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_pdu, "test_pdu.xml")
-
- [Commit-gnuradio] [gnuradio] branch next updated (5ff65f3 -> cbdaaa0), git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 07/18: blocks: use possibility to shutdown flow graph in unit tests,
git <=
- [Commit-gnuradio] [gnuradio] 08/18: runtime: block if message block doesn't produce, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 02/18: runtime: allow blocks w/ only msg inputs to exit, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 04/18: runtime: allow msg port block finish cleanly, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 06/18: runtime: use bool for system port message, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 03/18: runtime: set_done shouldn't be set in msg handlers, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 17/18: Merge branch 'master' into next, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 05/18: runtime: whitespace, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 01/18: runtime: remove unnecessary wakeup of neighbors, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 13/18: runtime: scheduler: check changed at beginning, git, 2016/07/01
- [Commit-gnuradio] [gnuradio] 16/18: runtime: poll blocks, git, 2016/07/01