[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5645 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5645 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband |
Date: |
Sun, 3 Jun 2007 16:50:34 -0600 (MDT) |
Author: gnychis
Date: 2007-06-03 16:50:33 -0600 (Sun, 03 Jun 2007)
New Revision: 5645
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
Log:
Using invocation_handle as a list for the QA code, where the first element is
the expected response event and the second is the expected status
This now ensures that the QA code not only checks the status returned was what
was expected, but the response event was the event expected (ie, s_cmd_open
generates an s_response_open)
Could leverage a third list item that is the expected # response to ensure
ordering, but this is not implemented.
Used this as a 'test' that also pays off for the future of the RX side QA code.
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-06-03 21:33:35 UTC (rev 5644)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-06-03 22:50:33 UTC (rev 5645)
@@ -118,14 +118,14 @@
qa_alloc_top::initial_transition()
{
// Allocations should fail before open
- d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_F, pmt_from_long(1)));
- d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_F, pmt_from_long(1)));
+ d_tx->send(s_cmd_allocate_channel,
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_F), pmt_from_long(1)));
+ d_rx->send(s_cmd_allocate_channel,
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_F), pmt_from_long(1)));
// Retrieve information about the USRP, then run tests
- d_cs->send(s_cmd_open, pmt_list2(PMT_T, pmt_from_long(0)));
- d_cs->send(s_cmd_max_capacity, pmt_list1(PMT_T));
- d_cs->send(s_cmd_ntx_chan, pmt_list1(PMT_T));
- d_cs->send(s_cmd_nrx_chan, pmt_list1(PMT_T));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T),
pmt_from_long(0)));
+ d_cs->send(s_cmd_max_capacity,
pmt_list1(pmt_list2(s_response_max_capacity,PMT_T)));
+ d_cs->send(s_cmd_ntx_chan, pmt_list1(pmt_list2(s_response_ntx_chan,PMT_T)));
+ d_cs->send(s_cmd_nrx_chan, pmt_list1(pmt_list2(s_response_nrx_chan,PMT_T)));
}
void
@@ -201,14 +201,18 @@
qa_alloc_top::check_message(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
+
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
d_nrecvd++;
- if(!pmt_eqv(expected_result, result)) {
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "Got: " << result << " Expected: " << expected_result <<
"\n";
shutdown_all(PMT_F);
return;
@@ -289,10 +293,10 @@
qa_dealloc_top::initial_transition()
{
// Retrieve information about the USRP, then run tests
- d_cs->send(s_cmd_open, pmt_list2(PMT_T, pmt_from_long(0)));
- d_cs->send(s_cmd_max_capacity, pmt_list1(PMT_T));
- d_cs->send(s_cmd_ntx_chan, pmt_list1(PMT_T));
- d_cs->send(s_cmd_nrx_chan, pmt_list1(PMT_T));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T),
pmt_from_long(0)));
+ d_cs->send(s_cmd_max_capacity,
pmt_list1(pmt_list2(s_response_max_capacity,PMT_T)));
+ d_cs->send(s_cmd_ntx_chan, pmt_list1(pmt_list2(s_response_ntx_chan,PMT_T)));
+ d_cs->send(s_cmd_nrx_chan, pmt_list1(pmt_list2(s_response_nrx_chan,PMT_T)));
}
void
@@ -302,11 +306,11 @@
// Keep allocating until we hit the maximum number of channels
for(int i=0; i < d_ntx_chan; i++) {
- d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
+ d_tx->send(s_cmd_allocate_channel,
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_T), pmt_from_long(1)));
d_nalloc_to_recv++;
}
for(int i=0; i < d_nrx_chan; i++) {
- d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
+ d_rx->send(s_cmd_allocate_channel,
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_T), pmt_from_long(1)));
d_nalloc_to_recv++;
}
}
@@ -316,30 +320,30 @@
// Deallocate all of the channels that were allocated from allocate_max()
for(int i=0; i < (int)d_tx_chans.size(); i++) {
- d_tx->send(s_cmd_deallocate_channel, pmt_list2(PMT_T,
pmt_from_long(d_tx_chans[i])));
+ d_tx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_list2(s_response_deallocate_channel,PMT_T),
pmt_from_long(d_tx_chans[i])));
d_ndealloc_to_recv++;
}
for(int i=0; i < (int)d_rx_chans.size(); i++) {
- d_rx->send(s_cmd_deallocate_channel, pmt_list2(PMT_T,
pmt_from_long(d_rx_chans[i])));
+ d_rx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_list2(s_response_deallocate_channel,PMT_T),
pmt_from_long(d_rx_chans[i])));
d_ndealloc_to_recv++;
}
// Should get permission denied errors trying to re-dealloc the channels, as
we no
// longer have permission to them after deallocating
for(int i=0; i < (int)d_tx_chans.size(); i++) {
- d_tx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_from_long(usrp_server::PERMISSION_DENIED),
pmt_from_long(d_tx_chans[i])));
+ d_tx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_list2(s_response_deallocate_channel,pmt_from_long(usrp_server::PERMISSION_DENIED)),
pmt_from_long(d_tx_chans[i])));
d_ndealloc_to_recv++;
}
for(int i=0; i < (int)d_rx_chans.size(); i++) {
- d_rx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_from_long(usrp_server::PERMISSION_DENIED),
pmt_from_long(d_rx_chans[i])));
+ d_rx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_list2(s_response_deallocate_channel,pmt_from_long(usrp_server::PERMISSION_DENIED)),
pmt_from_long(d_rx_chans[i])));
d_ndealloc_to_recv++;
}
// Try to deallocate a channel that doesn't exist on both sides, the last
element in the vectors
// is the highest channel number, so we take that plus 1
d_ndealloc_to_recv+=2;
- d_tx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_from_long(usrp_server::CHANNEL_INVALID),
pmt_from_long(d_rx_chans.back()+1)));
- d_rx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_from_long(usrp_server::CHANNEL_INVALID),
pmt_from_long(d_rx_chans.back()+1)));
+ d_tx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_list2(s_response_deallocate_channel,pmt_from_long(usrp_server::CHANNEL_INVALID)),
pmt_from_long(d_rx_chans.back()+1)));
+ d_rx->send(s_cmd_deallocate_channel,
pmt_list2(pmt_list2(s_response_deallocate_channel,pmt_from_long(usrp_server::CHANNEL_INVALID)),
pmt_from_long(d_rx_chans.back()+1)));
// The used capacity should be back to 0 now that we've deallocated
everything
@@ -398,13 +402,17 @@
qa_dealloc_top::check_deallocation(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
+
d_ndealloc_recvd++;
- if(!pmt_eqv(expected_result, result)) {
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "Got: " << result << " Expected: " << expected_result <<
"\n";
shutdown_all(PMT_F);
return;
@@ -417,14 +425,18 @@
qa_dealloc_top::check_allocation(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t invocation_handle = pmt_nth(0, data);
+ pmt_t expected = pmt_nth(0, data);
pmt_t status = pmt_nth(1, data);
pmt_t channel = pmt_nth(2, data);
+
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
d_nalloc_recvd++;
- if(pmt_eqv(status, PMT_F)) {
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "[qa_dealloc_top] Unexpected error response when
allocating channels\n";
shutdown_all(PMT_F);
return;
@@ -507,21 +519,21 @@
// std::cout << "[qa_open_close_top] Starting tests\n";
// A close before an open should fail
- d_cs->send(s_cmd_close, pmt_list1(PMT_F));
+ d_cs->send(s_cmd_close, pmt_list1(pmt_list2(s_response_close,PMT_F)));
// Perform an open, and a second open which should fail
- d_cs->send(s_cmd_open, pmt_list2(PMT_T, pmt_from_long(0)));
- d_cs->send(s_cmd_open, pmt_list2(PMT_F, pmt_from_long(0)));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T),
pmt_from_long(0)));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_F),
pmt_from_long(0)));
// A close should now be successful since the interface is open
- d_cs->send(s_cmd_close, pmt_list1(PMT_T));
+ d_cs->send(s_cmd_close, pmt_list1(pmt_list2(s_response_close,PMT_T)));
// But, a second close should fail
- d_cs->send(s_cmd_close, pmt_list1(PMT_F));
+ d_cs->send(s_cmd_close, pmt_list1(pmt_list2(s_response_close,PMT_F)));
// Just to be thorough, try an open and close again
- d_cs->send(s_cmd_open, pmt_list2(PMT_T, pmt_from_long(0)));
- d_cs->send(s_cmd_close, pmt_list1(PMT_T));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T),
pmt_from_long(0)));
+ d_cs->send(s_cmd_close, pmt_list1(pmt_list2(s_response_close,PMT_T)));
}
@@ -545,11 +557,15 @@
qa_open_close_top::check_cs(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
- if(!pmt_eqv(expected_result, result)) {
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
+
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "[qa_open_close_top] FAILED check_cs... Got: " << result
<< " Expected: " << expected_result << " for event " << msg->signal() << "\n";
shutdown_all(PMT_F);
} else {
@@ -627,32 +643,32 @@
// std::cout << "[qa_tx_top] Starting tests\n";
// A transmit before an open should fail
- d_tx->send(s_cmd_xmit_raw_frame, pmt_list4(PMT_F, pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
+ d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_list2(s_response_xmit_raw_frame,PMT_F), pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
// Open, and now try an xmit again which should be successful
- d_cs->send(s_cmd_open, pmt_list2(PMT_T, pmt_from_long(0)));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T),
pmt_from_long(0)));
// Try to transmit on a channel that we have no allocation for
- d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_from_long(usrp_server::PERMISSION_DENIED), pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
+ d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_list2(s_response_xmit_raw_frame,pmt_from_long(usrp_server::PERMISSION_DENIED)),
pmt_from_long(0), pmt_make_u32vector(transport_pkt::max_payload()/4, 0),
pmt_from_long(0)));
// Get a channel allocation and send on it, we assume 0 (FIXME) until
'defer' is implemented for simplicity
- d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
- d_tx->send(s_cmd_xmit_raw_frame, pmt_list4(PMT_T, pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
+ d_tx->send(s_cmd_allocate_channel,
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_T), pmt_from_long(1)));
+ d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_list2(s_response_xmit_raw_frame,PMT_T), pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
// Close should be successful
- d_cs->send(s_cmd_close, pmt_list1(PMT_T));
+ d_cs->send(s_cmd_close, pmt_list1(pmt_list2(s_response_close,PMT_T)));
// After closing, a new transmit raw frame should fail again
- d_tx->send(s_cmd_xmit_raw_frame, pmt_list4(PMT_F, pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
+ d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_list2(s_response_xmit_raw_frame,PMT_F), pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
// Reopen and retry before getting an allocation, the first xmit should
fail, after we allocate it should work again
- d_cs->send(s_cmd_open, pmt_list2(PMT_T, pmt_from_long(0)));
- d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_from_long(usrp_server::PERMISSION_DENIED), pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
- d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T, pmt_from_long(1)));
- d_tx->send(s_cmd_xmit_raw_frame, pmt_list4(PMT_T, pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
+ d_cs->send(s_cmd_open, pmt_list2(pmt_list2(s_response_open,PMT_T),
pmt_from_long(0)));
+ d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_list2(s_response_xmit_raw_frame,pmt_from_long(usrp_server::PERMISSION_DENIED)),
pmt_from_long(0), pmt_make_u32vector(transport_pkt::max_payload()/4, 0),
pmt_from_long(0)));
+ d_tx->send(s_cmd_allocate_channel,
pmt_list2(pmt_list2(s_response_allocate_channel,PMT_T), pmt_from_long(1)));
+ d_tx->send(s_cmd_xmit_raw_frame,
pmt_list4(pmt_list2(s_response_xmit_raw_frame,PMT_T), pmt_from_long(0),
pmt_make_u32vector(transport_pkt::max_payload()/4, 0), pmt_from_long(0)));
// A final close which should be successful
- d_cs->send(s_cmd_close, pmt_list1(PMT_T));
+ d_cs->send(s_cmd_close, pmt_list1(pmt_list2(s_response_close,PMT_T)));
}
@@ -688,11 +704,15 @@
qa_tx_top::check_deallocation(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
- if(!pmt_eqv(expected_result, result)) {
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
+
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "[qa_tx_top] FAILED check_deallocation... Got: " << result
<< " Expected: " << expected_result << "\n";
shutdown_all(PMT_F);
return;
@@ -705,12 +725,16 @@
qa_tx_top::check_allocation(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
pmt_t channel = pmt_nth(2, data);
+
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
- if(!pmt_eqv(expected_result, result)) {
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "[qa_tx_top] FAILED check_allocation... Got: " << result
<< " Expected: " << expected_result << " for event " << msg->signal() << ")\n";
shutdown_all(PMT_F);
return;
@@ -718,7 +742,7 @@
// std::cout << "[qa_tx_top] Received expected allocation response for
message\n";
}
- if(pmt_eqv(result, PMT_T)) {
+ if(pmt_eqv(status, PMT_T)) {
// store all of the allocate channel numbers
if(pmt_eq(msg->port_id(), d_tx->port_symbol()))
d_tx_chan = pmt_to_long(channel);
@@ -731,11 +755,15 @@
qa_tx_top::check_xmit(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
-
- if(!pmt_eqv(expected_result, result)) {
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
+
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
+
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
//std::cout << "[qa_tx_top] FAILED check_xmit... Got: " << result
// << " Expected: " << expected_result
// << " for event " << msg->signal() << ")\n";
@@ -750,11 +778,15 @@
qa_tx_top::check_cs(mb_message_sptr msg)
{
pmt_t data = msg->data();
+ pmt_t event = msg->signal();
- pmt_t expected_result = pmt_nth(0, data);
- pmt_t result = pmt_nth(1, data);
+ pmt_t expected = pmt_nth(0, data);
+ pmt_t status = pmt_nth(1, data);
+
+ pmt_t e_event = pmt_nth(0, expected);
+ pmt_t e_status = pmt_nth(1, expected);
- if(!pmt_eqv(expected_result, result)) {
+ if(!pmt_eqv(e_status, status) || !pmt_eqv(e_event, event)) {
// std::cout << "[qa_tx_top] FAILED check_cs... Got: " << result << "
Expected: " << expected_result << " for event " << msg->signal() << "\n";
shutdown_all(PMT_F);
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5645 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband,
gnychis <=