summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Long <willcode4@gmail.com>2021-02-13 13:00:34 -0500
committerMartin Braun <martin@gnuradio.org>2021-02-15 01:09:41 -0800
commit0351066c8b2398eb5894d89fd8ed37cdab43368d (patch)
tree4835a79c60454d3383910dd4aaa219bc0655d36a
parentffd67d14dcd0f08f8ff6fa7a5f8386d20ebeb92f (diff)
gr-digital: qa_header_payload_demux fix
The HeaderToMessageBlock adapter assumed it would receive a complete header in work(). Also, forecast() is not currently working for Python blocks, so a local buffer was required in the adapter. Two asserts needed list(). Signed-off-by: Jeff Long <willcode4@gmail.com>
-rw-r--r--.github/workflows/make-test.yml8
-rw-r--r--gr-digital/python/digital/qa_header_payload_demux.py12
2 files changed, 12 insertions, 8 deletions
diff --git a/.github/workflows/make-test.yml b/.github/workflows/make-test.yml
index 913553848b..88a8a0411c 100644
--- a/.github/workflows/make-test.yml
+++ b/.github/workflows/make-test.yml
@@ -49,7 +49,7 @@ jobs:
- name: Make
run: 'cd /build && make -j2'
- name: Make Test
- run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_header_payload_demux|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
+ run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
fedora33:
name: Fedora 33
needs: check-formatting
@@ -67,7 +67,7 @@ jobs:
- name: Make
run: 'cd /build && make -j2'
- name: Make Test
- run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_header_payload_demux|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
+ run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
centos8_3:
name: Centos 8.3
needs: check-formatting
@@ -85,7 +85,7 @@ jobs:
- name: Make
run: 'cd /build && make -j2'
- name: Make Test
- run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_header_payload_demux|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
+ run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
debian10:
name: Debian 10
needs: check-formatting
@@ -103,4 +103,4 @@ jobs:
- name: Make
run: 'cd /build && make -j2'
- name: Make Test
- run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_header_payload_demux|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
+ run: 'cd /build && ctest --output-on-failure -E "qa_uhd|qa_uncaught_exception|qa_agc|qa_cpp_py_binding|qa_cpp_py_binding_set|qa_ctrlport_probes|qa_file_taps_loader|qa_qtgui"'
diff --git a/gr-digital/python/digital/qa_header_payload_demux.py b/gr-digital/python/digital/qa_header_payload_demux.py
index 76be0905f0..d02e9e984d 100644
--- a/gr-digital/python/digital/qa_header_payload_demux.py
+++ b/gr-digital/python/digital/qa_header_payload_demux.py
@@ -31,7 +31,8 @@ def make_tag(key, value, offset):
class HeaderToMessageBlock(gr.sync_block):
"""
Helps with testing the HPD. Receives a header, stores it, posts
- a predetermined message.
+ a predetermined message. forecast() is not currently working in
+ Python, so use a local buffer to accumulate header data.
"""
def __init__(self, itemsize, header_len, messages):
@@ -45,13 +46,16 @@ class HeaderToMessageBlock(gr.sync_block):
self.message_port_register_out(pmt.intern('header_data'))
self.messages = messages
self.msg_count = 0
+ self.buf = []
def work(self, input_items, output_items):
"""Where the magic happens."""
- for _ in range(len(input_items[0]) // self.header_len):
+ self.buf.extend(input_items[0])
+ for _ in range(len(self.buf) // self.header_len):
msg = self.messages[self.msg_count] or False
self.message_port_pub(pmt.intern('header_data'), pmt.to_pmt(msg))
self.msg_count += 1
+ del self.buf[:self.header_len]
output_items[0][:] = input_items[0][:]
return len(input_items[0])
@@ -426,8 +430,8 @@ class qa_header_payload_demux (gr_unittest.TestCase):
time.sleep(.2)
self.tb.stop()
self.tb.wait()
- self.assertEqual(header_sink.data(), header)
- self.assertEqual(payload_sink.data(), payload * n_symbols)
+ self.assertEqual(header_sink.data(), list(header))
+ self.assertEqual(payload_sink.data(), list(payload * n_symbols))
ptags_header = []
for tag in header_sink.tags():
ptag = gr.tag_to_python(tag)