尝试制作一个树外模块但在测试时卡住了。(进行测试)

尝试制作一个树外模块但在测试时卡住了。(进行测试)

我正在尝试为我的 gnuradio 安装一个树外模块,并且我正在观看 YouTube 视频https://www.youtube.com/watch?v=BW8o9ZgFJ5I&t=540s。然而,一旦我开始测试代码,它就会不断发现我似乎无法发现的错误。

当我输入以下内容时,它会显示这一点make test

ubuntu@ubuntu:~/gr-NRZI_decode/build$ make test
Running tests...
Test project /home/ubuntu/gr-NRZI_decode/build
    Start 1: test_NRZI_decode
1/2 Test #1: test_NRZI_decode .................   Passed    0.02 sec
    Start 2: qa_square_ff
2/2 Test #2: qa_square_ff .....................***Failed    0.46 sec

50% tests passed, 1 tests failed out of 2

Total Test time (real) =   0.49 sec

The following tests FAILED:
      2 - qa_square_ff (Failed)
Errors while running CTest
Makefile:85: recipe for target 'test' failed
make: *** [test] Error 8

当我尝试集中精力解决问题时,ctest -V -R qa_square_ff我得到了以下信息:

UpdateCTestConfiguration  from :/home/ubuntu/gr-NRZI_decode/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/ubuntu/gr-NRZI_decode/build/DartConfiguration.tcl
Test project /home/ubuntu/gr-NRZI_decode/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 2
    Start 2: qa_square_ff

2: Test command: /bin/sh "/home/ubuntu/gr-NRZI_decode/build/python/qa_square_ff_test.sh"
2: Test timeout computed to be: 9.99988e+06
2: E
2: ======================================================================
2: ERROR: test_001_square_ff (__main__.qa_square_ff)
2: ----------------------------------------------------------------------
2: Traceback (most recent call last):
2:   File "/home/ubuntu/gr-NRZI_decode/python/qa_square_ff.py", line 40, in test_001_square_ff
2:     self.tb.connect(src,sqr)
2:   File "/usr/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py", line 47, in wrapped
2:     func(self, src, src_port, dst, dst_port)
2:   File "/usr/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py", line 110, in connect
2:     self.primitive_connect(*args)
2:   File "/usr/lib/python2.7/dist-packages/gnuradio/gr/runtime_swig.py", line 5307, in primitive_connect
2:     return _runtime_swig.top_block_sptr_primitive_connect(self, *args)
2: ValueError: itemsize mismatch: vector_source_f1:0 using 4, square_ff1:0 using 1
2: 
2: ----------------------------------------------------------------------
2: Ran 1 test in 0.000s
2: 
2: FAILED (errors=1)
1/1 Test #2: qa_square_ff .....................***Failed    0.19 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.19 sec

The following tests FAILED:
      2 - qa_square_ff (Failed)
Errors while running CTest

这是我的代码qa_square_ff.py

from gnuradio import gr, gr_unittest
from gnuradio import blocks
import NRZI_decode_swig as NRZI_decode

class qa_square_ff (gr_unittest.TestCase):

    def setUp (self):
        self.tb = gr.top_block ()

    def tearDown (self):
        self.tb = None

    def test_001_square_ff(self):
        src_data=(1,2,3,4,5)
    expected_data=(1,4,9,16,25)
    src=blocks.vector_source_f(src_data)
    sqr=NRZI_decode.square_ff()
    dst=blocks.vector_sink_f()
    self.tb.connect(src,sqr)
    self.tb.connect(sqr,dst)
        self.tb.run ()
    result_data=dst.data()
    self.assertCharTuplesAlmostEqual(expected_data,result_data,6)
        # check data


if __name__ == '__main__':
    gr_unittest.run(qa_square_ff, "qa_square_ff.xml")

相关内容