diff options
author | Eric Blossom | 2010-12-27 22:37:30 -0800 |
---|---|---|
committer | Eric Blossom | 2010-12-27 22:37:30 -0800 |
commit | b8f174ce7eae1cfe8deda0353da4557a238730c9 (patch) | |
tree | f67a90c5a9dda07029f36fa9018f1eee99a4eb77 | |
parent | 3153f8f24b933043d937de32d65fe5d96652ec56 (diff) | |
download | gnuradio-b8f174ce7eae1cfe8deda0353da4557a238730c9.tar.gz gnuradio-b8f174ce7eae1cfe8deda0353da4557a238730c9.tar.bz2 gnuradio-b8f174ce7eae1cfe8deda0353da4557a238730c9.zip |
Add minimal Python and Guile QA code to gr-uhd.
-rw-r--r-- | config/grc_gr_uhd.m4 | 8 | ||||
-rw-r--r-- | gr-uhd/swig/.gitignore | 2 | ||||
-rw-r--r-- | gr-uhd/swig/Makefile.am | 15 | ||||
-rwxr-xr-x | gr-uhd/swig/qa_uhd.py | 40 | ||||
-rw-r--r-- | gr-uhd/swig/run_guile_tests.in | 14 | ||||
-rw-r--r-- | gr-uhd/swig/run_tests.in | 10 | ||||
-rw-r--r-- | gr-uhd/swig/uhd.test | 37 |
7 files changed, 123 insertions, 3 deletions
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4 index a9404425a..80052bb50 100644 --- a/config/grc_gr_uhd.m4 +++ b/config/grc_gr_uhd.m4 @@ -44,7 +44,13 @@ AC_DEFUN([GRC_GR_UHD],[ gr-uhd/grc/Makefile \ gr-uhd/lib/Makefile \ gr-uhd/swig/Makefile \ + gr-uhd/swig/run_tests \ + gr-uhd/swig/run_guile_tests \ ]) - GRC_BUILD_CONDITIONAL(gr-uhd) + GRC_BUILD_CONDITIONAL(gr-uhd,[ + dnl run_tests is created from run_tests.in. Make it executable. + AC_CONFIG_COMMANDS([run_tests_uhd], + [chmod +x gr-uhd/swig/run_tests gr-uhd/swig/run_guile_tests]) + ]) ]) diff --git a/gr-uhd/swig/.gitignore b/gr-uhd/swig/.gitignore index 8a421846d..8afaca254 100644 --- a/gr-uhd/swig/.gitignore +++ b/gr-uhd/swig/.gitignore @@ -4,3 +4,5 @@ /Makefile.in /guile /python +/run_guile_tests +/run_tests diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am index f227ac015..e93571a66 100644 --- a/gr-uhd/swig/Makefile.am +++ b/gr-uhd/swig/Makefile.am @@ -22,7 +22,12 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig -EXTRA_DIST += $(nobase_guile_DATA) +TESTS = +EXTRA_DIST += run_tests.in run_guile_tests.in $(nobase_guile_DATA) +DISTCLEANFILES += run_tests run_guile_tests + +noinst_PYTHON = qa_uhd.py +noinst_GUILE = uhd.test AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ @@ -39,7 +44,6 @@ endif # ---------------------------------------------------------------- # The SWIG library -# TESTS = run_tests TOP_SWIG_IFILES = \ uhd_swig.i @@ -71,3 +75,10 @@ if GR_DEFINE_HAVE_UHD uhd_swig_swig_args += -DGR_HAVE_UHD endif +if PYTHON +TESTS += run_tests +endif + +if GUILE +TESTS += run_guile_tests +endif diff --git a/gr-uhd/swig/qa_uhd.py b/gr-uhd/swig/qa_uhd.py new file mode 100755 index 000000000..2973d04cd --- /dev/null +++ b/gr-uhd/swig/qa_uhd.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# +# Copyright 2005,2008,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. +# + +from gnuradio import gr, gr_unittest +import uhd_swig + +class test_uhd(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_000_nop (self): + """Just see if we can import the module... + They may not have a UHD device connected, etc. Don't try to run anything""" + pass + +if __name__ == '__main__': + gr_unittest.run(test_uhd, "test_uhd.xml") diff --git a/gr-uhd/swig/run_guile_tests.in b/gr-uhd/swig/run_guile_tests.in new file mode 100644 index 000000000..5d08b0dd5 --- /dev/null +++ b/gr-uhd/swig/run_guile_tests.in @@ -0,0 +1,14 @@ +#!/bin/sh + +. @top_builddir@/setup_guile_test_env + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +add_local_paths \ + @srcdir@ \ + @abs_builddir@ \ + @abs_builddir@ + +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ diff --git a/gr-uhd/swig/run_tests.in b/gr-uhd/swig/run_tests.in new file mode 100644 index 000000000..195e71316 --- /dev/null +++ b/gr-uhd/swig/run_tests.in @@ -0,0 +1,10 @@ +#!/bin/sh + +# 1st parameter is absolute path to component source directory +# 2nd parameter is absolute path to component build directory +# 3rd parameter is path to Python QA directory + +@top_builddir@/run_tests.sh \ + @abs_top_srcdir@/gr-uhd \ + @abs_top_builddir@/gr-uhd \ + @srcdir@ diff --git a/gr-uhd/swig/uhd.test b/gr-uhd/swig/uhd.test new file mode 100644 index 000000000..adc51c884 --- /dev/null +++ b/gr-uhd/swig/uhd.test @@ -0,0 +1,37 @@ +;;; -*- Scheme -*- +;;; +;;; 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 this program. If not, see <http://www.gnu.org/licenses/>. +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + +(define-module (test-module) + #:use-module (oop goops) + #:use-module (gnuradio core) + #:use-module (gnuradio test-suite lib) + #:duplicates (merge-generics replace check)) + +;;; Just see if we can import the module... +;;; They may not have a UHD device attached, powered up etc. + +(use-modules (gnuradio uhd)) |