diff options
author | cottrema <mark.cottrell@taitradio.com> | 2014-06-23 11:02:08 +1200 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-06-26 14:45:33 -0400 |
commit | 4f6b982c87b36a377ed270f2fd4ae6cddb6e0aa3 (patch) | |
tree | 4a038b6fe011e44b332059b2dd087c4baabcd08e /gr-blocks/python/blocks/qa_file_source_sink.py | |
parent | 0e10ce040c5884a40d7a416ea0db34a5f426002a (diff) |
call do_update after calling open in the file source constructor,
otherwise if seek is called before work, a segmentation fault will occur
as d_fp is null
Diffstat (limited to 'gr-blocks/python/blocks/qa_file_source_sink.py')
-rw-r--r-- | gr-blocks/python/blocks/qa_file_source_sink.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gr-blocks/python/blocks/qa_file_source_sink.py b/gr-blocks/python/blocks/qa_file_source_sink.py index f35912b229..89841d3be6 100644 --- a/gr-blocks/python/blocks/qa_file_source_sink.py +++ b/gr-blocks/python/blocks/qa_file_source_sink.py @@ -88,6 +88,22 @@ class test_file_source_sink(gr_unittest.TestCase): result_data = snk2.data() self.assertFloatTuplesAlmostEqual(expected_result, result_data) + def test_file_source_can_seek_after_open(self): + src_data = range(1000) + + filename = "tmp.32f" + src = blocks.vector_source_f(src_data) + snk = blocks.file_sink(gr.sizeof_float, filename) + snk.set_unbuffered(True) + + self.tb.connect(src, snk) + self.tb.run() + + source = blocks.file_source(gr.sizeof_float, filename) + self.assertTrue(source.seek(0, os.SEEK_SET)) + + os.remove(filename) + if __name__ == '__main__': gr_unittest.run(test_file_source_sink, "test_file_source_sink.xml") |