diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-05-02 11:10:38 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-05-02 11:10:38 -0400 |
commit | 70acb23e775d7e29868d2734a3997743524fa07f (patch) | |
tree | 2225da2c86e6a73a73cf2af06ff1d6f0f6050431 | |
parent | 3259abca269a08d076fb19c1ef7bb0dca885ee79 (diff) |
runtime: fix for building pmt library properly; also makes its own qa test.
-rw-r--r-- | gnuradio-runtime/lib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | gnuradio-runtime/lib/pmt/CMakeLists.txt | 32 | ||||
-rw-r--r-- | gnuradio-runtime/lib/pmt/test_pmt.cc | 46 | ||||
-rw-r--r-- | gnuradio-runtime/lib/test_runtime.cc | 2 |
4 files changed, 78 insertions, 7 deletions
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index 5193b98f57..ba5efc545c 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -60,7 +60,7 @@ include_directories(${GNURADIO_RUNTIME_INCLUDE_DIRS} ######################################################################## # Include subdirs rather to populate to the sources lists. ######################################################################## -GR_INCLUDE_SUBDIRECTORY(pmt) +add_subdirectory(pmt) GR_INCLUDE_SUBDIRECTORY(messages) GR_INCLUDE_SUBDIRECTORY(thread) GR_INCLUDE_SUBDIRECTORY(math) @@ -214,15 +214,12 @@ list(APPEND test_gnuradio_runtime_sources math/qa_fxpt_vco.cc math/qa_math.cc math/qa_sincos.cc - pmt/qa_pmt.cc - pmt/qa_pmt_prims.cc qa_buffer.cc qa_io_signature.cc qa_circular_file.cc qa_logger.cc qa_vmcircbuf.cc qa_runtime.cc - ${CMAKE_CURRENT_BINARY_DIR}/pmt/qa_pmt_unv.cc ) include_directories(${CPPUNIT_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/math) diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt index 8d2dec8d14..1a8cc57ce8 100644 --- a/gnuradio-runtime/lib/pmt/CMakeLists.txt +++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt @@ -113,5 +113,35 @@ add_dependencies(gnuradio-pmt pmt_generated ) -# Testing is handled in gnuradio-runtime tests one level down. +######################################################################## +# Setup tests +######################################################################## +if(ENABLE_TESTING) +include(GrTest) + +######################################################################## +# Append gnuradio-runtime test sources +######################################################################## +list(APPEND test_gnuradio_pmt_sources + qa_pmt.cc + qa_pmt_prims.cc + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc +) + +include_directories(${CPPUNIT_INCLUDE_DIRS}) +link_directories(${CPPUNIT_LIBRARY_DIRS}) + +add_library(test-gnuradio-pmt SHARED ${test_gnuradio_pmt_sources}) +target_link_libraries(test-gnuradio-pmt gnuradio-runtime gnuradio-pmt + ${CPPUNIT_LIBRARIES} ${Boost_LIBRARIES} ${LOG4CPP_LIBRARIES}) + +######################################################################## +# Build the test executable +# Set the test environment so the build libs will be found under MSVC. +######################################################################## +list(APPEND GR_TEST_TARGET_DEPS test-gnuradio-pmt) +add_executable(gr_pmt_test test_pmt.cc) +target_link_libraries(gr_pmt_test test-gnuradio-pmt) +GR_ADD_TEST(gr-pmt-test gr_pmt_test) +endif(ENABLE_TESTING)
\ No newline at end of file diff --git a/gnuradio-runtime/lib/pmt/test_pmt.cc b/gnuradio-runtime/lib/pmt/test_pmt.cc new file mode 100644 index 0000000000..49700b5928 --- /dev/null +++ b/gnuradio-runtime/lib/pmt/test_pmt.cc @@ -0,0 +1,46 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 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 <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> + +#include <gnuradio/unittests.h> +#include <qa_pmt.h> + +int +main (int argc, char **argv) +{ + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(get_unittest_path("gnuradio_runtime_runtime.xml").c_str()); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); + + runner.addTest(qa_pmt::suite()); + runner.setOutputter(xmlout); + + bool was_successful = runner.run("", false); + + return was_successful ? 0 : 1; +} diff --git a/gnuradio-runtime/lib/test_runtime.cc b/gnuradio-runtime/lib/test_runtime.cc index c85d325174..1285302eb4 100644 --- a/gnuradio-runtime/lib/test_runtime.cc +++ b/gnuradio-runtime/lib/test_runtime.cc @@ -29,7 +29,6 @@ #include <gnuradio/unittests.h> #include <qa_runtime.h> -#include <pmt/qa_pmt.h> int main (int argc, char **argv) @@ -39,7 +38,6 @@ main (int argc, char **argv) CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest(qa_runtime::suite()); - runner.addTest(qa_pmt::suite()); runner.setOutputter(xmlout); bool was_successful = runner.run("", false); |