[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] unittest with USRP not finishing
From: |
maiconkist |
Subject: |
[Discuss-gnuradio] unittest with USRP not finishing |
Date: |
Wed, 6 Feb 2013 04:01:01 -0800 (PST) |
Hello list,
I am trying to write a simple unit test from a flow graph I'm writing. The
problem is that the flowgraph dont finish. It hangs in the line
"self.assertNotEqual(out, 0).
The complete code is as follows:
####
from gnuradio import gr_unittest
# Project imports
from usrpDevice import UsrpFlowGraph
from usrpDevice import USRPDevice
from time import sleep
## Test DeviceWrapper methods
#
class qa_device(gr_unittest.TestCase):
## Test USRP communication
def test_001_usrp(self):
uhd = USRPDevice()
uhd.start()
out = uhd.sense()
self.assertNotEqual(out, 0)
if __name__ == '__main__':
gr_unittest.main()
####
And the USRPDevice class:
####
class USRPDevice(gr.top_block):
## CTOR
def __init__(self):
gr.top_block.__init__(self, "Energy Top Block")
self.mUhd = uhd.usrp_source(device_addr=options.addr,
stream_args=uhd.stream_args(cpu_format='fc32',
otw_format='sc16'))
self.ed = EnergyDetector(options.fft_size)
self.mavg = gr.moving_average_ff(options.moving_avg_size,
1.0/options.moving_avg_size
)
self.mOut = gr.probe_signal_f()
self.connect(self.mUhd, self.ed, self.mavg, self.mOut)
def sense(self):
return self.mOut.level()
####
I tried changed the code and verified that USRPDevice::sense is returning
when its called.
And if I remove the "start()" call in the Unit Test, it works fine.
Any suggestion of whats happening ?
--
View this message in context:
http://gnuradio.4.n7.nabble.com/unittest-with-USRP-not-finishing-tp39439.html
Sent from the GnuRadio mailing list archive at Nabble.com.
- [Discuss-gnuradio] unittest with USRP not finishing,
maiconkist <=