diff options
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
19 files changed, 10 insertions, 1680 deletions
diff --git a/gnuradio-core/src/lib/runtime/CMakeLists.txt b/gnuradio-core/src/lib/runtime/CMakeLists.txt index a322d1b998..f3982f53cd 100644 --- a/gnuradio-core/src/lib/runtime/CMakeLists.txt +++ b/gnuradio-core/src/lib/runtime/CMakeLists.txt @@ -110,17 +110,9 @@ endif(ENABLE_GR_CTRLPORT) # Append gnuradio-core test sources ######################################################################## list(APPEND test_gnuradio_core_sources - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_block.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_hier_block2_derived.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_buffer.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_flowgraph.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_top_block.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_io_signature.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_vmcircbuf.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_block_tags.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_runtime.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_set_msg_handler.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_logger.cc ) diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h index 31081698c7..66fb72d87e 100644 --- a/gnuradio-core/src/lib/runtime/gr_basic_block.h +++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h @@ -301,9 +301,9 @@ class GR_CORE_API gr_basic_block : public gr_msg_accepter, public boost::enable_ * void msg_handler(pmt::pmt msg); * </pre> * - * (You may want to use boost::bind to massage your callable into the - * correct form. See gr_nop.{h,cc} for an example that sets up a class - * method as the callback.) + * (You may want to use boost::bind to massage your callable into + * the correct form. See gr::blocks::nop for an example that sets + * up a class method as the callback.) * * Blocks that desire to handle messages must call this method in their * constructors to register the handler that will be invoked when messages diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index 694e9575b4..9634b53f3c 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. + * Copyright 2007-2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -83,7 +83,7 @@ public: /*! * Wait for a flowgraph to complete. Flowgraphs complete when * either (1) all blocks indicate that they are done (typically only - * when using blocks.file_source, or gr.head, or (2) after stop() has been + * when using blocks.file_source, or blocks.head, or (2) after stop() has been * called to request shutdown. Calling wait on a top_block that is * not running IS NOT an error (wait returns w/o blocking). */ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc deleted file mode 100644 index c3c18cac01..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ /dev/null @@ -1,448 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_block_tags.h> -#include <gr_block.h> -#include <gr_top_block.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_head.h> -#include <gr_annotator_alltoall.h> -#include <gr_annotator_1to1.h> -#include <gr_tags.h> - - -// ---------------------------------------------------------------- - -// set to 1 to turn on debug output -// The debug output fully checks that the tags seen are what are expected. While -// this behavior currently works with our implementation, there is no guarentee -// that the tags will be coming in this specific order, so it's dangerous to -// rely on this as a test of the tag system working. We would really want to -// tags we know we should see and then test that they all occur once, but in no -// particular order. -#define QA_TAGS_DEBUG 0 - -void -qa_block_tags::t0 () -{ - unsigned int N = 1000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_block_sptr snk (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, snk, 0); - - //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error); - //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error); - CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0); - CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0); - - tb->run(); - - CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument); - CPPUNIT_ASSERT(src->nitems_written(0) >= N); - CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000); - CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument); -} - - -void -qa_block_tags::t1 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann2, 0); - tb->connect(ann1, 0, ann3, 0); - tb->connect(ann2, 0, ann4, 0); - - tb->connect(ann3, 0, snk0, 0); - tb->connect(ann4, 0, snk1, 0); - - tb->run(); - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags3 = ann3->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1, str2; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - str2 << ann2->name() << ann2->unique_id(); - - pmt::pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - - pmt::pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::cout << std::endl << "qa_block_tags::t1" << std::endl; - - // For annotator 3, we know it gets tags from ann0 and ann1, test this - for(size_t i = 0; i < tags3.size(); i++) { - std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i])); - } - - // For annotator 4, we know it gets tags from ann0 and ann2, test this - std::cout << std::endl; - for(size_t i = 0; i < tags4.size(); i++) { - std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); - } -#endif -} - -void -qa_block_tags::t2 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk2 (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann1, 1); - tb->connect(ann1, 0, ann2, 0); - tb->connect(ann1, 1, ann3, 0); - tb->connect(ann1, 2, ann4, 0); - - tb->connect(ann2, 0, snk0, 0); - tb->connect(ann3, 0, snk1, 0); - tb->connect(ann4, 0, snk2, 0); - - tb->run(); - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags1 = ann1->data(); - std::vector<gr_tag_t> tags2 = ann2->data(); - std::vector<gr_tag_t> tags3 = ann4->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8); - - // Make sure the rest all have 12 tags - CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12); - - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - - pmt::pmt_t expected_tags2[12]; - expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(6)); - expected_tags2[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags2[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags2[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(9)); - expected_tags2[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags2[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - pmt::pmt_t expected_tags4[12]; - expected_tags4[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(2)); - expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags4[2] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(5)); - expected_tags4[4] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[6] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(8)); - expected_tags4[7] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags4[8] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[9] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(11)); - expected_tags4[10] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - expected_tags4[11] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::cout << std::endl << "qa_block_tags::t2" << std::endl; - - // For annotator[2-4], we know it gets tags from ann0 and ann1 - // but the tags from the different outputs of ann1 are different for each. - // Just testing ann2 and ann4; if they are correct it would be - // inconceivable for ann3 to have it wrong. - for(size_t i = 0; i < tags2.size(); i++) { - std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i])); - } - - std::cout << std::endl; - for(size_t i = 0; i < tags4.size(); i++) { - std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); - } -#endif -} - - -void -qa_block_tags::t3 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int))); - gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - tb->connect(head, 0, ann0, 1); - - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann2, 0); - tb->connect(ann1, 0, ann3, 0); - tb->connect(ann2, 0, ann4, 0); - - tb->connect(ann3, 0, snk0, 0); - tb->connect(ann4, 0, snk1, 0); - - tb->run(); - - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags3 = ann3->data(); - std::vector<gr_tag_t> tags4 = ann4->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8); - CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8); - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1, str2; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - str2 << ann2->name() << ann2->unique_id(); - - pmt::pmt_t expected_tags3[8]; - expected_tags3[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags3[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags3[2] = mp(pmt::from_uint64(10000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags3[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags3[4] = mp(pmt::from_uint64(20000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags3[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(4)); - expected_tags3[6] = mp(pmt::from_uint64(30000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags3[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(6)); - - pmt::pmt_t expected_tags4[8]; - expected_tags4[0] = mp(pmt::from_uint64(0), mp(str2.str()), mp("seq"), mp(0)); - expected_tags4[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(1)); - expected_tags4[2] = mp(pmt::from_uint64(10000), mp(str2.str()), mp("seq"), mp(1)); - expected_tags4[3] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags4[4] = mp(pmt::from_uint64(20000), mp(str2.str()), mp("seq"), mp(2)); - expected_tags4[5] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(5)); - expected_tags4[6] = mp(pmt::from_uint64(30000), mp(str2.str()), mp("seq"), mp(3)); - expected_tags4[7] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(7)); - - std::cout << std::endl << "qa_block_tags::t3" << std::endl; - - // For annotator 3, we know it gets tags from ann0 and ann1, test this - for(size_t i = 0; i < tags3.size(); i++) { - std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags3[i]), pmt::write_string(expected_tags3[i])); - } - - // For annotator 4, we know it gets tags from ann0 and ann2, test this - std::cout << std::endl; - for(size_t i = 0; i < tags4.size(); i++) { - std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags4[i]), pmt::write_string(expected_tags4[i])); - } -#endif -} - - -void -qa_block_tags::t4 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(int))); - gr_block_sptr head (gr_make_head(sizeof(int), N)); - gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(int))); - gr_block_sptr snk1 (gr_make_null_sink(sizeof(int))); - - // using 1-to-1 tag propagation without having equal number of - // ins and outs. Make sure this works; will just exit run early. - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann0, 1, ann2, 0); - tb->connect(ann1, 0, snk0, 0); - tb->connect(ann2, 0, snk1, 0); - - std::cerr << std::endl - << "NOTE: This is supposed to produce an error from gr_block_executor" - << std::endl; - tb->run(); -} - - -/* -void -qa_block_tags::t5 () -{ - int N = 40000; - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(float))); - gr_block_sptr head (gr_make_head(sizeof(float), N)); - gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float))); - gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float))); - gr_block_sptr snk0 (gr_make_null_sink(sizeof(float))); - - // Rate change blocks - gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10)); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, ann0, 0); - tb->connect(ann0, 0, ann1, 0); - tb->connect(ann1, 0, dec10, 0); - tb->connect(dec10, 0, ann2, 0); - tb->connect(ann2, 0, snk0, 0); - - tb->run(); - - std::vector<gr_tag_t> tags0 = ann0->data(); - std::vector<gr_tag_t> tags1 = ann1->data(); - std::vector<gr_tag_t> tags2 = ann2->data(); - - // The first annotator does not receive any tags from the null sink upstream - CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0); - CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4); - CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8); - - -#if QA_TAGS_DEBUG - // Kludge together the tags that we know should result from the above graph - std::stringstream str0, str1, str2; - str0 << ann0->name() << ann0->unique_id(); - str1 << ann1->name() << ann1->unique_id(); - str2 << ann2->name() << ann2->unique_id(); - - pmt::pmt_t expected_tags1[5]; - expected_tags1[0] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags1[1] = mp(pmt::from_uint64(10000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags1[2] = mp(pmt::from_uint64(20000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags1[3] = mp(pmt::from_uint64(30000), mp(str0.str()), mp("seq"), mp(3)); - - pmt::pmt_t expected_tags2[10]; - expected_tags2[0] = mp(pmt::from_uint64(0), mp(str1.str()), mp("seq"), mp(0)); - expected_tags2[1] = mp(pmt::from_uint64(0), mp(str0.str()), mp("seq"), mp(0)); - expected_tags2[2] = mp(pmt::from_uint64(1000), mp(str1.str()), mp("seq"), mp(1)); - expected_tags2[3] = mp(pmt::from_uint64(1000), mp(str0.str()), mp("seq"), mp(1)); - expected_tags2[4] = mp(pmt::from_uint64(2000), mp(str1.str()), mp("seq"), mp(2)); - expected_tags2[5] = mp(pmt::from_uint64(2000), mp(str0.str()), mp("seq"), mp(2)); - expected_tags2[6] = mp(pmt::from_uint64(3000), mp(str1.str()), mp("seq"), mp(3)); - expected_tags2[7] = mp(pmt::from_uint64(3000), mp(str0.str()), mp("seq"), mp(3)); - expected_tags2[8] = mp(pmt::from_uint64(4000), mp(str1.str()), mp("seq"), mp(4)); - expected_tags2[9] = mp(pmt::from_uint64(4000), mp(str0.str()), mp("seq"), mp(4)); - - std::cout << std::endl << "qa_block_tags::t5" << std::endl; - - // annotator 1 gets tags from annotator 0 - std::cout << "tags1.size(): " << tags1.size() << std::endl; - for(size_t i = 0; i < tags1.size(); i++) { - std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags1[i]), pmt::write_string(expected_tags1[i])); - } - - // annotator 2 gets tags from annotators 0 and 1 - std::cout << std::endl; - std::cout << "tags2.size(): " << tags2.size() << std::endl; - for(size_t i = 0; i < tags2.size(); i++) { - std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl; - CPPUNIT_ASSERT_EQUAL(pmt::write_string(tags2[i]), pmt::write_string(expected_tags2[i])); - } -#endif -} -*/ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h deleted file mode 100644 index 039d345cdf..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_BLOCK_TAGS_H -#define INCLUDED_QA_BLOCK_TAGS_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_block_tags : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_block_tags); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - //CPPUNIT_TEST (t5); - CPPUNIT_TEST_SUITE_END (); - - private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - void t4 (); - //void t5 (); - -}; - - -#endif /* INCLUDED_QA_BLOCK_TAGS_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_block.cc deleted file mode 100644 index aeab5b74a8..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_block.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <qa_gr_block.h> -#include <gr_block.h> -#include <gr_io_signature.h> -#include <gr_null_sink.h> -#include <gr_null_source.h> - - -// ---------------------------------------------------------------- - - -void -qa_gr_block::t0 () -{ - // test creation of sources - gr_block_sptr src1 (gr_make_null_source (sizeof (int))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src1->name ()); - CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof(int), - src1->output_signature()->sizeof_stream_item (0)); - - gr_block_sptr src2 (gr_make_null_source (sizeof (short))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_source"), src2->name ()); - CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (short), - src2->output_signature()->sizeof_stream_item (0)); -} - - -void -qa_gr_block::t1 () -{ - // test creation of sinks - gr_block_sptr dst1 (gr_make_null_sink (sizeof (int))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ()); - CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (int), - dst1->input_signature()->sizeof_stream_item (0)); - - CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ()); - - gr_block_sptr dst2 (gr_make_null_sink (sizeof (short))); - CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ()); - CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ()); - CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ()); - CPPUNIT_ASSERT_EQUAL ((int) sizeof (short), - dst2->input_signature()->sizeof_stream_item (0)); - CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ()); -} - -void -qa_gr_block::t2 () -{ -} - -void -qa_gr_block::t3 () -{ -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_block.h b/gnuradio-core/src/lib/runtime/qa_gr_block.h deleted file mode 100644 index 14c7c40d1f..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_block.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_GR_BLOCK_H -#define INCLUDED_QA_GR_BLOCK_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_block : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_block); - CPPUNIT_TEST (t0); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST_SUITE_END (); - - private: - void t0 (); - void t1 (); - void t2 (); - void t3 (); - -}; - - -#endif /* INCLUDED_QA_GR_BLOCK_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc deleted file mode 100644 index cce83cb0a0..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.cc +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_gr_flowgraph.h> -#include <gr_flowgraph.h> -#include <gr_nop.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> - -void qa_gr_flowgraph::t0() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - CPPUNIT_ASSERT(fg); -} - -void qa_gr_flowgraph::t1_connect() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); -} - -void qa_gr_flowgraph::t2_connect_invalid_src_port_neg() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(nop1, -1, nop2, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t3_connect_src_port_exceeds() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(src, 1, dst, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t4_connect_invalid_dst_port_neg() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, -1), std::invalid_argument); -} - -void qa_gr_flowgraph::t5_connect_dst_port_exceeds() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(src, 0, dst, 1), std::invalid_argument); -} - -void qa_gr_flowgraph::t6_connect_dst_in_use() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src1 = gr_make_null_source(sizeof(int)); - gr_block_sptr src2 = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - fg->connect(src1, 0, dst, 0); - CPPUNIT_ASSERT_THROW(fg->connect(src2, 0, dst, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t7_connect_one_src_two_dst() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst1 = gr_make_null_sink(sizeof(int)); - gr_block_sptr dst2 = gr_make_null_sink(sizeof(int)); - - fg->connect(src, 0, dst1, 0); - fg->connect(src, 0, dst2, 0); -} - -void qa_gr_flowgraph::t8_connect_type_mismatch() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(char)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - CPPUNIT_ASSERT_THROW(fg->connect(nop1, 0, nop2, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t9_disconnect() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->disconnect(nop1, 0, nop2, 0); -} - -void qa_gr_flowgraph::t10_disconnect_unconnected_block() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - gr_block_sptr nop3 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop3, 0), std::invalid_argument); -} - -void qa_gr_flowgraph::t11_disconnect_unconnected_port() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - CPPUNIT_ASSERT_THROW(fg->disconnect(nop1, 0, nop2, 1), std::invalid_argument); -} - -void qa_gr_flowgraph::t12_validate() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->validate(); -} - -void qa_gr_flowgraph::t13_validate_missing_input_assignment() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->connect(nop1, 0, nop2, 2); - CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error); -} - -void qa_gr_flowgraph::t14_validate_missing_output_assignment() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - fg->connect(nop1, 2, nop2, 1); - CPPUNIT_ASSERT_THROW(fg->validate(), std::runtime_error); -} - -void qa_gr_flowgraph::t15_clear() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop1 = gr_make_nop(sizeof(int)); - gr_block_sptr nop2 = gr_make_nop(sizeof(int)); - - fg->connect(nop1, 0, nop2, 0); - - CPPUNIT_ASSERT(fg->edges().size() == 1); - CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 2); - - fg->clear(); - - CPPUNIT_ASSERT(fg->edges().size() == 0); - CPPUNIT_ASSERT(fg->calc_used_blocks().size() == 0); -} - -void qa_gr_flowgraph::t16_partition() -{ - gr_flowgraph_sptr fg = gr_make_flowgraph(); - - gr_block_sptr nop11 = gr_make_nop(sizeof(int)); - gr_block_sptr nop12 = gr_make_nop(sizeof(int)); - gr_block_sptr nop13 = gr_make_nop(sizeof(int)); - gr_block_sptr nop14 = gr_make_nop(sizeof(int)); - - gr_block_sptr nop21 = gr_make_nop(sizeof(int)); - gr_block_sptr nop22 = gr_make_nop(sizeof(int)); - gr_block_sptr nop23 = gr_make_nop(sizeof(int)); - - gr_block_sptr nop31 = gr_make_nop(sizeof(int)); - gr_block_sptr nop32 = gr_make_nop(sizeof(int)); - - // Build disjoint graph #1 - fg->connect(nop11, 0, nop12, 0); - fg->connect(nop12, 0, nop13, 0); - fg->connect(nop13, 0, nop14, 0); - - // Build disjoint graph #2 - fg->connect(nop21, 0, nop22, 0); - fg->connect(nop22, 0, nop23, 0); - - // Build disjoint graph #3 - fg->connect(nop31, 0, nop32, 0); - - std::vector<gr_basic_block_vector_t> graphs = fg->partition(); - - CPPUNIT_ASSERT(graphs.size() == 3); - CPPUNIT_ASSERT(graphs[0].size() == 4); - CPPUNIT_ASSERT(graphs[1].size() == 3); - CPPUNIT_ASSERT(graphs[2].size() == 2); -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h b/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h deleted file mode 100644 index 2c2686f71b..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_flowgraph.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_GR_FLOWGRAPH_H -#define INCLUDED_QA_GR_FLOWGRAPH_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_flowgraph : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_flowgraph); - - CPPUNIT_TEST(t0); - CPPUNIT_TEST(t1_connect); - CPPUNIT_TEST(t2_connect_invalid_src_port_neg); - CPPUNIT_TEST(t3_connect_src_port_exceeds); - CPPUNIT_TEST(t4_connect_invalid_dst_port_neg); - CPPUNIT_TEST(t5_connect_dst_port_exceeds); - CPPUNIT_TEST(t6_connect_dst_in_use); - CPPUNIT_TEST(t7_connect_one_src_two_dst); - CPPUNIT_TEST(t8_connect_type_mismatch); - CPPUNIT_TEST(t9_disconnect); - CPPUNIT_TEST(t10_disconnect_unconnected_block); - CPPUNIT_TEST(t11_disconnect_unconnected_port); - CPPUNIT_TEST(t12_validate); - CPPUNIT_TEST(t13_validate_missing_input_assignment); - CPPUNIT_TEST(t14_validate_missing_output_assignment); - CPPUNIT_TEST(t15_clear); - CPPUNIT_TEST(t16_partition); - - CPPUNIT_TEST_SUITE_END(); - -private: - - void t0(); - void t1_connect(); - void t2_connect_invalid_src_port_neg(); - void t3_connect_src_port_exceeds(); - void t4_connect_invalid_dst_port_neg(); - void t5_connect_dst_port_exceeds(); - void t6_connect_dst_in_use(); - void t7_connect_one_src_two_dst(); - void t8_connect_type_mismatch(); - void t9_disconnect(); - void t10_disconnect_unconnected_block(); - void t11_disconnect_unconnected_port(); - void t12_validate(); - void t13_validate_missing_input_assignment(); - void t14_validate_missing_output_assignment(); - void t15_clear(); - void t16_partition(); -}; - -#endif /* INCLUDED_QA_GR_FLOWGRAPH_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc deleted file mode 100644 index 9844d33814..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008,2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_gr_hier_block2.h> -#include <gr_hier_block2.h> -#include <gr_io_signature.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> - -void qa_gr_hier_block2::test_make() -{ - gr_hier_block2_sptr src1(gr_make_hier_block2("test", - gr_make_io_signature(1, 1, 1 * sizeof(int)), - gr_make_io_signature(1, 1, 1 * sizeof(int)))); - - CPPUNIT_ASSERT(src1); - CPPUNIT_ASSERT_EQUAL(std::string("test"), src1->name()); - - CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int), - src1->input_signature()->sizeof_stream_item(0)); - - CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->min_streams()); - CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->max_streams()); - - - CPPUNIT_ASSERT_EQUAL(1 * (int) sizeof(int), - src1->output_signature()->sizeof_stream_item(0)); - - CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams()); - CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams()); - -} - - diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h deleted file mode 100644 index 653cd27251..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_GR_HIER_BLOCK2_H -#define INCLUDED_QA_GR_HIER_BLOCK2_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_hier_block2 : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_hier_block2); - - CPPUNIT_TEST(test_make); - - CPPUNIT_TEST_SUITE_END(); - -private: - void test_make(); -}; - -#endif /* INCLUDED_QA_GR_HIER_BLOCK2_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc deleted file mode 100644 index 060c4e2447..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_gr_hier_block2_derived.h> -#include <gr_top_block.h> -#include <gr_io_signature.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_head.h> -#include <gr_kludge_copy.h> - -// Declare a test C++ hierarchical block - -class gr_derived_block; -typedef boost::shared_ptr<gr_derived_block> gr_derived_block_sptr; -gr_derived_block_sptr gr_make_derived_block(); - -class gr_derived_block : public gr_hier_block2 -{ -private: - friend gr_derived_block_sptr gr_make_derived_block(); - gr_derived_block(); - -public: - ~gr_derived_block(); -}; - - -gr_derived_block_sptr -gr_make_derived_block() -{ - return gnuradio::get_initial_sptr(new gr_derived_block()); -} - -gr_derived_block::gr_derived_block() - : gr_hier_block2("gr_derived_block", - gr_make_io_signature(1, 1, sizeof(int)), // Input signature - gr_make_io_signature(1, 1, sizeof(int))) // Output signature -{ - gr_block_sptr copy(gr_make_kludge_copy(sizeof(int))); - - connect(self(), 0, copy, 0); - connect(copy, 0, self(), 0); -} - -gr_derived_block::~gr_derived_block() -{ -} - -void qa_gr_hier_block2_derived::test_1() -{ - gr_top_block_sptr tb(gr_make_top_block("test")); - - gr_block_sptr src(gr_make_null_source(sizeof(int))); - gr_block_sptr head(gr_make_head(sizeof(int), 1000)); - gr_derived_block_sptr blk(gr_make_derived_block()); - gr_block_sptr dst(gr_make_null_sink(sizeof(int))); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, blk, 0); - tb->connect(blk, 0, dst, 0); - - tb->run(); -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h b/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h deleted file mode 100644 index 8e0a1880ce..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_hier_block2_derived.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H -#define INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -// Declare a QA test case -class qa_gr_hier_block2_derived : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_hier_block2_derived); - CPPUNIT_TEST(test_1); - CPPUNIT_TEST_SUITE_END(); - -private: - void test_1(); -}; - -#endif /* INCLUDED_QA_GR_HIER_BLOCK2_DERIVED_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc deleted file mode 100644 index 1d3dafadf8..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_gr_top_block.h> -#include <gr_top_block.h> -#include <gr_head.h> -#include <gr_nop.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <iostream> - -#define VERBOSE 0 - -void qa_gr_top_block::t0() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t0()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - CPPUNIT_ASSERT(tb); -} - -void qa_gr_top_block::t1_run() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t1()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->run(); -} - -void qa_gr_top_block::t2_start_stop_wait() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t2()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - - tb->start(); - tb->stop(); - tb->wait(); -} - -void qa_gr_top_block::t3_lock_unlock() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t3()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, dst, 0); - - tb->start(); - - tb->lock(); - tb->unlock(); - - tb->stop(); - tb->wait(); -} - -void qa_gr_top_block::t4_reconfigure() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t4()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(); - - // Reconfigure with gr_head in the middle - tb->lock(); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - - -void qa_gr_top_block::t5_max_noutputs() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t5()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - // Start infinite flowgraph - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->start(100); - tb->wait(); -} - -void qa_gr_top_block::t6_reconfig_max_noutputs() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t6()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(100); - - // Reconfigure with gr_head in the middle - tb->lock(); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->set_max_noutput_items(1000); - head->set_max_noutput_items(500); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - -void qa_gr_top_block::t7_max_noutputs_per_block() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t7()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_noutput_items(100); - - // Start infinite flowgraph - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->start(); - tb->wait(); -} - -void qa_gr_top_block::t8_reconfig_max_noutputs_per_block() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t8()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_noutput_items(99); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(201); - - // Reconfigure with gr_head in the middle - tb->lock(); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->set_max_noutput_items(1023); - head->set_max_noutput_items(513); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - -void qa_gr_top_block::t9_max_output_buffer() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t9()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_output_buffer(1024); - - // Start infinite flowgraph - tb->connect(src, 0, head, 0); - tb->connect(head, 0, dst, 0); - tb->start(); - tb->wait(); -} - -void qa_gr_top_block::t10_reconfig_max_output_buffer() -{ - if (VERBOSE) std::cout << "qa_gr_top_block::t10()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_block_sptr head = gr_make_head(sizeof(int), 100000); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - head->set_max_output_buffer(1000); - - // Start infinite flowgraph - tb->connect(src, 0, dst, 0); - tb->start(201); - - // Reconfigure with gr_head in the middle - tb->lock(); - gr_block_sptr nop = gr_make_nop(sizeof(int)); - nop->set_max_output_buffer(4000); - tb->disconnect(src, 0, dst, 0); - tb->connect(src, 0, head, 0); - tb->connect(head, 0, nop, 0); - tb->connect(nop, 0, dst, 0); - tb->unlock(); - - // Wait for flowgraph to end on its own - tb->wait(); -} - -void qa_gr_top_block::t11_set_block_affinity() -{ - gr_top_block_sptr tb = gr_make_top_block("top"); - gr_block_sptr src (gr_make_null_source(sizeof(float))); - gr_block_sptr snk (gr_make_null_sink(sizeof(float))); - - std::vector<unsigned int> set(1, 0), ret; - src->set_processor_affinity(set); - - tb->connect(src, 0, snk, 0); - tb->start(); - tb->stop(); - tb->wait(); - - ret = src->processor_affinity(); - - // We only set the core affinity to 0 because we always know at - // least one thread core exists to use. - CPPUNIT_ASSERT_EQUAL(set[0], ret[0]); -} diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h b/gnuradio-core/src/lib/runtime/qa_gr_top_block.h deleted file mode 100644 index 634eeab1f8..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_GR_TOP_BLOCK_H -#define INCLUDED_QA_GR_TOP_BLOCK_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_gr_top_block : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_gr_top_block); - - CPPUNIT_TEST(t0); - CPPUNIT_TEST(t1_run); - CPPUNIT_TEST(t2_start_stop_wait); - CPPUNIT_TEST(t3_lock_unlock); - CPPUNIT_TEST(t4_reconfigure); // triggers 'join never returns' bug - CPPUNIT_TEST(t5_max_noutputs); - CPPUNIT_TEST(t6_reconfig_max_noutputs); - CPPUNIT_TEST(t7_max_noutputs_per_block); - CPPUNIT_TEST(t8_reconfig_max_noutputs_per_block); - CPPUNIT_TEST(t9_max_output_buffer); - CPPUNIT_TEST(t10_reconfig_max_output_buffer); - CPPUNIT_TEST(t11_set_block_affinity); - - CPPUNIT_TEST_SUITE_END(); - -private: - - void t0(); - void t1_run(); - void t2_start_stop_wait(); - void t3_lock_unlock(); - void t4_reconfigure(); - void t5_max_noutputs(); - void t6_reconfig_max_noutputs(); - void t7_max_noutputs_per_block(); - void t8_reconfig_max_noutputs_per_block(); - void t9_max_output_buffer(); - void t10_reconfig_max_output_buffer(); - void t11_set_block_affinity(); - -}; - -#endif /* INCLUDED_QA_GR_TOP_BLOCK_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc index 62c95ef5c4..f02fbd7d66 100644 --- a/gnuradio-core/src/lib/runtime/qa_runtime.cc +++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc @@ -32,14 +32,8 @@ #include <qa_runtime.h> #include <qa_gr_vmcircbuf.h> #include <qa_gr_io_signature.h> -#include <qa_gr_block.h> -#include <qa_gr_flowgraph.h> #include <qa_gr_logger.h> -#include <qa_gr_top_block.h> -#include <qa_gr_hier_block2.h> -#include <qa_gr_hier_block2_derived.h> #include <qa_gr_buffer.h> -#include <qa_block_tags.h> #include <qa_set_msg_handler.h> CppUnit::TestSuite * diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc deleted file mode 100644 index ac06a3f8bc..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <qa_set_msg_handler.h> -#include <gr_top_block.h> -#include <gr_head.h> -#include <gr_null_source.h> -#include <gr_null_sink.h> -#include <gr_nop.h> -#include <gruel/msg_passing.h> -#include <iostream> -#include <boost/thread/thread.hpp> - - -#define VERBOSE 0 - -/* - * The gr_nop block has been instrumented so that it counts - * the number of messages sent to it. We use this feature - * to confirm that gr_nop's call to set_msg_handler is working - * correctly. - */ - -void qa_set_msg_handler::t0() -{ - static const int NMSGS = 10; - - if (VERBOSE) std::cout << "qa_set_msg_handler::t0()\n"; - - gr_top_block_sptr tb = gr_make_top_block("top"); - - gr_block_sptr src = gr_make_null_source(sizeof(int)); - gr_nop_sptr nop = gr_make_nop(sizeof(int)); - gr_block_sptr dst = gr_make_null_sink(sizeof(int)); - - tb->connect(src, 0, nop, 0); - tb->connect(nop, 0, dst, 0); - - // Must start graph before sending messages - tb->start(); - - // Send them... - pmt::pmt_t port(pmt::intern("port")); - for (int i = 0; i < NMSGS; i++){ - send(nop, port, pmt::mp(pmt::mp("example-msg"), pmt::mp(i))); - } - - // Give the messages a chance to be processed - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); - - tb->stop(); - tb->wait(); - - // Confirm that the nop block received the right number of messages. - CPPUNIT_ASSERT_EQUAL(NMSGS, nop->nmsgs_received()); -} diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h deleted file mode 100644 index 60277a12cc..0000000000 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_QA_SET_MSG_HANDLER_H -#define INCLUDED_QA_SET_MSG_HANDLER_H - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> -#include <stdexcept> - -class qa_set_msg_handler : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(qa_set_msg_handler); - - CPPUNIT_TEST(t0); - - CPPUNIT_TEST_SUITE_END(); - -private: - - void t0(); -}; - -#endif /* INCLUDED_QA_SET_MSG_HANDLER_H */ diff --git a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc index bb4e863222..0a391c1354 100644 --- a/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc +++ b/gnuradio-core/src/lib/runtime/test_shared_block_ptr.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,16 +21,16 @@ */ #include <gr_shared_block_sptr.h> -#include <gr_vector_source_i.h> +#include <blocks/vector_source_i.h> gr_block_sptr -foo (gr_vector_source_i_sptr s) +foo (gr::blocks::vector_source_i::sptr s) { return gr_block_sptr (s); } -typedef gr_shared_block_sptr<gr_vector_source_i> gr_vector_source_i_ptrX; -//typedef boost::shared_ptr<gr_vector_source_i> gr_vector_source_i_ptrX; +typedef gr_shared_block_sptr<gr::blocks::vector_source_i> gr_vector_source_i_ptrX; +//typedef boost::shared_ptr<gr::blocks::vector_source_i> gr_vector_source_i_ptrX; gr_vector_source_i_ptrX bar (gr_vector_source_i *s) |