summaryrefslogtreecommitdiff
path: root/gr-uhd/swig
diff options
context:
space:
mode:
authorEric Blossom2010-12-27 22:37:30 -0800
committerEric Blossom2010-12-27 22:37:30 -0800
commitb8f174ce7eae1cfe8deda0353da4557a238730c9 (patch)
treef67a90c5a9dda07029f36fa9018f1eee99a4eb77 /gr-uhd/swig
parent3153f8f24b933043d937de32d65fe5d96652ec56 (diff)
downloadgnuradio-b8f174ce7eae1cfe8deda0353da4557a238730c9.tar.gz
gnuradio-b8f174ce7eae1cfe8deda0353da4557a238730c9.tar.bz2
gnuradio-b8f174ce7eae1cfe8deda0353da4557a238730c9.zip
Add minimal Python and Guile QA code to gr-uhd.
Diffstat (limited to 'gr-uhd/swig')
-rw-r--r--gr-uhd/swig/.gitignore2
-rw-r--r--gr-uhd/swig/Makefile.am15
-rwxr-xr-xgr-uhd/swig/qa_uhd.py40
-rw-r--r--gr-uhd/swig/run_guile_tests.in14
-rw-r--r--gr-uhd/swig/run_tests.in10
-rw-r--r--gr-uhd/swig/uhd.test37
6 files changed, 116 insertions, 2 deletions
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))