diff options
106 files changed, 1064 insertions, 1516 deletions
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index 84514d7ce..4027bb332 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -42,10 +42,9 @@ AC_DEFUN([GRC_GR_QTGUI],[ # QtGui # QtCore # qwt -# qwtplot3d # qt4 -# qt4-core, qt4-gui, qwt5-qt4, qwt5-qt4-dev, libqwtplot3d-qt4, libqwtplot3d-qt4-dev, qt4-dev-tools +# qt4-core, qt4-gui, qwt5-qt4, qwt5-qt4-dev, qt4-dev-tools if test $passed = yes; then dnl Check for package qt or qt-mt, set QT_CFLAGS and QT_LIBS @@ -59,20 +58,15 @@ AC_DEFUN([GRC_GR_QTGUI],[ dnl Fetch QWT variables GR_QWT([], [passed=no]) - dnl Process QWT Plot3D only if QWT passed - if test "$passed" = "yes"; then - GR_QWTPLOT3D([], [passed=no]) - fi - dnl Export the include dirs and libraries (note: QTOPENGL_LIBS includes links dnl to QtCore and QtGui libraries) - QT_INCLUDES="$QWT_CFLAGS $QWTPLOT3D_CFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS" - QT_LIBS="$QWT_LIBS $QWTPLOT3D_LIBS $QTOPENGL_LIBS" + QT_INCLUDES="$QWT_CFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS" + QT_LIBS="$QWT_LIBS $QTOPENGL_LIBS" dnl Build an includes variable specifically for running qmake by extracting - dnl all includes from the QWT and QWTPLOT3D, without the -I; + dnl all includes from the QWT, without the -I; dnl qmake appends the -I when processing the project file INCLUDEPATH - for i in $QWT_CFLAGS $QWTPLOT3D_CFLAGS; do + for i in $QWT_CFLAGS; do QMAKE_INCLUDES="$QMAKE_INCLUDES ${i##-I}" done diff --git a/config/usrp_libusb.m4 b/config/usrp_libusb.m4 index 251f7df10..a434d379d 100755..100644 --- a/config/usrp_libusb.m4 +++ b/config/usrp_libusb.m4 @@ -28,64 +28,153 @@ AC_DEFUN([USRP_LIBUSB], [ dnl make sure the USB_* variables work (whether from PKGCONFIG dnl or overridden by the user) - libusbok=no - have_libusb1=no - LIBUSB_PKG_CONFIG_NAME='' + dnl do not use LDFLAGS, since PKGCONFIG will provide everything + saved_LDFLAGS=${LDFLAGS} + LDFLAGS= + LIBUSB_PKG_CONFIG_NAME= + + dnl loop over various possible 'libusb' PKGCONFIG names, and choose + dnl the first one that meets both the user's selection (via + dnl configure flags) as well as what is installed + + dnl create the list of libusb PKGCONFIG modules to test + libusb_list='' if test x$1 = xyes; then - PKG_CHECK_MODULES(USB, libusb-1.0, [ - libusbok=yes - have_libusb1=yes - usb_header='libusb-1.0/libusb.h' - usb_lib_func='libusb_bulk_transfer' - usb_lib_name='usb-1.0' - LIBUSB_PKG_CONFIG_NAME='libusb-1.0' - ]) + dnl libusb-1.0 was requested; just test for it + libusb_list="libusb-1.0" else - dnl not using libusb1 (for now); see if legacy version is found. - dnl it might be installed under the name either 'libusb' or - dnl 'libusb-legacy', or just available via the - dnl user's shell environment - - dnl see if the pkgconfig module 'libusb' is available - PKG_CHECK_MODULES(USB, libusb, [ - libusbok=yes - LIBUSB_PKG_CONFIG_NAME='libusb' + dnl test for legacy libusb only + libusb_list="libusb libusb-legacy" + fi + for libusb_name in ${libusb_list}; do + dnl clear internal variables + libusbok=no + have_libusb1=no + usb_header='' + usb_lib_func='' + usb_lib_name='' + + dnl start checks + AC_MSG_NOTICE([Checking for LIBUSB version '${libusb_name}']) + if test ${libusb_name} = "libusb-1.0"; then + dnl see if the pkgconfig module is available + PKG_CHECK_MODULES(USB, ${libusb_name}, [ + libusbok=yes + have_libusb1=yes + usb_header='libusb-1.0/libusb.h' + usb_lib_func='libusb_bulk_transfer' ], [libusbok=no]) - dnl PKG_CHECK_MODULES does not work correctly when embedded - if test $libusbok = no; then - dnl if not, see if the pkgconfig module 'libusb-legacy' is available - PKG_CHECK_MODULES(USB, [libusb-legacy], [ + else + dnl see if the pkgconfig module is available + PKG_CHECK_MODULES(USB, ${libusb_name}, [ libusbok=yes - LIBUSB_PKG_CONFIG_NAME='libusb-legacy' - ], [libusbok=no]) + usb_header='usb.h' + usb_lib_func='usb_bulk_write' + ], [libusbok=no]) fi - dnl set variables for further testing - usb_header='usb.h' - usb_lib_func='usb_bulk_write' - usb_lib_name='usb' - fi - AC_SUBST(LIBUSB_PKG_CONFIG_NAME) - if test x$1 != xyes || test $have_libusb1 = yes; then - dnl Either (1) libusb1 was specified and found; or - dnl (2) libusb1 was not specified. Restart checking. - libusbok=yes + if test $libusbok = yes; then + dnl PKGCONFIG found a version of LIBUSB. + dnl Check it to make sure it meets enough criteria: + dnl Verify that $usb_header is a valid header. If so, then + dnl verify that $usb_lib_func can be found in the library + dnl $usb_lib_name. if so, verify that the symbol 'usb_debug' is + dnl found in the library. + + dnl Check for the header. Similar to AC_CHECK_HEADERS, + dnl but doesn't append to known \#defines. + dnl If PKGCONFIG found variable USB_INCLUDEDIR, and it is + dnl not empty, use it for checking for $usb_header. + dnl Otherwise, maybe the user's shell environment is already + dnl configured to find this header. + AC_LANG_PUSH(C) + save_CPPFLAGS="$CPPFLAGS" + if test x$USB_INCLUDEDIR != x; then + USB_INCLUDES="-I$USB_INCLUDEDIR" + CPPFLAGS="$USB_INCLUDES" + fi + AC_MSG_CHECKING([$libusb_name for header $usb_header]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include "$usb_header" + ]], [])], + [libusbok=yes],[libusbok=no]) + AC_MSG_RESULT([$libusbok]) + CPPFLAGS="$save_CPPFLAGS" + AC_LANG_POP(C) + + if test $libusbok = yes; then + dnl found the header; now make sure the library is OK + dnl On Darwin, need to include the IOKit library. - dnl Verify that $usb_header is a valid header, and if so, - dnl then verify that $usb_lib_func can be found in the - dnl library $usb_lib_name. + AC_LANG_PUSH(C) + save_LIBS="$LIBS" + case "$host_os" in + darwin*) + USB_LIBS="$USB_LIBS -lIOKit" + ;; + *) ;; + esac + LIBS="$USB_LIBS" - dnl If PKGCONFIG found variable USB_INCLUDEDIR, and it is - dnl not empty, use it for checking for $usb_header. - dnl Otherwise, maybe the user's shell environment is already - dnl configured to find this header. + dnl find the library link name + usb_lib_name=`echo $USB_LIBS | sed -e "s@.*-l\(usb[[^ ]]*\).*@\1@"` + dnl Check for the function in the library. Similar to + dnl AC_CHECK_LIB, but doesn't append to known \#defines. + AC_MSG_CHECKING([$libusb_name for function $usb_lib_func in library $usb_lib_name]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #ifdef __cplusplus + extern "C" + #endif + char $usb_lib_func (); + ]], [[return $usb_lib_func ();]])], + [libusbok=yes],[libusbok=no]) + AC_MSG_RESULT([$libusbok]) + LIBS="$save_LIBS" + AC_LANG_POP(C) + + if test $libusbok = yes; then + if test ${libusb_name} != "libusb-1.0"; then + dnl PKGCONFIG found a legacy version of libusb; make sure the + dnl variable _usb_debug is available in the found library + AC_LANG_PUSH(C) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$USB_INCLUDES" + save_LIBS="$LIBS" + LIBS="$USB_LIBS" + AC_MSG_CHECKING([$libusb_name for symbol usb_debug in library $usb_lib_name]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + extern int usb_debug;]], + [[usb_debug = 0;]])], + [libusbok=yes],[libusbok=no]) + AC_MSG_RESULT([$libusbok]) + LIBS="$save_LIBS" + CPPFLAGS="$save_CPPFLAGS" + AC_LANG_POP(C) + fi + fi + fi + fi + dnl if everything checks out OK, finish up + if test $libusbok = yes; then + LIBUSB_PKG_CONFIG_NAME="${libusb_name}" + break + else + dnl something wasn't found in this LIBUSB version. + dnl HACK: clear cache variables for header and library + unset USB_INCLUDEDIR + unset USB_INCLUDES + unset USB_LIBS + unset $as_ac_Header + unset $as_ac_Lib + fi + done + + if test $libusbok = yes; then + dnl final error checking, mostly to create #define's AC_LANG_PUSH(C) save_CPPFLAGS="$CPPFLAGS" - if test x$USB_INCLUDEDIR != x; then - USB_INCLUDES="-I$USB_INCLUDEDIR" - CPPFLAGS="$CPPFLAGS $USB_INCLUDES" - AC_SUBST(USB_INCLUDES) - fi + CPPFLAGS="$USB_INCLUDES" + dnl Check for the header. AC_CHECK_HEADERS([$usb_header], [], [libusbok=no]) CPPFLAGS="$save_CPPFLAGS" AC_LANG_POP(C) @@ -93,24 +182,15 @@ AC_DEFUN([USRP_LIBUSB], [ if test $libusbok = no; then AC_MSG_RESULT([USRP requires libusb header '$usb_header' which was not found or was not usable. See http://www.libusb.org]) else - - dnl found the header; now make sure the library is OK - dnl On Darwin, need to include the IOKit library. - + dnl check for the library (again) AC_LANG_PUSH(C) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$USB_INCLUDES" save_LIBS="$LIBS" - LIBS="" - case "$host_os" in - darwin*) - USB_LIBS="$USB_LIBS -lIOKit" - LIBS="$USB_LIBS" - ;; - *) ;; - esac + LIBS="$USB_LIBS" AC_CHECK_LIB([$usb_lib_name], [$usb_lib_func], [], [ libusbok=no - AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org]) - ]) + AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org])]) case "$host_os" in cygwin* | mingw*) USB_LIBS="$LIBS" @@ -118,15 +198,28 @@ AC_DEFUN([USRP_LIBUSB], [ *) ;; esac LIBS="$save_LIBS" + CPPFLAGS="$save_CPPFLAGS" AC_LANG_POP(C) fi fi + if test $libusbok = yes; then - AC_SUBST(USB_LIBS) + dnl success + AC_MSG_NOTICE([Using LIBUSB version '${libusb_name}']) ifelse([$2], , :, [$2]) else + dnl not found; clear substitution variables + LIBUSB_PKG_CONFIG_NAME= USB_INCLUDES= USB_LIBS= ifelse([$3], , :, [$3]) fi + + dnl create substitution variables + AC_SUBST(USB_INCLUDES) + AC_SUBST(USB_LIBS) + AC_SUBST(LIBUSB_PKG_CONFIG_NAME) + + dnl restore LDFLAGS + LDFLAGS=${saved_LDFLAGS} ]) diff --git a/gcell/apps/test_all.cc b/gcell/apps/test_all.cc index 9823960c4..0b608e13b 100644 --- a/gcell/apps/test_all.cc +++ b/gcell/apps/test_all.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,18 +20,25 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> +#include <gr_unittests.h> #include "../lib/runtime/qa_gcell_runtime.h" #include "../lib/wrapper/qa_gcell_wrapper.h" int main(int argc, char **argv) { - - CppUnit::TextTestRunner runner; + char path[200]; + get_unittest_path ("gcell_all.xml", path, 200); + + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest(qa_gcell_runtime::suite()); runner.addTest(qa_gcell_wrapper::suite()); + runner.setOutputter(xmlout); bool was_successful = runner.run("", false); diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index b0e804277..abd789a1d 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -120,6 +120,7 @@ grinclude_HEADERS = \ gr_timer.h \ gr_tmp_path.h \ gr_types.h \ + gr_unittests.h \ gr_vmcircbuf.h noinst_HEADERS = \ diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h new file mode 100644 index 000000000..680e59ca4 --- /dev/null +++ b/gnuradio-core/src/lib/runtime/gr_unittests.h @@ -0,0 +1,70 @@ +/* -*- 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + + +#ifdef MKDIR_TAKES_ONE_ARG +#define gr_mkdir(pathname, mode) mkdir(pathname) +#else +#define gr_mkdir(pathname, mode) mkdir((pathname), (mode)) +#endif + +/* + * Mostly taken from gr_preferences.cc/h + * The simplest thing that could possibly work: + * the key is the filename; the value is the file contents. + */ + +static void +ensure_unittest_path (const char *grpath, const char *path) +{ + struct stat statbuf; + if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) + return; + + // blindly try to make it // FIXME make this robust. C++ SUCKS! + gr_mkdir (grpath, 0750); + gr_mkdir (path, 0750); +} + +static void +get_unittest_path (const char *filename, char *fullpath, size_t pathsize) +{ + char path[200]; + char grpath[200]; + snprintf (grpath, sizeof(grpath), "%s/.gnuradio", getenv ("HOME")); + snprintf (path, sizeof(path), "%s/unittests", grpath); + snprintf (fullpath, pathsize, "%s/%s", path, filename); + + ensure_unittest_path(grpath, path); +} + diff --git a/gnuradio-core/src/python/gnuradio/Makefile.am b/gnuradio-core/src/python/gnuradio/Makefile.am index f0516f2fd..a3f3518de 100644 --- a/gnuradio-core/src/python/gnuradio/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2007,2008,2009 Free Software Foundation, Inc. +# Copyright 2004,2007,2008,2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -34,6 +34,7 @@ grpython_PYTHON = \ ofdm_packet_utils.py \ packet_utils.py \ gr_unittest.py \ + gr_xmlrunner.py \ optfir.py \ usrp_options.py \ window.py diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py index 2fa97fad8..8fb70fb3f 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, gr_unittest -class test_head (gr_unittest.TestCase): +class test_add_and_friends (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -126,4 +126,4 @@ class test_head (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_add_and_friends, "test_add_and_friends.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py index 215e0cace..90056e09f 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -350,4 +350,4 @@ class test_add_v_and_friends(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_add_v_and_friends, "test_add_v_and_friends.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py index bb3ddb11e..c55d191e0 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,7 +25,7 @@ import math test_output = False -class test_sig_source (gr_unittest.TestCase): +class test_agc (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -430,4 +430,4 @@ class test_sig_source (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_agc, "test_agc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py index 2e16d879b..a9db3295a 100644 --- a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,7 +24,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_arg_max (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -73,5 +73,5 @@ class test_sig_source (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_arg_max, "test_arg_max.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py index 29b9796cd..b8b718a09 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -227,4 +227,4 @@ class xtest_bin_statistics(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(xtest_bin_statistics, "test_bin_statistics.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py index ee9bae65b..8cfb60099 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2007,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, gr_unittest -class test_head (gr_unittest.TestCase): +class test_boolean_operators (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -159,4 +159,4 @@ class test_head (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_boolean_operators, "test_boolean_operators.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_classify.py b/gnuradio-core/src/python/gnuradio/gr/qa_classify.py index ac17aff29..ac5b53b57 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_classify.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_classify.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -38,7 +38,7 @@ def np2(k): return m -class qa_classify(gr_unittest.TestCase): +class test_classify(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() @@ -178,5 +178,4 @@ class qa_classify(gr_unittest.TestCase): assert sum < 1e-6 if __name__ == '__main__': - gr_unittest.main() - + gr_unittest.run(test_classify, "test_classify.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py b/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py index b1ab8f546..79e9cd092 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -46,4 +46,4 @@ class test_cma_equalizer_fir(gr_unittest.TestCase): self.assertComplexTuplesAlmostEqual(expected_data, result) if __name__ == "__main__": - gr_unittest.main()
\ No newline at end of file + gr_unittest.run(test_cma_equalizer_fir, "test_cma_equalizer_fir.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py b/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py index 10f366879..76627247b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -138,5 +138,5 @@ class test_complex_ops (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_complex_ops, "test_complex_ops.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py b/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py index 13d2840a0..27e1802e0 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_head (gr_unittest.TestCase): +class test_constellation_decoder (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -49,5 +49,5 @@ class test_head (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_constellation_decoder, "test_constellation_decoder.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py index 7f9f72a7b..e8ee480cc 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -55,4 +55,4 @@ class test_copy(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_copy, "test_copy.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py b/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py index a436c6ad6..b3575f4e6 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -79,5 +79,5 @@ class test_correlate_access_code(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_correlate_access_code, "test_correlate_access_code.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py index 8835cba5a..7cad0ae72 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -62,4 +62,4 @@ class test_delay (gr_unittest.TestCase): self.assertEqual (expected_result, dst_data) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_delay, "test_delay.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py index 04c0e2a49..97e9e329a 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,7 +31,7 @@ def make_random_int_tuple(L, min, max): return tuple(result) -class test_encoder (gr_unittest.TestCase): +class test_diff_encoder (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -82,5 +82,5 @@ class test_encoder (gr_unittest.TestCase): self.assertEqual(expected_result, actual_result) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_diff_encoder, "test_diff_encoder.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py index 385ffa519..5ac115e20 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_complex_ops (gr_unittest.TestCase): +class test_diff_phasor (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -46,5 +46,5 @@ class test_complex_ops (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py index b0dc47061..caf3959f4 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -47,4 +47,4 @@ class test_ccsds_27 (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_ccsds_27, "test_ccsds_27.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_feval.py b/gnuradio-core/src/python/gnuradio/gr/qa_feval.py index 64bbe45ce..a91409537 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_feval.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_feval.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -107,4 +107,4 @@ class test_feval(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_feval, "test_feval.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py index 412c4c48b..98d80fbb0 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,7 +29,7 @@ primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53, 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311) -class test_fft_filter(gr_unittest.TestCase): +class test_fft(gr_unittest.TestCase): def setUp(self): pass @@ -154,5 +154,5 @@ class test_fft_filter(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_fft, "test_fft.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py index d4106ee47..b3124ad29 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -275,5 +275,5 @@ class test_fft_filter(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_fft_filter, "test_fft_filter.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py index b92f143d5..a25c65e5c 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class qa_filter_delay_fc (gr_unittest.TestCase): +class test_filter_delay_fc (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -314,4 +314,4 @@ class qa_filter_delay_fc (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_filter_delay_fc, "test_filter_delay_fc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py index 4466e8aab..c9ba54164 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -35,5 +35,4 @@ class test_fractional_resampler (gr_unittest.TestCase): op2 = gr.fractional_interpolator_cc(0.0, 1.0) if __name__ == '__main__': - gr_unittest.main() - + gr_unittest.run(test_fractional_resampler, "test_fractional_resampler.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py index 53d1a89ba..829185c34 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -52,5 +52,5 @@ class test_frequency_modulator (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_frequency_modulator, "test_frequency_modulator.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py index b506e3ed4..429e57c32 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -71,5 +71,5 @@ class test_bytes_to_syms (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py index fc211657f..1665d9dd5 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -91,4 +91,4 @@ def auto_correlate(data): return R if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_glfsr_source, "test_glfsr_source.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py index d5dc595c9..dcb3d867e 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -61,4 +61,4 @@ class test_goertzel(gr_unittest.TestCase): self.assertAlmostEqual(expected_result, actual_result, places=4) if __name__ == '__main__': - gr_unittest.main() + gr_unittest.run(test_goertzel, "test_goertzel.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_head.py b/gnuradio-core/src/python/gnuradio/gr/qa_head.py index b7a60597b..aae233b56 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_head.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_head.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -44,4 +44,4 @@ class test_head (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_head, "test_head.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py index cc336a4d1..924a0fb52 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py @@ -366,4 +366,4 @@ class test_hier_block2(gr_unittest.TestCase): if __name__ == "__main__": - gr_unittest.main() + gr_unittest.run(test_hier_block2, "test_hier_block2.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py index 817ba9408..2235f28b1 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_hilbert (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -113,4 +113,4 @@ class test_sig_source (gr_unittest.TestCase): self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_hilbert, "test_hilbert.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py index 833285077..0e522c16b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -155,5 +155,5 @@ class test_iir (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_iir, "test_iir.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py index fbd601e34..501a89f84 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -72,4 +72,4 @@ class test_integrate (gr_unittest.TestCase): self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_integrate, "test_integrate.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py index 3e0b6c5fc..1320d0ec5 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -77,5 +77,5 @@ class test_interleave (gr_unittest.TestCase): self.assertFloatTuplesAlmostEqual (expected_result3, dst3.data ()) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_interleave, "test_interleave.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py index ea326ce40..9901b71b7 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -50,5 +50,5 @@ class test_interp_fir_filter (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_interp_fir_filter, "test_interp_fir_filter.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py index cc25d180e..2f0bbe33d 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -87,5 +87,5 @@ class test_kludge_copy(gr_unittest.TestCase): self.assertRaises(ValueError, self.tb.run) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_kludge_copy, "test_kludge_copy.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py index 91ddf7cd7..7d29a9507 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2008 Free Software Foundation, Inc. +# Copyright 2005,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, gr_unittest -class test_head (gr_unittest.TestCase): +class test_kludged_imports (gr_unittest.TestCase): def setUp(self): pass @@ -40,4 +40,4 @@ class test_head (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_kludged_imports, "test_kludged_imports.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_max.py b/gnuradio-core/src/python/gnuradio/gr/qa_max.py index 0171c93db..5aa231623 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_max.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_max.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,7 +24,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_max (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -66,5 +66,5 @@ class test_sig_source (gr_unittest.TestCase): self.assertEqual(expected_result, result_data) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_max, "test_max.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_message.py b/gnuradio-core/src/python/gnuradio/gr/qa_message.py index cb6c4c33c..e7f2778d1 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_message.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_message.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -128,4 +128,4 @@ class test_message (gr_unittest.TestCase): self.assertEquals(tuple(map(ord, '0123456789')), dst.data()) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_message, "test_message.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_mute.py b/gnuradio-core/src/python/gnuradio/gr/qa_mute.py index 646f495c4..58c5062a5 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_mute.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_mute.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, gr_unittest -class test_head (gr_unittest.TestCase): +class test_mute (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -86,4 +86,4 @@ class test_head (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_mute, "test_mute.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py index 4dca67b22..5a2e6a0d2 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, gr_unittest -class test_single_pole_iir(gr_unittest.TestCase): +class test_nlog10(gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -43,5 +43,5 @@ class test_single_pole_iir(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_nlog10, "test_nlog10.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py index f8ed739a9..4a575f5d6 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -35,5 +35,5 @@ class test_noise_source(gr_unittest.TestCase): op = gr.noise_source_f(gr.GR_GAUSSIAN, 10, 10) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_noise_source, "test_noise_source.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py b/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py index d45560d3c..d69f5ca5b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest from pprint import pprint -class testing (gr_unittest.TestCase): +class test_ofdm_insert_preamble (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -176,4 +176,4 @@ class testing (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_ofdm_insert_preamble, "test_ofdm_insert_preamble.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py b/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py index b1b3a971d..8833f755b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -401,5 +401,5 @@ class test_packing(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_packing, "test_packing.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py index 533f4f051..a6683c5c3 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -139,5 +139,5 @@ class test_pipe_fittings(gr_unittest.TestCase): self.assertEqual(expected_results, dst.data()) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_pipe_fittings, "test_pipe_fittings.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py index 4a109663c..8e4a0eefa 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_pll_carriertracking (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() @@ -155,4 +155,4 @@ class test_sig_source (gr_unittest.TestCase): self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_pll_carriertracking, "test_pll_carriertracking.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py index ac9c1844e..5225a9a3b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_pll_freqdet (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() @@ -158,4 +158,4 @@ class test_sig_source (gr_unittest.TestCase): self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 3) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_pll_freqdet, "test_pll_freqdet.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py index 9cafa61e3..c40a885a8 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_pll_refout (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() @@ -155,4 +155,4 @@ class test_sig_source (gr_unittest.TestCase): self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_pll_refout, "test_pll_refout.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py index 01d01bde0..fbdabb4cb 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -47,4 +47,4 @@ class test_pn_correlator_cc(gr_unittest.TestCase): self.assertEqual(data[-1], (1.0+0j)) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_pn_correlator_cc, "test_pn_correlator_cc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py index f8bf4b121..3bd6160df 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005,2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -294,5 +294,5 @@ class test_rational_resampler (gr_unittest.TestCase): if __name__ == '__main__': pass # FIXME: Disabled, see ticket:210 - # gr_unittest.main() + # gr_unittest.run(test_rational_resampler, "test_rational_resampler.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py index 64e751189..32ecc3776 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_sig_source (gr_unittest.TestCase): +class test_regenerate (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -87,4 +87,4 @@ class test_sig_source (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_regenerate, "test_regenerate.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py index 1ecc7ead3..2b1429980 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -45,4 +45,4 @@ class test_repeat (gr_unittest.TestCase): self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_repeat, "test_repeat.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py index aecf49293..241d8ec2a 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -61,4 +61,4 @@ class test_scrambler(gr_unittest.TestCase): self.assertEqual(src_data, dst.data()) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_scrambler, "test_scrambler.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py index 058890c4f..4bb58038f 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -154,4 +154,4 @@ class test_sig_source (gr_unittest.TestCase): self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_sig_source, "test_sig_source.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py index 8ad0a9bb2..1d2e6595c 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -68,5 +68,5 @@ class test_single_pole_iir(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_single_pole_iir, "test_single_pole_iir.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py index 865c7c906..47b4948ba 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005,2006,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -68,5 +68,5 @@ class test_single_pole_iir_cc(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_single_pole_iir_cc, "test_single_pole_iir_cc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py index 106e97314..de2d8fc95 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -99,4 +99,4 @@ class test_skiphead (gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_skiphead, "test_skiphead.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py index 8a76f8144..7d6ddf81b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ from gnuradio import gr, gr_unittest -class test_head (gr_unittest.TestCase): +class test_stream_mux (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -165,4 +165,4 @@ class test_head (gr_unittest.TestCase): self.assertEqual (exp_data, result_data) if __name__ == '__main__': - gr_unittest.main() + gr_unittest.run(test_stream_mux, "test_stream_mux.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py index b00b26bbe..097e394c9 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest from threading import Timer -class test_sink_source(gr_unittest.TestCase): +class test_udp_sink_source(gr_unittest.TestCase): def setUp(self): self.tb_snd = gr.top_block() @@ -95,5 +95,5 @@ class test_sink_source(gr_unittest.TestCase): #print "tb_rcv stopped by Timer" if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_udp_sink_source, "test_udp_sink_source.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py index edb263ade..d1faf9d9e 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -53,5 +53,5 @@ class test_unpack(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_unpack, "test_unpack.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py index 149c66903..5d8d85c7c 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import math -class test_sink_source(gr_unittest.TestCase): +class test_vector_sink_source(gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -61,5 +61,5 @@ class test_sink_source(gr_unittest.TestCase): self.assertRaises(ValueError, lambda : gr.vector_source_f(src_data, False, 3)) if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py index 3ba5dfbce..d9f38e3f1 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,7 +27,7 @@ from os.path import getsize g_in_file = os.path.join (os.getenv ("srcdir"), "test_16bit_1chunk.wav") -class qa_wavefile(gr_unittest.TestCase): +class test_wavefile(gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -66,4 +66,4 @@ class qa_wavefile(gr_unittest.TestCase): if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_wavefile, "test_wavefile.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr_unittest.py b/gnuradio-core/src/python/gnuradio/gr_unittest.py index a48343c6b..8ecd83d54 100755 --- a/gnuradio-core/src/python/gnuradio/gr_unittest.py +++ b/gnuradio-core/src/python/gnuradio/gr_unittest.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,8 @@ # import unittest -import sys +import gr_xmlrunner +import sys, os, stat class TestCase(unittest.TestCase): """A subclass of unittest.TestCase that adds additional assertions @@ -106,6 +107,44 @@ TextTestRunner = unittest.TextTestRunner TestProgram = unittest.TestProgram main = TestProgram +def run(PUT, filename=None): + ''' + Runs the unittest on a TestCase and produces an optional XML report + PUT: the program under test and should be a gr_unittest.TestCase + filename: an optional filename to save the XML report of the tests + this will live in $HOME/.gnuradio/unittests/python + ''' + + # Run this is given a file name + if(filename is not None): + path = os.getenv("HOME") + "/.gnuradio/unittests/python" + + # Test if path exists; if not, build it + try: + st = os.stat(path) + except OSError: + os.makedirs(path, 0750) + + # Create an XML runner to filename + fout = file(path+"/"+filename, "w") + xmlrunner = gr_xmlrunner.XMLTestRunner(fout) + txtrunner = TextTestRunner(verbosity=1) + + # Run the test; runner also creates XML output file + # FIXME: make xmlrunner output to screen so we don't have to do run and main + suite = TestLoader().loadTestsFromTestCase(PUT) + xmlrunner.run(suite) + main() + + # This will run and fail make check if problem + # but does not output to screen. + #main(testRunner = xmlrunner) + + else: + # If no filename is given, just run the test + main() + + ############################################################################## # Executing this module from the command line ############################################################################## diff --git a/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py new file mode 100644 index 000000000..ded77f5f3 --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py @@ -0,0 +1,385 @@ +""" +XML Test Runner for PyUnit +""" + +# Written by Sebastian Rittau <srittau@jroger.in-berlin.de> and placed in +# the Public Domain. With contributions by Paolo Borelli and others. +# Added to GNU Radio Oct. 3, 2010 + +from __future__ import with_statement + +__version__ = "0.1" + +import os.path +import re +import sys +import time +import traceback +import unittest +from xml.sax.saxutils import escape + +try: + from StringIO import StringIO +except ImportError: + from io import StringIO + + +class _TestInfo(object): + + """Information about a particular test. + + Used by _XMLTestResult. + + """ + + def __init__(self, test, time): + (self._class, self._method) = test.id().rsplit(".", 1) + self._time = time + self._error = None + self._failure = None + + @staticmethod + def create_success(test, time): + """Create a _TestInfo instance for a successful test.""" + return _TestInfo(test, time) + + @staticmethod + def create_failure(test, time, failure): + """Create a _TestInfo instance for a failed test.""" + info = _TestInfo(test, time) + info._failure = failure + return info + + @staticmethod + def create_error(test, time, error): + """Create a _TestInfo instance for an erroneous test.""" + info = _TestInfo(test, time) + info._error = error + return info + + def print_report(self, stream): + """Print information about this test case in XML format to the + supplied stream. + + """ + stream.write(' <testcase classname="%(class)s" name="%(method)s" time="%(time).4f">' % \ + { + "class": self._class, + "method": self._method, + "time": self._time, + }) + if self._failure is not None: + self._print_error(stream, 'failure', self._failure) + if self._error is not None: + self._print_error(stream, 'error', self._error) + stream.write('</testcase>\n') + + def _print_error(self, stream, tagname, error): + """Print information from a failure or error to the supplied stream.""" + text = escape(str(error[1])) + stream.write('\n') + stream.write(' <%s type="%s">%s\n' \ + % (tagname, _clsname(error[0]), text)) + tb_stream = StringIO() + traceback.print_tb(error[2], None, tb_stream) + stream.write(escape(tb_stream.getvalue())) + stream.write(' </%s>\n' % tagname) + stream.write(' ') + + +def _clsname(cls): + return cls.__module__ + "." + cls.__name__ + + +class _XMLTestResult(unittest.TestResult): + + """A test result class that stores result as XML. + + Used by XMLTestRunner. + + """ + + def __init__(self, classname): + unittest.TestResult.__init__(self) + self._test_name = classname + self._start_time = None + self._tests = [] + self._error = None + self._failure = None + + def startTest(self, test): + unittest.TestResult.startTest(self, test) + self._error = None + self._failure = None + self._start_time = time.time() + + def stopTest(self, test): + time_taken = time.time() - self._start_time + unittest.TestResult.stopTest(self, test) + if self._error: + info = _TestInfo.create_error(test, time_taken, self._error) + elif self._failure: + info = _TestInfo.create_failure(test, time_taken, self._failure) + else: + info = _TestInfo.create_success(test, time_taken) + self._tests.append(info) + + def addError(self, test, err): + unittest.TestResult.addError(self, test, err) + self._error = err + + def addFailure(self, test, err): + unittest.TestResult.addFailure(self, test, err) + self._failure = err + + def print_report(self, stream, time_taken, out, err): + """Prints the XML report to the supplied stream. + + The time the tests took to perform as well as the captured standard + output and standard error streams must be passed in.a + + """ + stream.write('<testsuite errors="%(e)d" failures="%(f)d" ' % \ + { "e": len(self.errors), "f": len(self.failures) }) + stream.write('name="%(n)s" tests="%(t)d" time="%(time).3f">\n' % \ + { + "n": self._test_name, + "t": self.testsRun, + "time": time_taken, + }) + for info in self._tests: + info.print_report(stream) + stream.write(' <system-out><![CDATA[%s]]></system-out>\n' % out) + stream.write(' <system-err><![CDATA[%s]]></system-err>\n' % err) + stream.write('</testsuite>\n') + + +class XMLTestRunner(object): + + """A test runner that stores results in XML format compatible with JUnit. + + XMLTestRunner(stream=None) -> XML test runner + + The XML file is written to the supplied stream. If stream is None, the + results are stored in a file called TEST-<module>.<class>.xml in the + current working directory (if not overridden with the path property), + where <module> and <class> are the module and class name of the test class. + + """ + + def __init__(self, stream=None): + self._stream = stream + self._path = "." + + def run(self, test): + """Run the given test case or test suite.""" + class_ = test.__class__ + classname = class_.__module__ + "." + class_.__name__ + if self._stream == None: + filename = "TEST-%s.xml" % classname + stream = file(os.path.join(self._path, filename), "w") + stream.write('<?xml version="1.0" encoding="utf-8"?>\n') + else: + stream = self._stream + + result = _XMLTestResult(classname) + start_time = time.time() + + with _fake_std_streams(): + test(result) + try: + out_s = sys.stdout.getvalue() + except AttributeError: + out_s = "" + try: + err_s = sys.stderr.getvalue() + except AttributeError: + err_s = "" + + time_taken = time.time() - start_time + result.print_report(stream, time_taken, out_s, err_s) + if self._stream is None: + stream.close() + + return result + + def _set_path(self, path): + self._path = path + + path = property(lambda self: self._path, _set_path, None, + """The path where the XML files are stored. + + This property is ignored when the XML file is written to a file + stream.""") + + +class _fake_std_streams(object): + + def __enter__(self): + self._orig_stdout = sys.stdout + self._orig_stderr = sys.stderr + sys.stdout = StringIO() + sys.stderr = StringIO() + + def __exit__(self, exc_type, exc_val, exc_tb): + sys.stdout = self._orig_stdout + sys.stderr = self._orig_stderr + + +class XMLTestRunnerTest(unittest.TestCase): + + def setUp(self): + self._stream = StringIO() + + def _try_test_run(self, test_class, expected): + + """Run the test suite against the supplied test class and compare the + XML result against the expected XML string. Fail if the expected + string doesn't match the actual string. All time attributes in the + expected string should have the value "0.000". All error and failure + messages are reduced to "Foobar". + + """ + + runner = XMLTestRunner(self._stream) + runner.run(unittest.makeSuite(test_class)) + + got = self._stream.getvalue() + # Replace all time="X.YYY" attributes by time="0.000" to enable a + # simple string comparison. + got = re.sub(r'time="\d+\.\d+"', 'time="0.000"', got) + # Likewise, replace all failure and error messages by a simple "Foobar" + # string. + got = re.sub(r'(?s)<failure (.*?)>.*?</failure>', r'<failure \1>Foobar</failure>', got) + got = re.sub(r'(?s)<error (.*?)>.*?</error>', r'<error \1>Foobar</error>', got) + # And finally Python 3 compatibility. + got = got.replace('type="builtins.', 'type="exceptions.') + + self.assertEqual(expected, got) + + def test_no_tests(self): + """Regression test: Check whether a test run without any tests + matches a previous run. + + """ + class TestTest(unittest.TestCase): + pass + self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="0" time="0.000"> + <system-out><![CDATA[]]></system-out> + <system-err><![CDATA[]]></system-err> +</testsuite> +""") + + def test_success(self): + """Regression test: Check whether a test run with a successful test + matches a previous run. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + pass + self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000"> + <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase> + <system-out><![CDATA[]]></system-out> + <system-err><![CDATA[]]></system-err> +</testsuite> +""") + + def test_failure(self): + """Regression test: Check whether a test run with a failing test + matches a previous run. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + self.assert_(False) + self._try_test_run(TestTest, """<testsuite errors="0" failures="1" name="unittest.TestSuite" tests="1" time="0.000"> + <testcase classname="__main__.TestTest" name="test_foo" time="0.000"> + <failure type="exceptions.AssertionError">Foobar</failure> + </testcase> + <system-out><![CDATA[]]></system-out> + <system-err><![CDATA[]]></system-err> +</testsuite> +""") + + def test_error(self): + """Regression test: Check whether a test run with a erroneous test + matches a previous run. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + raise IndexError() + self._try_test_run(TestTest, """<testsuite errors="1" failures="0" name="unittest.TestSuite" tests="1" time="0.000"> + <testcase classname="__main__.TestTest" name="test_foo" time="0.000"> + <error type="exceptions.IndexError">Foobar</error> + </testcase> + <system-out><![CDATA[]]></system-out> + <system-err><![CDATA[]]></system-err> +</testsuite> +""") + + def test_stdout_capture(self): + """Regression test: Check whether a test run with output to stdout + matches a previous run. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + sys.stdout.write("Test\n") + self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000"> + <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase> + <system-out><![CDATA[Test +]]></system-out> + <system-err><![CDATA[]]></system-err> +</testsuite> +""") + + def test_stderr_capture(self): + """Regression test: Check whether a test run with output to stderr + matches a previous run. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + sys.stderr.write("Test\n") + self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000"> + <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase> + <system-out><![CDATA[]]></system-out> + <system-err><![CDATA[Test +]]></system-err> +</testsuite> +""") + + class NullStream(object): + """A file-like object that discards everything written to it.""" + def write(self, buffer): + pass + + def test_unittests_changing_stdout(self): + """Check whether the XMLTestRunner recovers gracefully from unit tests + that change stdout, but don't change it back properly. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + sys.stdout = XMLTestRunnerTest.NullStream() + + runner = XMLTestRunner(self._stream) + runner.run(unittest.makeSuite(TestTest)) + + def test_unittests_changing_stderr(self): + """Check whether the XMLTestRunner recovers gracefully from unit tests + that change stderr, but don't change it back properly. + + """ + class TestTest(unittest.TestCase): + def test_foo(self): + sys.stderr = XMLTestRunnerTest.NullStream() + + runner = XMLTestRunner(self._stream) + runner.run(unittest.makeSuite(TestTest)) + + +if __name__ == "__main__": + unittest.main() diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 6dc1a26f8..17ee32f34 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,7 +21,9 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> +#include <gr_unittests.h> #include <qa_runtime.h> #include <qa_general.h> #include <qa_filter.h> @@ -32,13 +34,18 @@ int main (int argc, char **argv) { - - CppUnit::TextTestRunner runner; + char path[200]; + get_unittest_path ("gnuradio_core_all.xml", path, 200); + + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); runner.addTest (qa_general::suite ()); runner.addTest (qa_filter::suite ()); // runner.addTest (qa_atsc::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc index f744d76e6..51642f81a 100644 --- a/gnuradio-core/src/tests/test_atsc.cc +++ b/gnuradio-core/src/tests/test_atsc.cc @@ -21,16 +21,24 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> + +#include <gr_unittests.h> #include <qa_atsc.h> int main (int argc, char **argv) { + char path[200]; + get_unittest_path ("gnuradio_core_atsc.xml", path, 200); - CppUnit::TextTestRunner runner; + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_atsc::suite ()); - + runner.setOutputter(xmlout); + bool was_successful = runner.run ("", false); return was_successful ? 0 : 1; diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc index 56e945238..90fe66c2f 100644 --- a/gnuradio-core/src/tests/test_filter.cc +++ b/gnuradio-core/src/tests/test_filter.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,15 +21,23 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> + +#include <gr_unittests.h> #include <qa_filter.h> int main (int argc, char **argv) { + char path[200]; + get_unittest_path ("gnuradio_core_atsc.xml", path, 200); - CppUnit::TextTestRunner runner; + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_filter::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc index 063e2ee45..16ee9c3ad 100644 --- a/gnuradio-core/src/tests/test_general.cc +++ b/gnuradio-core/src/tests/test_general.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,15 +21,23 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> + +#include <gr_unittests.h> #include <qa_general.h> int main (int argc, char **argv) { - - CppUnit::TextTestRunner runner; + char path[200]; + get_unittest_path ("gnuradio_core_general.xml", path, 200); + + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_general::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc index 8549f2a9b..c7983a23e 100644 --- a/gnuradio-core/src/tests/test_runtime.cc +++ b/gnuradio-core/src/tests/test_runtime.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,15 +21,23 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> + +#include <gr_unittests.h> #include <qa_runtime.h> int main (int argc, char **argv) { + char path[200]; + get_unittest_path ("gnuradio_core_runtime.xml", path, 200); - CppUnit::TextTestRunner runner; + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gr-atsc/src/lib/test_atsci.cc b/gr-atsc/src/lib/test_atsci.cc index 5267e0d4f..184895a90 100644 --- a/gr-atsc/src/lib/test_atsci.cc +++ b/gr-atsc/src/lib/test_atsci.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2006 Free Software Foundation, Inc. + * Copyright 2002,2006,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,16 +20,23 @@ * Boston, MA 02110-1301, USA. */ +#include <gr_unittests.h> #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> #include <qa_atsci.h> int main (int argc, char **argv) { - - CppUnit::TextTestRunner runner; + char path[200]; + get_unittest_path ("gr_atsc.xml", path, 200); + + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_atsc::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gr-audio-alsa/src/qa_alsa.py b/gr-audio-alsa/src/qa_alsa.py index f2a480a50..52dbfdc7a 100755 --- a/gr-audio-alsa/src/qa_alsa.py +++ b/gr-audio-alsa/src/qa_alsa.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import audio_alsa -class qa_alsa (gr_unittest.TestCase): +class test_audio_alsa (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -37,4 +37,4 @@ class qa_alsa (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_audio_alsa, "test_audio_alsa.xml") diff --git a/gr-audio-jack/src/qa_jack.py b/gr-audio-jack/src/qa_jack.py index d8a3aba88..ad6bee27b 100755 --- a/gr-audio-jack/src/qa_jack.py +++ b/gr-audio-jack/src/qa_jack.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import audio_jack -class qa_jack (gr_unittest.TestCase): +class test_audio_jack (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -37,4 +37,4 @@ class qa_jack (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_audio_jack, "test_audio_jack.xml") diff --git a/gr-audio-oss/src/qa_oss.py b/gr-audio-oss/src/qa_oss.py index 5427b50ec..365dabc25 100755 --- a/gr-audio-oss/src/qa_oss.py +++ b/gr-audio-oss/src/qa_oss.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import audio_oss -class qa_oss (gr_unittest.TestCase): +class test_audio_oss (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -37,4 +37,4 @@ class qa_oss (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_audio_oss, "test_audio_oss.xml") diff --git a/gr-audio-portaudio/src/qa_portaudio.py b/gr-audio-portaudio/src/qa_portaudio.py index f6a54061e..20731f38d 100755 --- a/gr-audio-portaudio/src/qa_portaudio.py +++ b/gr-audio-portaudio/src/qa_portaudio.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import audio_portaudio -class qa_portaudio (gr_unittest.TestCase): +class test_audio_portaudio (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -37,4 +37,4 @@ class qa_portaudio (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_audio_portaudio, "test_audio_portaudio.xml") diff --git a/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py b/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py index 1a39f636e..99a38d946 100755 --- a/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py +++ b/gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest, blks2 import cvsd_vocoder -class qa_cvsd_test (gr_unittest.TestCase): +class test_cvsd_vocoder (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() @@ -112,4 +112,4 @@ class qa_cvsd_test (gr_unittest.TestCase): """ if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_cvsd_vocoder, "test_cvsd_vocoder.xml") diff --git a/gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py b/gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py index ac5084072..4164a1965 100755 --- a/gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py +++ b/gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import gsm_full_rate -class qa_howto (gr_unittest.TestCase): +class test_gsm_vocoder (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -32,4 +32,4 @@ class qa_howto (gr_unittest.TestCase): self.tb = None if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_gsm_vocoder, "test_gsm_vocoder.xml") diff --git a/gr-howto-write-a-block/lib/test_all.cc b/gr-howto-write-a-block/lib/test_all.cc index 192c537bc..ac1e83839 100644 --- a/gr-howto-write-a-block/lib/test_all.cc +++ b/gr-howto-write-a-block/lib/test_all.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009 Free Software Foundation, Inc. + * Copyright 2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,16 +21,23 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> +#include <gr_unittests.h> #include <qa_howto.h> int main (int argc, char **argv) { - + char path[200]; + get_unittest_path ("gr_howto_write_a_block.xml", path, 200); + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest(qa_howto::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run("", false); diff --git a/gr-pager/python/qa_pager.py b/gr-pager/python/qa_pager.py index 5bf72b561..12a45d4c3 100755 --- a/gr-pager/python/qa_pager.py +++ b/gr-pager/python/qa_pager.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2006 Free Software Foundation, Inc. +# Copyright 2004,2006,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import pager_swig -class qa_pgr(gr_unittest.TestCase): +class test_pager(gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -32,4 +32,4 @@ class qa_pgr(gr_unittest.TestCase): self.tb = None if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_pager, "test_pager.xml") diff --git a/gr-qtgui/src/lib/.gitignore b/gr-qtgui/src/lib/.gitignore index 58c8081e5..11bb4342a 100644 --- a/gr-qtgui/src/lib/.gitignore +++ b/gr-qtgui/src/lib/.gitignore @@ -4,10 +4,10 @@ /.deps /qtgui.cc /qtgui.py -/WaterfallDisplayPlot_moc.cc -/Waterfall3DDisplayPlot_moc.cc -/TimeDomainDisplayPlot_moc.cc -/spectrumdisplayform_moc.cc -/spectrumdisplayform_ui.h -/FrequencyDisplayPlot_moc.cc -/ConstellationDisplayPlot_moc.cc +/WaterfallDisplayPlot.moc.cc +/Waterfall3DDisplayPlot.moc.cc +/TimeDomainDisplayPlot.moc.cc +/spectrumdisplayform.moc.cc +/spectrumdisplayform.ui.h +/FrequencyDisplayPlot.moc.cc +/ConstellationDisplayPlot.moc.cc diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc index e8e6288f5..9ad5bdd3c 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.cc @@ -24,6 +24,7 @@ public: } protected: + using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { QwtText t(QString("(%1, %2)").arg(p.x(), 0, 'f', 4). diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc index f2cde322e..d150e2e4c 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc @@ -79,7 +79,8 @@ public: } protected: - virtual QwtText trackerText( const QwtDoublePoint& p ) const + using QwtPlotZoomer::trackerText; + virtual QwtText trackerText( const QwtDoublePoint& p ) const { QwtText t(QString("%1 %2, %3 dB"). arg(p.x(), 0, 'f', GetFrequencyPrecision()). diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/src/lib/Makefile.am index 6d4a91257..4ba637ad6 100644 --- a/gr-qtgui/src/lib/Makefile.am +++ b/gr-qtgui/src/lib/Makefile.am @@ -27,13 +27,12 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ # Only include these files in the build if qtgui passes configure checks # This is mostly to help make distcheck pass QMAKE_SOURCES = \ - spectrumdisplayform_moc.cc \ - FrequencyDisplayPlot_moc.cc \ - TimeDomainDisplayPlot_moc.cc \ - WaterfallDisplayPlot_moc.cc \ - Waterfall3DDisplayPlot_moc.cc \ - ConstellationDisplayPlot_moc.cc \ - spectrumdisplayform_ui.h + spectrumdisplayform.moc.cc \ + FrequencyDisplayPlot.moc.cc \ + TimeDomainDisplayPlot.moc.cc \ + WaterfallDisplayPlot.moc.cc \ + ConstellationDisplayPlot.moc.cc \ + spectrumdisplayform.ui.h EXTRA_DIST = spectrumdisplayform.ui @@ -47,7 +46,6 @@ libgnuradio_qtgui_la_SOURCES = \ FrequencyDisplayPlot.cc \ TimeDomainDisplayPlot.cc \ WaterfallDisplayPlot.cc \ - Waterfall3DDisplayPlot.cc \ waterfallGlobalData.cc \ ConstellationDisplayPlot.cc \ spectrumdisplayform.cc \ @@ -57,12 +55,13 @@ libgnuradio_qtgui_la_SOURCES = \ qtgui_sink_c.cc \ qtgui_sink_f.cc +nodist_libgnuradio_qtgui_la_SOURCES=$(BUILT_SOURCES) + # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ FrequencyDisplayPlot.h \ TimeDomainDisplayPlot.h \ WaterfallDisplayPlot.h \ - Waterfall3DDisplayPlot.h \ waterfallGlobalData.h \ ConstellationDisplayPlot.h \ highResTimeFunctions.h \ @@ -74,12 +73,11 @@ grinclude_HEADERS = \ qtgui_sink_c.h \ qtgui_sink_f.h -nodist_libqtsrc_la_SOURCES = $(QMAKE_SOURCES) - -%_moc.cc : %.h - $(QT_MOC_EXEC) -DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -p $(srcdir) $< -o $@ +QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB +%.moc.cc : %.h + $(QT_MOC_EXEC) $(QT_MOC_FLAGS) -p $(srcdir) $< -o $@ -%_ui.h : %.ui +%.ui.h : %.ui $(QT_UIC_EXEC) $< -o $@ # magic flags diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc index 8c1b36703..563ed34ba 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc @@ -61,8 +61,7 @@ SpectrumGUIClass::~SpectrumGUIClass() void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, const bool frequency, const bool waterfall, - const bool waterfall3d, const bool time, - const bool constellation, + const bool time, const bool constellation, const bool use_openGL) { //_windowStateLock->Lock(); @@ -87,7 +86,6 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); _spectrumDisplayForm->ToggleTabWaterfall(waterfall); - _spectrumDisplayForm->ToggleTabWaterfall3D(waterfall3d); _spectrumDisplayForm->ToggleTabTime(time); _spectrumDisplayForm->ToggleTabConstellation(constellation); diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h index 17d3a54c1..63a340c34 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.h +++ b/gr-qtgui/src/lib/SpectrumGUIClass.h @@ -31,8 +31,7 @@ public: void OpenSpectrumWindow(QWidget*, const bool frequency=true, const bool waterfall=true, - const bool waterfall3d=true, const bool time=true, - const bool constellation=true, + const bool time=true, const bool constellation=true, const bool use_openGL=true); void SetDisplayTitle(const std::string); diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc index c299f83a4..9c98cec5b 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc @@ -56,6 +56,7 @@ public: } protected: + using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { QwtText t(QString("%1 %2, %3 V").arg(p.x(), 0, 'f', GetTimePrecision()). diff --git a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc deleted file mode 100644 index f676cb4af..000000000 --- a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.cc +++ /dev/null @@ -1,410 +0,0 @@ -#ifndef WATERFALL_3D_DISPLAY_PLOT_C -#define WATERFALL_3D_DISPLAY_PLOT_C - -#include <Waterfall3DDisplayPlot.h> - -#include <qwt3d_helper.h> -#include <qapplication.h> - -Waterfall3DColorMap::Waterfall3DColorMap(): Qwt3D::Color(), QwtLinearColorMap(){ - _interval.setInterval(0, 1.0); - -} - -Waterfall3DColorMap::~Waterfall3DColorMap(){ - -} - -Qwt3D::RGBA -Waterfall3DColorMap::operator()(double, double, double z) const -{ - return Qwt3D::RGBA(Qwt3D::Qt2GL(color(_interval, z))); -} - -void -Waterfall3DColorMap::SetInterval(const double minValue, const double maxValue) -{ - _interval.setInterval(minValue, maxValue); -} - -Qwt3D::ColorVector& -Waterfall3DColorMap::createVector(Qwt3D::ColorVector& vec) -{ - // Generate 100 interval values and then return those - Qwt3D::ColorVector colorVec; - for(unsigned int number = 0; number < 100; number++){ - double value = (_interval.width() * (static_cast<double>(number) / 100.0)) + _interval.minValue(); - colorVec.push_back(operator()(0,0,value)); - } - vec = colorVec; - return vec; -} - - -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_WHITE_HOT; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_BLACK_HOT; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_INCANDESCENT; -const int Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED; - -Waterfall3DDisplayPlot::Waterfall3DDisplayPlot(QWidget* parent):Qwt3D::SurfacePlot(parent) -{ - _startFrequency = 0; - _stopFrequency = 4000; - - _createCoordinateSystemFlag = true; - - _initialized = false; - - _numPoints = 1024; - - _displayIntervalTime = (1.0/5.0); // 1/5 of a second between updates - - timespec_reset(&_lastReplot); - - _useCenterFrequencyFlag = false; - _centerFrequency = 0.0; - - _timePerFFT = 1.0; - timespec_reset(&_dataTimestamp); - - coordinates()->setAutoScale(false); - - _waterfallData = new Waterfall3DData(_startFrequency, _stopFrequency, _numPoints, 200); - _waterfallData->assign(this); - _waterfallData->create(); - - _intensityColorMapType = -1; - SetIntensityColorMapType(INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR, Qt::white, Qt::black, true, true); - - legend()->setScale(Qwt3D::LINEARSCALE); - legend()->setTitleString("Intensity"); - - enableMouse(true); -} - -Waterfall3DDisplayPlot::~Waterfall3DDisplayPlot() -{ - delete _waterfallData; -} - -void -Waterfall3DDisplayPlot::Init() -{ - if(!_initialized && initializedGL()){ - resize(parentWidget()->width(), parentWidget()->height()); - - // Attempting to prevent valgrind uninitialized variable errors in QwtPlot3d::Drawable class - glDisable(GL_POLYGON_OFFSET_FILL); - - setPlotStyle(Qwt3D::FILLED); - - setCoordinateStyle(Qwt3D::FRAME); - setFloorStyle(Qwt3D::FLOORDATA); - setOrtho(true); - - _initialized = true; - } -} - -void -Waterfall3DDisplayPlot::Reset() -{ - _waterfallData->ResizeData(_startFrequency, _stopFrequency, _numPoints); - _waterfallData->Reset(); - - if(initializedGL()){ - setScale(1, static_cast<int>(((_stopFrequency - _startFrequency) / 200) ), 10); - } - - _createCoordinateSystemFlag = true; - - timespec_reset(&_dataTimestamp); - _timePerFFT = 1.0; -} - -void -Waterfall3DDisplayPlot::SetFrequencyRange(const double constStartFreq, - const double constStopFreq, - const double constCenterFreq, - const bool useCenterFrequencyFlag, - const double units, - const std::string &strunits) -{ - double startFreq = constStartFreq / units; - double stopFreq = constStopFreq / units; - double centerFreq = constCenterFreq / units; - - if(stopFreq > startFreq) { - _startFrequency = startFreq; - _stopFrequency = stopFreq; - - _useCenterFrequencyFlag = useCenterFrequencyFlag; - _centerFrequency = centerFreq; - - Reset(); - - // Only replot if screen is visible - if(isVisible()){ - replot(); - } - } -} - -bool -Waterfall3DDisplayPlot::loadFromData(double** data, unsigned int columns, unsigned int rows - ,double minx, double maxx, double miny, double maxy) -{ - - Qwt3D::GridData* gridPtr = (Qwt3D::GridData*)actualData_p; - - gridPtr->setPeriodic(false,false); - gridPtr->setSize(columns,rows); - readIn(*gridPtr,data,columns,rows,minx,maxx,miny,maxy); - calcNormals(*gridPtr); - - updateData(); - updateNormals(); - - if( _createCoordinateSystemFlag ){ - createCoordinateSystem(); - - for (unsigned i=0; i!=coordinates()->axes.size(); ++i) - { - coordinates()->axes[i].setMajors(5); - coordinates()->axes[i].setMinors(3); - } - - coordinates()->axes[Qwt3D::Y1].setLabelString("Time"); - coordinates()->axes[Qwt3D::Y2].setLabelString("Time"); - coordinates()->axes[Qwt3D::Y3].setLabelString("Time"); - coordinates()->axes[Qwt3D::Y4].setLabelString("Time"); - coordinates()->axes[Qwt3D::Z1].setLabelString("Intensity (dB)"); - coordinates()->axes[Qwt3D::Z2].setLabelString("Intensity (dB)"); - coordinates()->axes[Qwt3D::Z3].setLabelString("Intensity (dB)"); - coordinates()->axes[Qwt3D::Z4].setLabelString("Intensity (dB)"); - - coordinates()->axes[Qwt3D::X1].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - coordinates()->axes[Qwt3D::X2].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - coordinates()->axes[Qwt3D::X3].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - coordinates()->axes[Qwt3D::X4].setLabelString((!_useCenterFrequencyFlag ? "Frequency (Hz)" : "Frequency (kHz)")); - - // The QwtPlot3D Interface takes ownership of these items, so there is no need to delete them... - coordinates()->axes[Qwt3D::X1].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - coordinates()->axes[Qwt3D::X2].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - coordinates()->axes[Qwt3D::X3].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - coordinates()->axes[Qwt3D::X4].setScale(new FrequencyScale(_useCenterFrequencyFlag, _centerFrequency)); - - coordinates()->axes[Qwt3D::Y1].setScale(new TimeScale(this)); - coordinates()->axes[Qwt3D::Y2].setScale(new TimeScale(this)); - coordinates()->axes[Qwt3D::Y3].setScale(new TimeScale(this)); - coordinates()->axes[Qwt3D::Y4].setScale(new TimeScale(this)); - - coordinates()->axes[Qwt3D::Z1].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - coordinates()->axes[Qwt3D::Z2].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - coordinates()->axes[Qwt3D::Z3].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - coordinates()->axes[Qwt3D::Z4].setScale(new IntensityScale(_waterfallData->GetFloorValue())); - - _createCoordinateSystemFlag = false; - } - - return true; -} - -double -Waterfall3DDisplayPlot::GetStartFrequency() const -{ - return _startFrequency; -} - -double -Waterfall3DDisplayPlot::GetStopFrequency() const -{ - return _stopFrequency; -} - -void -Waterfall3DDisplayPlot::PlotNewData(const double* dataPoints, - const int64_t numDataPoints, - const double timePerFFT, - const timespec timestamp, - const int droppedFrames) -{ - if(numDataPoints > 0){ - if(numDataPoints != _numPoints){ - _numPoints = numDataPoints; - - Reset(); - - if(isVisible()){ - replot(); - } - - _createCoordinateSystemFlag = true; - - _lastReplot = get_highres_clock(); - } - - _dataTimestamp = timestamp; - _timePerFFT = timePerFFT; - - _waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames); - _waterfallData->IncrementNumLinesToUpdate(); - } - - // Allow at least a 50% duty cycle - if(diff_timespec(get_highres_clock(), _lastReplot) > _displayIntervalTime){ - // Only update when window is visible - if(isVisible()){ - replot(); - } - - _lastReplot = get_highres_clock(); - } -} - -void -Waterfall3DDisplayPlot::SetIntensityRange(const double minIntensity, - const double maxIntensity) -{ - _waterfallData->SetFloorValue(minIntensity); - _waterfallData->setMinZ(0); - _waterfallData->setMaxZ(maxIntensity-minIntensity); - - _createCoordinateSystemFlag = true; - - emit UpdatedLowerIntensityLevel(minIntensity); - emit UpdatedUpperIntensityLevel(maxIntensity); - - SetIntensityColorMapType(_intensityColorMapType, - _userDefinedLowIntensityColor, - _userDefinedLowIntensityColor, true); -} - -void -Waterfall3DDisplayPlot::replot() -{ - if(!_initialized){ - Init(); - } - if(initializedGL()){ - const timespec startTime = get_highres_clock(); - - _waterfallData->create(); - - legend()->setMajors(4); - legend()->setMinors(5); - double start, stop; - coordinates()->axes[Qwt3D::Z1].limits(start,stop); - legend()->setLimits( _waterfallData->GetFloorValue(), _waterfallData->GetFloorValue() + stop - start ); - - coordinates()->axes[Qwt3D::X1].limits(start,stop); - - showColorLegend(true); - - updateGL(); - - double differenceTime = (diff_timespec(get_highres_clock(), startTime)); - - // Require at least a 20% duty cycle - differenceTime *= 4.0; - if(differenceTime > (1.0/5.0)){ - _displayIntervalTime = differenceTime; - } - } -} - -void -Waterfall3DDisplayPlot::resizeSlot( QSize *s ) -{ - resize(s->width(), s->height()); -} - -int -Waterfall3DDisplayPlot::GetIntensityColorMapType() const -{ - return _intensityColorMapType; -} - -void -Waterfall3DDisplayPlot::SetIntensityColorMapType(const int newType, - const QColor lowColor, - const QColor highColor, - const bool forceFlag, - const bool noReplotFlag) -{ - if(((_intensityColorMapType != newType) || forceFlag) || - ((newType == INTENSITY_COLOR_MAP_TYPE_USER_DEFINED) && - (lowColor.isValid() && highColor.isValid()))){ - - Waterfall3DColorMap* colorMap = new Waterfall3DColorMap(); - colorMap->SetInterval(_waterfallData->minZ(), _waterfallData->maxZ()); - - switch(newType){ - case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::darkCyan, Qt::white); - colorMap->addColorStop(0.25, Qt::cyan); - colorMap->addColorStop(0.5, Qt::yellow); - colorMap->addColorStop(0.75, Qt::red); - setBackgroundColor(Qwt3D::Qt2GL(Qt::gray)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::black, Qt::white); - setBackgroundColor(Qwt3D::Qt2GL(Qt::blue)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_BLACK_HOT:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::white, Qt::black); - setBackgroundColor(Qwt3D::Qt2GL(Qt::blue)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:{ - _intensityColorMapType = newType; - colorMap->setColorInterval(Qt::black, Qt::white); - colorMap->addColorStop(0.5, Qt::darkRed); - setBackgroundColor(Qwt3D::Qt2GL(Qt::gray)); - break; - } - case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:{ - _userDefinedLowIntensityColor = lowColor; - _userDefinedHighIntensityColor = highColor; - _intensityColorMapType = newType; - colorMap->setColorInterval(_userDefinedLowIntensityColor, _userDefinedHighIntensityColor); - setBackgroundColor(Qwt3D::Qt2GL(Qt::white)); - break; - } - default: - colorMap->setColorInterval(Qt::black, Qt::white); - break; - } - - // Qwt3D takes over destruction of this object... - setDataColor(colorMap); - - if(!noReplotFlag){ - // Draw again - replot(); - - // Update the last replot timer - _lastReplot = get_highres_clock(); - } - } -} - -const QColor -Waterfall3DDisplayPlot::GetUserDefinedLowIntensityColor() const -{ - return _userDefinedLowIntensityColor; -} - -const QColor -Waterfall3DDisplayPlot::GetUserDefinedHighIntensityColor() const -{ - return _userDefinedHighIntensityColor; -} - -#endif /* WATERFALL_3D_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h deleted file mode 100644 index 272bdf697..000000000 --- a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef WATERFALL_3D_DISPLAY_PLOT_HPP -#define WATERFALL_3D_DISPLAY_PLOT_HPP - -#include <cstdio> -#include <highResTimeFunctions.h> - -#include <waterfallGlobalData.h> -#include <qwt3d_surfaceplot.h> - -#include <qwt3d_color.h> -#include <qwt_color_map.h> - -class Waterfall3DColorMap: public Qwt3D::Color, public QwtLinearColorMap -{ -public: - Waterfall3DColorMap(); - virtual ~Waterfall3DColorMap(); - - virtual Qwt3D::RGBA operator()(double x, double y, double z)const; - virtual Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec); - - virtual void SetInterval(const double minValue, const double maxValue); - -protected: - -private: - QwtDoubleInterval _interval; -}; - -class Waterfall3DDisplayPlot:public Qwt3D::SurfacePlot{ - Q_OBJECT - - protected: - class IntensityScale:public Qwt3D::LinearScale{ - - friend class Qwt3D::Axis; - friend class Qwt3D::qwt3d_ptr<Qwt3D::Scale>; - - private: - double _floor; - - public: - explicit IntensityScale(const double newFloor):_floor(newFloor){ } - virtual ~IntensityScale(){} - - virtual QString ticLabel(unsigned int idx) const{ - if (idx<majors_p.size()) - { - return QString("%1").arg( majors_p[idx] + GetFloorValue(), 0, 'f', 0 ); - } - return QString(""); - } - - virtual double GetFloorValue()const{ return _floor; } - virtual void SetFloorValue(const double newFloor){ _floor = newFloor; } - - //! Returns a new heap based object utilized from qwt3d_ptr - Scale* clone() const {return new IntensityScale(*this);} - }; - - class TimeScale:public Qwt3D::LinearScale{ - - friend class Qwt3D::Axis; - friend class Qwt3D::qwt3d_ptr<Qwt3D::Scale>; - friend class Waterfall3DDisplayPlot; - - private: - Waterfall3DDisplayPlot* _plot; - - public: - TimeScale(Waterfall3DDisplayPlot* plot ):_plot(plot){ - } - virtual ~TimeScale(){ - } - - virtual QString ticLabel(unsigned int idx) const{ - if (idx<majors_p.size()) - { - const timespec markerTime = timespec_add(_plot->_dataTimestamp, - -(_plot->_timePerFFT) * majors_p[idx]); - struct tm timeTm; - gmtime_r(&markerTime.tv_sec, &timeTm); - - char* timeBuffer = new char[128]; - snprintf(timeBuffer, 128, "%02d:%02d:%02d.%03ld", timeTm.tm_hour, - timeTm.tm_min, timeTm.tm_sec, (markerTime.tv_nsec / 1000000)); - QString returnBuffer(timeBuffer); - delete[] timeBuffer; - return returnBuffer; - } - return QString(""); - } - - //! Returns a new heap based object utilized from qwt3d_ptr - Scale* clone() const {return new TimeScale(*this);} - }; - - class FrequencyScale: public Qwt3D::LinearScale{ - - friend class Qwt3D::Axis; - friend class Qwt3D::qwt3d_ptr<Qwt3D::Scale>; - private: - double _centerFrequency; - bool _useCenterFrequencyFlag; - public: - FrequencyScale(bool useCenterFrequencyFlag, double centerFrequency) - : _centerFrequency(centerFrequency),_useCenterFrequencyFlag(useCenterFrequencyFlag) - {} - - virtual ~FrequencyScale(){} - - virtual QString ticLabel(unsigned int idx) const - { - if (idx<majors_p.size()) - { - if(!_useCenterFrequencyFlag){ - return QString("%1").arg( majors_p[idx], 0, 'f', 0 ); - - } - else{ - return QString("%1").arg( (majors_p[idx] + _centerFrequency)/1000.0, 0, 'f', 3 ); - } - } - return QString(""); - } - - //! Returns a new heap based object utilized from qwt3d_ptr - Scale* clone() const {return new FrequencyScale(*this);} - }; - -public: - Waterfall3DDisplayPlot(QWidget*); - virtual ~Waterfall3DDisplayPlot(); - - void Init(); - void Reset(); - - bool loadFromData(double** data, unsigned int columns, unsigned int rows - ,double minx, double maxx, double miny, double maxy); - - void SetFrequencyRange(const double, const double, - const double, const bool, - const double units, const std::string &strunits); - double GetStartFrequency()const; - double GetStopFrequency()const; - - void PlotNewData(const double* dataPoints, const int64_t numDataPoints, - const double timePerFFT, const timespec timestamp, - const int droppedFrames); - - void SetIntensityRange(const double minIntensity, const double maxIntensity); - - virtual void replot(void); - - int GetIntensityColorMapType()const; - void SetIntensityColorMapType( const int, const QColor, - const QColor, const bool forceFlag = false, - const bool noReplotFlag = false ); - const QColor GetUserDefinedLowIntensityColor()const; - const QColor GetUserDefinedHighIntensityColor()const; - - static const int INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0; - static const int INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1; - static const int INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2; - static const int INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3; - static const int INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4; - -public slots: - void resizeSlot( QSize *s ); - - -signals: - void UpdatedLowerIntensityLevel(const double); - void UpdatedUpperIntensityLevel(const double); - -protected: - - double _startFrequency; - double _stopFrequency; - - Waterfall3DData* _waterfallData; - - timespec _lastReplot; - - int64_t _numPoints; - - double _displayIntervalTime; - - int _intensityColorMapType; - QColor _userDefinedLowIntensityColor; - QColor _userDefinedHighIntensityColor; - - bool _useCenterFrequencyFlag; - double _centerFrequency; - - timespec _dataTimestamp; - double _timePerFFT; - bool _initialized; - - bool _createCoordinateSystemFlag; - -private: - -}; - -#endif /* WATERFALL_3D_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc index e0804fa64..680c44756 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc @@ -186,6 +186,7 @@ public: } protected: + using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { QString yLabel(""); diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc index f77045938..c12c451b0 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/src/lib/qtgui_sink_c.cc @@ -64,10 +64,13 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, d_wintype((gr_firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), - d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime), - d_plotconst(plotconst), + d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { + if(plotwaterfall3d == true) { + fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); + } + d_main_gui = NULL; pthread_mutex_init(&d_pmutex, NULL); lock(); @@ -141,8 +144,7 @@ qtgui_sink_c::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plotwaterfall3d, d_plottime, - d_plotconst, + d_plottime, d_plotconst, opengl); // initialize update time to 10 times a second diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h index 1f6c28473..9aee66503 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/src/lib/qtgui_sink_c.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_SINK_C_H #define INCLUDED_QTGUI_SINK_C_H +#include <Python.h> #include <gr_block.h> #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> #include <qtgui.h> -#include <Python.h> #include "SpectrumGUIClass.h" class qtgui_sink_c; @@ -84,7 +84,7 @@ private: int d_index; gr_complex *d_residbuf; - bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst; + bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst; double d_update_time; diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc index 976b1761b..ab4fd082d 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/src/lib/qtgui_sink_f.cc @@ -64,10 +64,13 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, d_wintype((gr_firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), - d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime), - d_plotconst(plotconst), + d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { + if(plotwaterfall3d == true) { + fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); + } + d_main_gui = NULL; pthread_mutex_init(&d_pmutex, NULL); lock(); @@ -136,8 +139,7 @@ qtgui_sink_f::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plotwaterfall3d, d_plottime, - d_plotconst, + d_plottime, d_plotconst, opengl); // initialize update time to 10 times a second diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h index f603da7b6..0cac35d90 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/src/lib/qtgui_sink_f.h @@ -23,12 +23,12 @@ #ifndef INCLUDED_QTGUI_SINK_F_H #define INCLUDED_QTGUI_SINK_F_H +#include <Python.h> #include <gr_block.h> #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> #include <qtgui.h> -#include <Python.h> #include "SpectrumGUIClass.h" class qtgui_sink_f; @@ -82,7 +82,7 @@ private: int d_index; float *d_residbuf; - bool d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, d_plotconst; + bool d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst; double d_update_time; diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc index f52a63d1f..e0509a294 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.cc +++ b/gr-qtgui/src/lib/spectrumdisplayform.cc @@ -17,10 +17,6 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame); _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - //_waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame); - } - _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame); _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame); _numRealDataPoints = 1024; @@ -38,14 +34,6 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) WaterfallMinimumIntensityWheel->setTickCnt(50); WaterfallMinimumIntensityWheel->setValue(-200); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - Waterfall3DMaximumIntensityWheel->setRange(-200, 0); - Waterfall3DMaximumIntensityWheel->setTickCnt(50); - Waterfall3DMinimumIntensityWheel->setRange(-200, 0); - Waterfall3DMinimumIntensityWheel->setTickCnt(50); - Waterfall3DMinimumIntensityWheel->setValue(-200); - } - _peakFrequency = 0; _peakAmplitude = -HUGE_VAL; @@ -68,7 +56,6 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) ToggleTabFrequency(false); ToggleTabWaterfall(false); - ToggleTabWaterfall3D(false); ToggleTabTime(false); ToggleTabConstellation(false); @@ -134,11 +121,11 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate const std::complex<float>* complexDataPointsPtr = complexDataPoints+numFFTDataPoints/2; double* realFFTDataPointsPtr = _realFFTDataPoints; - double sumMean, localPeakAmplitude, localPeakFrequency; + double sumMean = 0.0; + double localPeakAmplitude = -HUGE_VAL; + double localPeakFrequency = 0.0; const double fftBinSize = (_stopFrequency-_startFrequency) / static_cast<double>(numFFTDataPoints); - localPeakAmplitude = -HUGE_VAL; - sumMean = 0.0; // Run this twice to perform the fftshift operation on the data here as well std::complex<float> scaleFactor = std::complex<float>((float)numFFTDataPoints); @@ -229,15 +216,6 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate d_update_time, dataTimestamp, spectrumUpdateEvent->getDroppedFFTFrames()); } - /* - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) { - _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, - d_update_time, dataTimestamp, - spectrumUpdateEvent->getDroppedFFTFrames()); - } - } - */ } @@ -265,12 +243,6 @@ SpectrumDisplayForm::resizeEvent( QResizeEvent *e ) s.setHeight(WaterfallPlotDisplayFrame->height()); emit _waterfallDisplayPlot->resizeSlot(&s); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - s.setWidth(Waterfall3DPlotDisplayFrame->width()); - s.setHeight(Waterfall3DPlotDisplayFrame->height()); - //emit _waterfall3DDisplayPlot->resizeSlot(&s); - } - s.setWidth(ConstellationDisplayFrame->width()); s.setHeight(ConstellationDisplayFrame->height()); emit _constellationDisplayPlot->resizeSlot(&s); @@ -289,32 +261,6 @@ SpectrumDisplayForm::customEvent( QEvent * e) waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value()); waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value()); - // If the video card doesn't support OpenGL then don't display the 3D Waterfall - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value()); - waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value()); - - // Check for Hardware Acceleration of the OpenGL - /* - if(!_waterfall3DDisplayPlot->format().directRendering()){ - // Only ask this once while the program is running... - if(_openGLWaterfall3DFlag == -1){ - _openGLWaterfall3DFlag = 0; - if(QMessageBox::warning(this, "OpenGL Direct Rendering NOT Supported", "<center>The system's video card hardware or current drivers do not support direct hardware rendering of the OpenGL modules.</center><br><center>Software rendering is VERY processor intensive.</center><br><center>Do you want to use software rendering?</center>", QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) == QMessageBox::Yes){ - _openGLWaterfall3DFlag = 1; - } - } - } - else{ - _openGLWaterfall3DFlag = 1; - } - */ - } - - if(_openGLWaterfall3DFlag != 1){ - ToggleTabWaterfall3D(false); - } - // Clear any previous display Reset(); } @@ -347,8 +293,6 @@ SpectrumDisplayForm::UpdateGuiTimer() // all of the plots. _frequencyDisplayPlot->canvas()->update(); _waterfallDisplayPlot->canvas()->update(); - //if((QGLFormat::hasOpenGL()) && (_useOpenGL)) - //_waterfall3DDisplayPlot->canvas()->update(); _timeDomainDisplayPlot->canvas()->update(); _constellationDisplayPlot->canvas()->update(); } @@ -437,15 +381,6 @@ SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, _centerFrequency, UseRFFrequenciesCheckBox->isChecked(), units, strunits[iunit]); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - /* - _waterfall3DDisplayPlot->SetFrequencyRange(_startFrequency, - _stopFrequency, - _centerFrequency, - UseRFFrequenciesCheckBox->isChecked(), - units, strunits[iunit]); - */ - } _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency, units, strtime[iunit]); } @@ -536,9 +471,6 @@ SpectrumDisplayForm::Reset() AverageDataReset(); _waterfallDisplayPlot->Reset(); - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - //_waterfall3DDisplayPlot->Reset(); - } } @@ -614,44 +546,6 @@ SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue ) } void -SpectrumDisplayForm::waterfall3DMaximumIntensityChangedCB( double newValue ) -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if(newValue > Waterfall3DMinimumIntensityWheel->value()){ - Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); - } - else{ - Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value()); - } - - /* - _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(), - Waterfall3DMaximumIntensityWheel->value()); - */ - } -} - - -void -SpectrumDisplayForm::waterfall3DMinimumIntensityChangedCB( double newValue ) -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if(newValue < Waterfall3DMaximumIntensityWheel->value()){ - Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0)); - } - else{ - Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value()); - } - - /* - _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(), - Waterfall3DMaximumIntensityWheel->value()); - */ - } -} - - -void SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString ) { if(_systemSpecifiedFlag){ @@ -677,24 +571,6 @@ SpectrumDisplayForm::WaterfallAutoScaleBtnCB() } void -SpectrumDisplayForm::Waterfall3DAutoScaleBtnCB() -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - double minimumIntensity = _noiseFloorAmplitude - 5; - if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){ - minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue(); - } - Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity); - double maximumIntensity = _peakAmplitude + 10; - if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){ - maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue(); - } - Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity); - waterfallMaximumIntensityChangedCB(maximumIntensity); - } -} - -void SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) { QColor lowIntensityColor; @@ -721,37 +597,6 @@ SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType ) } void -SpectrumDisplayForm::Waterfall3DIntensityColorTypeChanged( int newType ) -{ - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - QColor lowIntensityColor; - QColor highIntensityColor; - if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){ - // Select the Low Intensity Color - lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor(); - if(!lowIntensityColor.isValid()){ - lowIntensityColor = Qt::black; - } - QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok); - lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this); - - // Select the High Intensity Color - highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor(); - if(!highIntensityColor.isValid()){ - highIntensityColor = Qt::white; - } - QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok); - highIntensityColor = QColorDialog::getColor(highIntensityColor, this); - } - /* - _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, - highIntensityColor); - */ - } -} - - -void SpectrumDisplayForm::ToggleTabFrequency(const bool state) { if(state == true) { @@ -782,28 +627,6 @@ SpectrumDisplayForm::ToggleTabWaterfall(const bool state) } void -SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state) -{ - if(state == true) { - /* - if((QGLFormat::hasOpenGL()) && (_useOpenGL)) { - if(d_plot_waterfall3d == -1) { - SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display"); - d_plot_waterfall3d = SpectrumTypeTab->count()-1; - } - } - */ - SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage)); - d_plot_waterfall3d = -1; - fprintf(stderr, "\nWARNING: The Waterfall3D plot has been disabled until we get it working.\n\n"); - } - else { - SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage)); - d_plot_waterfall3d = -1; - } -} - -void SpectrumDisplayForm::ToggleTabTime(const bool state) { if(state == true) { diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h index bf2af7033..fbd08349b 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.h +++ b/gr-qtgui/src/lib/spectrumdisplayform.h @@ -1,7 +1,7 @@ #ifndef SPECTRUM_DISPLAY_FORM_H #define SPECTRUM_DISPLAY_FORM_H -#include "spectrumdisplayform_ui.h" +#include "spectrumdisplayform.ui.h" class SpectrumGUIClass; #include <SpectrumGUIClass.h> @@ -9,7 +9,6 @@ class SpectrumGUIClass; #include <SpectrumGUIClass.h> #include <FrequencyDisplayPlot.h> #include <WaterfallDisplayPlot.h> -#include <Waterfall3DDisplayPlot.h> #include <TimeDomainDisplayPlot.h> #include <ConstellationDisplayPlot.h> #include <QValidator> @@ -54,15 +53,10 @@ public slots: void waterfallMinimumIntensityChangedCB(double); void WaterfallIntensityColorTypeChanged(int); void WaterfallAutoScaleBtnCB(); - void waterfall3DMaximumIntensityChangedCB(double); - void waterfall3DMinimumIntensityChangedCB(double); - void Waterfall3DIntensityColorTypeChanged(int); - void Waterfall3DAutoScaleBtnCB(); void FFTComboBoxSelectedCB(const QString&); void ToggleTabFrequency(const bool state); void ToggleTabWaterfall(const bool state); - void ToggleTabWaterfall3D(const bool state); void ToggleTabTime(const bool state); void ToggleTabConstellation(const bool state); @@ -92,7 +86,6 @@ private: QIntValidator* _intValidator; FrequencyDisplayPlot* _frequencyDisplayPlot; WaterfallDisplayPlot* _waterfallDisplayPlot; - Waterfall3DDisplayPlot* _waterfall3DDisplayPlot; TimeDomainDisplayPlot* _timeDomainDisplayPlot; ConstellationDisplayPlot* _constellationDisplayPlot; SpectrumGUIClass* _system; diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/src/lib/spectrumdisplayform.ui index 0e652d833..5a23bc8a9 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.ui +++ b/gr-qtgui/src/lib/spectrumdisplayform.ui @@ -467,190 +467,6 @@ </item> </layout> </widget> - <widget class="QWidget" name="Waterfall3DPage"> - <attribute name="title"> - <string>3D Waterfall Display</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <widget class="QLabel" name="textLabel1_2"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Intensity Display:</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="Waterfall3DIntensityComboBox"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <item> - <property name="text"> - <string>Color</string> - </property> - </item> - <item> - <property name="text"> - <string>White Hot</string> - </property> - </item> - <item> - <property name="text"> - <string>Black Hot</string> - </property> - </item> - <item> - <property name="text"> - <string>Incandescent</string> - </property> - </item> - <item> - <property name="text"> - <string>User Defined</string> - </property> - </item> - </widget> - </item> - <item row="0" column="2"> - <widget class="QwtWheel" name="Waterfall3DMaximumIntensityWheel"> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="mouseTracking"> - <bool>true</bool> - </property> - <property name="focusPolicy"> - <enum>Qt::WheelFocus</enum> - </property> - <property name="valid"> - <bool>true</bool> - </property> - <property name="totalAngle"> - <double>200.000000000000000</double> - </property> - <property name="viewAngle"> - <double>20.000000000000000</double> - </property> - <property name="mass"> - <double>0.000000000000000</double> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="Waterfall3DMaximumIntensityLabel"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>100 dB</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0" colspan="4"> - <widget class="QFrame" name="Waterfall3DPlotDisplayFrame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QPushButton" name="Waterfall3DAutoScaleBtn"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="sizeIncrement"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Scales the Intensity to the current data extremes.</string> - </property> - <property name="text"> - <string>Auto Scale</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QwtWheel" name="Waterfall3DMinimumIntensityWheel"> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="valid"> - <bool>true</bool> - </property> - <property name="totalAngle"> - <double>200.000000000000000</double> - </property> - <property name="viewAngle"> - <double>20.000000000000000</double> - </property> - <property name="mass"> - <double>0.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLabel" name="Waterfall3DMinimumIntensityLabel"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>-100 dB</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </widget> <widget class="QWidget" name="TimeDomainPage"> <attribute name="title"> <string>Time Domain Display</string> @@ -721,7 +537,6 @@ <include location="global">SpectrumGUIClass.h</include> <include location="global">FrequencyDisplayPlot.h</include> <include location="global">WaterfallDisplayPlot.h</include> - <include location="global">Waterfall3DDisplayPlot.h</include> <include location="global">TimeDomainDisplayPlot.h</include> <include location="global">qvalidator.h</include> <include location="global">vector</include> @@ -858,38 +673,6 @@ </hints> </connection> <connection> - <sender>Waterfall3DMaximumIntensityWheel</sender> - <signal>valueChanged(double)</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>waterfall3DMaximumIntensityChangedCB(double)</slot> - <hints> - <hint type="sourcelabel"> - <x>217</x> - <y>44</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> - <sender>Waterfall3DMinimumIntensityWheel</sender> - <signal>valueChanged(double)</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>waterfall3DMinimumIntensityChangedCB(double)</slot> - <hints> - <hint type="sourcelabel"> - <x>217</x> - <y>349</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> <sender>FFTSizeComboBox</sender> <signal>activated(QString)</signal> <receiver>SpectrumDisplayForm</receiver> diff --git a/gr-qtgui/src/lib/waterfallGlobalData.cc b/gr-qtgui/src/lib/waterfallGlobalData.cc index 0cbef4ec3..1ba153f0d 100644 --- a/gr-qtgui/src/lib/waterfallGlobalData.cc +++ b/gr-qtgui/src/lib/waterfallGlobalData.cc @@ -3,11 +3,13 @@ #include <waterfallGlobalData.h> -#include <Waterfall3DDisplayPlot.h> - -WaterfallData::WaterfallData(const double minimumFrequency, const double maximumFrequency, const uint64_t fftPoints, const unsigned int historyExtent): - QwtRasterData(QwtDoubleRect(minimumFrequency /* X START */, 0 /* Y START */, maximumFrequency - minimumFrequency /* WIDTH */, static_cast<double>(historyExtent)/* HEIGHT */)) - +WaterfallData::WaterfallData(const double minimumFrequency, + const double maximumFrequency, + const uint64_t fftPoints, + const unsigned int historyExtent) + : QwtRasterData(QwtDoubleRect(minimumFrequency /* X START */, 0 /* Y START */, + maximumFrequency - minimumFrequency /* WIDTH */, + static_cast<double>(historyExtent)/* HEIGHT */)) { _intensityRange = QwtDoubleInterval(-200.0, 0.0); @@ -19,17 +21,20 @@ WaterfallData::WaterfallData(const double minimumFrequency, const double maximum Reset(); } -WaterfallData::~WaterfallData(){ +WaterfallData::~WaterfallData() +{ delete[] _spectrumData; } -void WaterfallData::Reset(){ +void WaterfallData::Reset() +{ memset(_spectrumData, 0x0, _fftPoints*_historyLength*sizeof(double)); _numLinesToUpdate = -1; } -void WaterfallData::Copy(const WaterfallData* rhs){ +void WaterfallData::Copy(const WaterfallData* rhs) +{ if((_fftPoints != rhs->GetNumFFTPoints()) || (boundingRect() != rhs->boundingRect()) ){ _fftPoints = rhs->GetNumFFTPoints(); @@ -43,7 +48,10 @@ void WaterfallData::Copy(const WaterfallData* rhs){ setRange(rhs->range()); } -void WaterfallData::ResizeData(const double startFreq, const double stopFreq, const uint64_t fftPoints){ +void WaterfallData::ResizeData(const double startFreq, + const double stopFreq, + const uint64_t fftPoints) +{ if((fftPoints != GetNumFFTPoints()) || (boundingRect().width() != (stopFreq - startFreq)) || (boundingRect().left() != startFreq)){ @@ -57,21 +65,27 @@ void WaterfallData::ResizeData(const double startFreq, const double stopFreq, co Reset(); } -QwtRasterData *WaterfallData::copy() const{ - WaterfallData* returnData = new WaterfallData(boundingRect().left(), boundingRect().right(), _fftPoints, _historyLength); +QwtRasterData *WaterfallData::copy() const +{ + WaterfallData* returnData = new WaterfallData(boundingRect().left(), + boundingRect().right(), + _fftPoints, _historyLength); returnData->Copy(this); return returnData; } -QwtDoubleInterval WaterfallData::range() const{ +QwtDoubleInterval WaterfallData::range() const +{ return _intensityRange; } -void WaterfallData::setRange(const QwtDoubleInterval& newRange){ +void WaterfallData::setRange(const QwtDoubleInterval& newRange) +{ _intensityRange = newRange; } -double WaterfallData::value(double x, double y) const{ +double WaterfallData::value(double x, double y) const +{ double returnValue = 0.0; const unsigned int intY = static_cast<unsigned int>((1.0 - (y/boundingRect().height())) * @@ -87,11 +101,14 @@ double WaterfallData::value(double x, double y) const{ return returnValue; } -uint64_t WaterfallData::GetNumFFTPoints()const{ +uint64_t WaterfallData::GetNumFFTPoints() const +{ return _fftPoints; } -void WaterfallData::addFFTData(const double* fftData, const uint64_t fftDataSize, const int droppedFrames){ +void WaterfallData::addFFTData(const double* fftData, + const uint64_t fftDataSize, + const int droppedFrames){ if(fftDataSize == _fftPoints){ int64_t heightOffset = _historyLength - 1 - droppedFrames; uint64_t drawingDroppedFrames = droppedFrames; @@ -104,155 +121,44 @@ void WaterfallData::addFFTData(const double* fftData, const uint64_t fftDataSize // Copy the old data over if any available if(heightOffset > 0){ - memmove( _spectrumData, &_spectrumData[(drawingDroppedFrames+1) * _fftPoints], heightOffset * _fftPoints * sizeof(double)) ; + memmove( _spectrumData, &_spectrumData[(drawingDroppedFrames+1) * _fftPoints], + heightOffset * _fftPoints * sizeof(double)) ; } if(drawingDroppedFrames > 0){ // Fill in zeros data for dropped data - memset(&_spectrumData[heightOffset * _fftPoints], 0x00, static_cast<int64_t>(drawingDroppedFrames) * _fftPoints * sizeof(double)); + memset(&_spectrumData[heightOffset * _fftPoints], 0x00, + static_cast<int64_t>(drawingDroppedFrames) * _fftPoints * sizeof(double)); } // add the new buffer memcpy(&_spectrumData[(_historyLength - 1) * _fftPoints], fftData, _fftPoints*sizeof(double)); - } } -double* WaterfallData::GetSpectrumDataBuffer()const{ +double* WaterfallData::GetSpectrumDataBuffer() const +{ return _spectrumData; } -void WaterfallData::SetSpectrumDataBuffer(const double* newData){ +void WaterfallData::SetSpectrumDataBuffer(const double* newData) +{ memcpy(_spectrumData, newData, _fftPoints * _historyLength * sizeof(double)); } -int WaterfallData::GetNumLinesToUpdate()const{ +int WaterfallData::GetNumLinesToUpdate() const +{ return _numLinesToUpdate; } -void WaterfallData::SetNumLinesToUpdate(const int newNum){ +void WaterfallData::SetNumLinesToUpdate(const int newNum) +{ _numLinesToUpdate = newNum; } -void WaterfallData::IncrementNumLinesToUpdate(){ - _numLinesToUpdate++; -} - -Waterfall3DData::Waterfall3DData(const double minimumFrequency, const double maximumFrequency, const uint64_t fftPoints, const unsigned int historyExtent): - WaterfallData(minimumFrequency, maximumFrequency, fftPoints, historyExtent), Qwt3D::Function(){ - - _floorValue = 0.0; - setMinZ(0.0); - setMaxZ(200.0); - - // Create the dummy mesh data until _ResizeMesh is called - data = new double*[1]; - data[0] = new double[1]; - Qwt3D::Function::setMesh(1,1); - - _ResizeMesh(); -} - -Waterfall3DData::~Waterfall3DData(){ - for ( unsigned i = 0; i < umesh_p; i++){ - delete[] data[i]; - } - delete[] data; - -} - -void Waterfall3DData::ResizeData(const double startFreq, const double stopFreq, const uint64_t fftPoints){ - if((fftPoints != GetNumFFTPoints()) || - (boundingRect().width() != (stopFreq - startFreq)) || - (boundingRect().left() != startFreq)){ - WaterfallData::ResizeData(startFreq, stopFreq, fftPoints); - _ResizeMesh(); - } - - Reset(); -} - -bool Waterfall3DData::create() +void WaterfallData::IncrementNumLinesToUpdate() { - if ((umesh_p<=2) || (vmesh_p<=2) || !plotwidget_p) - return false; - - // Almost the same as the old create, except that here we store our own data buffer in the class rather than re-creating it each time... - - unsigned i,j; - - /* get the data */ - double dx = (maxu_p - minu_p) / (umesh_p - 1); - double dy = (maxv_p - minv_p) / (vmesh_p - 1); - - for (i = 0; i < umesh_p; ++i) - { - for (j = 0; j < vmesh_p; ++j) - { - data[i][j] = operator()(minu_p + i*dx, minv_p + j*dy); - - if (data[i][j] > range_p.maxVertex.z) - data[i][j] = range_p.maxVertex.z; - else if (data[i][j] < range_p.minVertex.z) - data[i][j] = range_p.minVertex.z; - } - } - - Q_ASSERT(plotwidget_p); - if (!plotwidget_p) - { - fprintf(stderr,"Function: no valid Plot3D Widget assigned"); - } - else - { - ((Waterfall3DDisplayPlot*)plotwidget_p)->loadFromData(data, umesh_p, vmesh_p, minu_p, maxu_p, minv_p, maxv_p); - } - - return true; -} - -double Waterfall3DData::operator()(double x, double y){ - return value(x,y) - _floorValue; -} - -double Waterfall3DData::GetFloorValue()const{ - return _floorValue; -} - -void Waterfall3DData::SetFloorValue(const double newValue){ - _floorValue = newValue; -} - -double Waterfall3DData::minZ()const{ - return range_p.minVertex.z; -} - -double Waterfall3DData::maxZ()const{ - return range_p.maxVertex.z; -} - -void Waterfall3DData::setMesh(unsigned int, unsigned int){ - // Do Nothing - printf("Should Not Reach this Function\n"); -} - -void Waterfall3DData::_ResizeMesh(){ - // Clear out the old mesh - for ( unsigned i = 0; i < umesh_p; i++){ - delete[] data[i]; - } - delete[] data; - - Qwt3D::Function::setMesh(static_cast<int>(boundingRect().width()/20.0), _historyLength); - setDomain( boundingRect().left(), static_cast<int>(boundingRect().right()), 0, _historyLength); - - /* allocate some space for the mesh */ - unsigned i; - data = new double* [umesh_p] ; - for ( i = 0; i < umesh_p; i++) - { - data[i] = new double [vmesh_p]; - } + _numLinesToUpdate++; } #endif /* WATERFALL_GLOBAL_DATA_CPP */ diff --git a/gr-qtgui/src/lib/waterfallGlobalData.h b/gr-qtgui/src/lib/waterfallGlobalData.h index 247e0ae91..51f65064c 100644 --- a/gr-qtgui/src/lib/waterfallGlobalData.h +++ b/gr-qtgui/src/lib/waterfallGlobalData.h @@ -2,10 +2,8 @@ #define WATERFALL_GLOBAL_DATA_HPP #include <qwt_raster_data.h> -#include <qwt3d_function.h> #include <inttypes.h> -class Waterfall3DDisplayPlot; class WaterfallData: public QwtRasterData { @@ -46,34 +44,4 @@ private: }; -class Waterfall3DData: public WaterfallData, public Qwt3D::Function -{ -public: - Waterfall3DData(const double, const double, const uint64_t, const unsigned int); - virtual ~Waterfall3DData(); - - virtual void ResizeData(const double, const double, const uint64_t); - - virtual bool create(); - virtual void setMesh(unsigned int columns, unsigned int rows); //!< Sets number of rows and columns. - - virtual double operator()(double x, double y); - - virtual double GetFloorValue()const; - virtual void SetFloorValue(const double); - - virtual double minZ()const; - virtual double maxZ()const; - -protected: - void _ResizeMesh(); - - double** data; - double _floorValue; - -private: - -}; - - #endif /* WATERFALL_GLOBAL_DATA_HPP */ diff --git a/gr-radio-astronomy/src/python/qa_ra.py b/gr-radio-astronomy/src/python/qa_ra.py index 1c44e23ad..2cb0f42be 100755 --- a/gr-radio-astronomy/src/python/qa_ra.py +++ b/gr-radio-astronomy/src/python/qa_ra.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2006 Free Software Foundation, Inc. +# Copyright 2004,2006,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import ra -class qa_ra (gr_unittest.TestCase): +class test_radio_astronomy (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -35,4 +35,4 @@ class qa_ra (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_radio_astronomy, "test_radio_astronomy.xml") diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/src/python/qa_trellis.py index 306bf994d..cfeefea06 100755 --- a/gr-trellis/src/python/qa_trellis.py +++ b/gr-trellis/src/python/qa_trellis.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import trellis -class qa_trellis (gr_unittest.TestCase): +class test_trellis (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -68,11 +68,5 @@ class qa_trellis (gr_unittest.TestCase): i = trellis.interleaver(K,IN) self.assertEqual((K,IN,DIN),(i.K(),i.INTER(),i.DEINTER())) - - - - - - if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_trellis, "test_trellis.xml") diff --git a/gr-usrp/src/qa_usrp.py b/gr-usrp/src/qa_usrp.py index db2d32624..06e630330 100755 --- a/gr-usrp/src/qa_usrp.py +++ b/gr-usrp/src/qa_usrp.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import usrp_swig -class qa_usrp (gr_unittest.TestCase): +class test_usrp (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -37,4 +37,4 @@ class qa_usrp (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_usrp, "test_usrp.xml") diff --git a/gr-usrp2/src/qa_usrp2.py b/gr-usrp2/src/qa_usrp2.py index bc6664a1b..cc994b1e9 100755 --- a/gr-usrp2/src/qa_usrp2.py +++ b/gr-usrp2/src/qa_usrp2.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2008 Free Software Foundation, Inc. +# Copyright 2005,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import usrp2 -class qa_usrp2(gr_unittest.TestCase): +class test_usrp2(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() @@ -37,4 +37,4 @@ class qa_usrp2(gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_usrp2, "test_usrp2.xml") diff --git a/gr-video-sdl/src/qa_video_sdl.py b/gr-video-sdl/src/qa_video_sdl.py index 98da85f6b..8f82a60b1 100755 --- a/gr-video-sdl/src/qa_video_sdl.py +++ b/gr-video-sdl/src/qa_video_sdl.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,7 @@ from gnuradio import gr, gr_unittest import video_sdl -class qa_video_sdl (gr_unittest.TestCase): +class test_video_sdl (gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block () @@ -37,4 +37,4 @@ class qa_video_sdl (gr_unittest.TestCase): pass if __name__ == '__main__': - gr_unittest.main () + gr_unittest.run(test_video_sdl, "test_video_sdl.xml") diff --git a/gruel/src/lib/test_gruel.cc b/gruel/src/lib/test_gruel.cc index 669303447..f4b9fc4e2 100644 --- a/gruel/src/lib/test_gruel.cc +++ b/gruel/src/lib/test_gruel.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2009 Free Software Foundation, Inc. + * Copyright 2006,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,17 +21,70 @@ */ #include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> + +#include <stdlib.h> +#include <sys/stat.h> + #include "pmt/qa_pmt.h" +static void get_unittest_path (const char *filename, char *fullpath, size_t pathsize); + int main(int argc, char **argv) { + char path[200]; + get_unittest_path ("gruel.xml", path, 200); - CppUnit::TextTestRunner runner; + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(path); + 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; } + + +// NOTE: These are defined in gr_unittest.h for the rest of the project; +// rewriting here since we don't depend on gnuradio-core in gruel + +#ifdef MKDIR_TAKES_ONE_ARG +#define gr_mkdir(pathname, mode) mkdir(pathname) +#else +#define gr_mkdir(pathname, mode) mkdir((pathname), (mode)) +#endif + +/* + * Mostly taken from gr_preferences.cc/h + * The simplest thing that could possibly work: + * the key is the filename; the value is the file contents. + */ + +static void +ensure_unittest_path (const char *grpath, const char *path) +{ + struct stat statbuf; + if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) + return; + + // blindly try to make it // FIXME make this robust. C++ SUCKS! + gr_mkdir (grpath, 0750); + gr_mkdir (path, 0750); +} + +static void +get_unittest_path (const char *filename, char *fullpath, size_t pathsize) +{ + char path[200]; + char grpath[200]; + snprintf (grpath, sizeof(grpath), "%s/.gnuradio", getenv ("HOME")); + snprintf (path, sizeof(path), "%s/unittests", grpath); + snprintf (fullpath, pathsize, "%s/%s", path, filename); + + ensure_unittest_path(grpath, path); +} + |