Merge branch 'maint'
authorJohnathan Corgan <jcorgan@corganenterprises.com>
Wed, 6 Oct 2010 19:34:14 +0000 (12:34 -0700)
committerJohnathan Corgan <jcorgan@corganenterprises.com>
Wed, 6 Oct 2010 19:35:08 +0000 (12:35 -0700)
* maint:
  Fixed setting of USB_LIBS for *win*
  Fix so that non-Darwin OSs use USB_LIBS correctly for linking
  New way of checking for various LIBUSB names; for legacy version, make sure the symbol 'usb_debug' exists (so-as to not use the 'compat' version).
  Finally, the simple fix for the qtgui issues; also, changed the naming scheme output from _moc to .moc files because I think this looks cleaner.
  Removing Waterfall3DPlot. The qwt_plot3d is too much of a hassle to deal with and the plotting is not that stable even when it does work. This does not change the API.
  Fixed gitignore to reflect changes in moc/ui file naming.
  Fixes a lot of warnings by cleaning up namespace issues.
  Finally, the simple fix for the qtgui issues; also, changed the naming scheme output from _moc to .moc files because I think this looks cleaner.
  Removing qwtplot3d dependency and fixing a missed include in waterfallGlobalData.h.
  Removing Waterfall3DPlot. The qwt_plot3d is too much of a hassle to deal with and the plotting is not that stable even when it does work. This does not change the API.

128 files changed:
dtools/bin/fix-copyright-years [new file with mode: 0755]
gcell/apps/test_all.cc
gnuradio-core/src/lib/general/gri_agc2_cc.i
gnuradio-core/src/lib/general/gri_agc2_ff.i
gnuradio-core/src/lib/io/gr_file_sink.cc
gnuradio-core/src/lib/io/gr_file_sink_base.cc
gnuradio-core/src/lib/io/gr_file_sink_base.h
gnuradio-core/src/lib/io/gr_file_sink_base.i
gnuradio-core/src/lib/io/gr_oscope_guts.cc
gnuradio-core/src/lib/io/gr_trigger_mode.h
gnuradio-core/src/lib/runtime/Makefile.am
gnuradio-core/src/lib/runtime/gr_unittests.h [new file with mode: 0644]
gnuradio-core/src/python/gnuradio/Makefile.am
gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py
gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py
gnuradio-core/src/python/gnuradio/gr/qa_agc.py
gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py
gnuradio-core/src/python/gnuradio/gr/qa_classify.py
gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py
gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py
gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py
gnuradio-core/src/python/gnuradio/gr/qa_copy.py
gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py
gnuradio-core/src/python/gnuradio/gr/qa_delay.py
gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py
gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py
gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
gnuradio-core/src/python/gnuradio/gr/qa_feval.py
gnuradio-core/src/python/gnuradio/gr/qa_fft.py
gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py
gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py
gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py
gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py
gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py
gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py
gnuradio-core/src/python/gnuradio/gr/qa_head.py
gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py
gnuradio-core/src/python/gnuradio/gr/qa_iir.py
gnuradio-core/src/python/gnuradio/gr/qa_integrate.py
gnuradio-core/src/python/gnuradio/gr/qa_interleave.py
gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py
gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py
gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
gnuradio-core/src/python/gnuradio/gr/qa_max.py
gnuradio-core/src/python/gnuradio/gr/qa_message.py
gnuradio-core/src/python/gnuradio/gr/qa_mute.py
gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py
gnuradio-core/src/python/gnuradio/gr/qa_noise.py
gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py
gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py
gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py
gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py
gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py
gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py
gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py
gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py
gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py
gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
gnuradio-core/src/python/gnuradio/gr_unittest.py
gnuradio-core/src/python/gnuradio/gr_xmlrunner.py [new file with mode: 0644]
gnuradio-core/src/tests/test_all.cc
gnuradio-core/src/tests/test_atsc.cc
gnuradio-core/src/tests/test_filter.cc
gnuradio-core/src/tests/test_general.cc
gnuradio-core/src/tests/test_runtime.cc
gr-atsc/src/lib/test_atsci.cc
gr-audio-alsa/src/qa_alsa.py
gr-audio-jack/src/qa_jack.py
gr-audio-oss/src/qa_oss.py
gr-audio-portaudio/src/qa_portaudio.py
gr-cvsd-vocoder/src/python/qa_cvsd_vocoder.py
gr-gsm-fr-vocoder/src/python/qa_gsm_full_rate.py
gr-howto-write-a-block/lib/test_all.cc
gr-pager/python/qa_pager.py
gr-qtgui/src/lib/highResTimeFunctions.h
gr-radio-astronomy/src/python/qa_ra.py
gr-trellis/src/python/qa_trellis.py
gr-usrp/src/qa_usrp.py
gr-usrp2/src/qa_usrp2.py
gr-usrp2/src/usrp2.i
gr-usrp2/src/usrp2_sink_16sc.cc
gr-usrp2/src/usrp2_sink_32fc.cc
gr-usrp2/src/usrp2_sink_base.cc
gr-usrp2/src/usrp2_sink_base.h
gr-video-sdl/src/qa_video_sdl.py
gr-wxgui/src/python/common.py
gr-wxgui/src/python/scope_window.py
gr-wxgui/src/python/scopesink_gl.py
gr-wxgui/src/python/waterfall_window.py
grc/blocks/Makefile.am
grc/blocks/block_tree.xml
grc/blocks/gr_agc2_xx.xml
grc/blocks/gr_and_const_xx.xml [new file with mode: 0644]
grc/blocks/gr_file_sink.xml
grc/blocks/wxgui_scopesink2.xml
grc/freedesktop/Makefile.am
grc/freedesktop/gnuradio-gnuradio-companion.desktop [deleted file]
grc/freedesktop/gnuradio-grc.desktop [new file with mode: 0644]
grc/freedesktop/grc_setup_freedesktop.in
grc/python/Block.py
grc/python/Port.py
gruel/src/include/gruel/pmt.h
gruel/src/lib/pmt/pmt.cc
gruel/src/lib/pmt/pmt_int.h
gruel/src/lib/pmt/pmt_io.cc
gruel/src/lib/pmt/qa_pmt_prims.cc
gruel/src/lib/pmt/qa_pmt_prims.h
gruel/src/lib/test_gruel.cc
usrp/host/apps/burn-db-eeprom
usrp/host/include/usrp/db_flexrf.h
usrp/host/lib/db_flexrf.cc
usrp/host/lib/usrp_dbid.dat
usrp2/firmware/lib/db_rfx.c
version.sh

diff --git a/dtools/bin/fix-copyright-years b/dtools/bin/fix-copyright-years
new file mode 100755 (executable)
index 0000000..bb0f300
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+import re
+import datetime
+import subprocess
+import multiprocessing
+
+def command(*args): return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0]
+
+def is_gnuradio_co_source(lines):
+    for line in lines[:20]:
+        if 'GNU Radio is free software' in line: return True
+    return False
+
+def get_gnuradio_co_line(lines):
+    for i, line in enumerate(lines[:5]):
+        if 'Copyright' in line and 'Free Software Foundation' in line: return line, i
+    return None
+
+def fix_co_years(files):
+    for file in files:
+        print file
+        lines = open(file).readlines()
+        if not is_gnuradio_co_source(lines): continue
+
+        #extract the years from the git history
+        years = set(map(
+            lambda l: int(l.split()[-2]),
+            filter(
+                lambda l: l.startswith('Date'),
+                command('git', 'log', file).splitlines(),
+            ),
+        ))
+
+        #extract line and line number for co line
+        try: line, num = get_gnuradio_co_line(lines)
+        except: continue
+
+        #extract years from co string
+        try:
+            co_years_str = re.match('^.*Copyright (.*) Free Software Foundation.*$', line).groups()[0]
+            co_years = set(map(int, co_years_str.split(',')))
+        except: print '    format error on line %d: "%s"'%(num, line); continue
+
+        #update the years if missing any
+        all_years = co_years.union(years)
+        if all_years != co_years:
+            print '    missing years: %s'%(', '.join(map(str, sorted(all_years - co_years))))
+            all_years.add(datetime.datetime.now().year) #add the current year
+            all_years_str = ', '.join(map(str, sorted(all_years)))
+            new_text = ''.join(lines[:num] + [line.replace(co_years_str, all_years_str)] + lines[num+1:])
+            open(file, 'w').write(new_text)
+
+if __name__ == "__main__":
+    #get recursive list of files in the repo
+    files = command('git', 'ls-tree', '--name-only', 'HEAD', '-r').splitlines()
+
+    #start n+1 processes to handle the files
+    num_procs = multiprocessing.cpu_count()
+    procs = [multiprocessing.Process(
+        target=lambda *files: fix_co_years(files),
+        args=files[num::num_procs],
+    ) for num in range(num_procs)]
+    map(multiprocessing.Process.start, procs)
+    map(multiprocessing.Process.join, procs)
index 9823960c4757a87ae28448d40cc9110d4fb3156f..0b608e13b90ae8e913806588d858d3753af81c1f 100644 (file)
@@ -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
  * 
  */
 
 #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);
 
index e7d6da97f3b96f2b4a42d97bb70fdf4a2a74622c..0f97f1d8e3799f2775932d5898bed9c27a44867d 100644 (file)
@@ -39,4 +39,9 @@ class gri_agc2_cc {
   float reference ();
   float gain ();
   float max_gain ();
+  void set_decay_rate (float rate);
+  void set_attack_rate (float rate);
+  void set_reference (float reference);
+  void set_gain (float gain);
+  void set_max_gain(float max_gain);
   };
index 3825ce225a1b29e756585ca7142cd8aa640443cd..d04b638a6edee55bbe87568108652ef5fce7740f 100644 (file)
@@ -34,4 +34,14 @@ class gri_agc2_ff {
  public:
   gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2,
               float reference = 1.0, float gain = 1.0, float max_gain = 0.0);
+  float attack_rate ();
+  float decay_rate ();
+  float reference ();
+  float gain ();
+  float max_gain ();
+  void set_attack_rate (float rate);
+  void set_decay_rate (float rate);
+  void set_reference (float reference);
+  void set_gain (float gain);
+  void set_max_gain (float max_gain);
   };
index 706837c7a99a66aecac3e2291b7b3293cb88190e..aab0158e7ba8bc7ee1b9eafce6045e88ceb3c3be 100644 (file)
@@ -70,5 +70,8 @@ gr_file_sink::work (int noutput_items,
     nwritten += count;
     inbuf += count * d_itemsize;
   }
+  if (d_unbuffered)
+         fflush (d_fp);
+         
   return nwritten;
 }
index 5ddeeb4d5686fffc8aadfc0ca1e725ce95d03ffb..c43304b0d37f1d07859b53a85a45e54f27b5f263 100644 (file)
@@ -118,3 +118,9 @@ gr_file_sink_base::do_update()
     d_updated = false;
   }
 }  
+
+void
+gr_file_sink_base::set_unbuffered(bool unbuffered)
+{
+       d_unbuffered = unbuffered;
+}
index 0c028d7fd3adcf7413f688d68bf5e8aaca602321..7b96cdb7f3758bbe5ef2d1c578dc0d50d0e8fe10 100644 (file)
@@ -37,6 +37,7 @@ class gr_file_sink_base
   bool         d_updated;      // is there a new FILE pointer?
   bool         d_is_binary;
   boost::mutex d_mutex;
+  bool         d_unbuffered;
 
  protected:
   gr_file_sink_base(const char *filename, bool is_binary);
@@ -61,6 +62,12 @@ class gr_file_sink_base
    * \brief if we've had an update, do it now.
    */
   void do_update();
+  
+  
+  /*!
+   * \brief turn on unbuffered writes for slower outputs
+   */
+  void set_unbuffered(bool unbuffered);
 };
 
 
index 05a3353bb4e6010da558a1c599a062ad81874bc8..ed4342482ddef2c343a56edfec1a7ee58e750070 100644 (file)
@@ -43,4 +43,9 @@ class gr_file_sink_base
    * \brief if we've had an update, do it now.
    */
   void do_update();
+
+  /*!
+   *\brief turn on unbuffered mode for slow outputs
+   */
+  void set_unbuffered(bool unbuffered);
 };
index 80f78240d3a052ec942f80ef4972da8756084f2b..ce7feca13c49178437f99c3fccbe6cb831847ef9 100644 (file)
@@ -104,34 +104,49 @@ gr_oscope_guts::process_sample (const float *channel_data)
 
   d_decimator_count = d_decimator_count_init;
   
-  for (int i = 0; i < d_nchannels; i++)
-    d_buffer[i][d_obi] = channel_data[i];                // copy data into buffer
-
-  switch (d_state){
-  case HOLD_OFF:
-    d_hold_off_count--;
-    if (d_hold_off_count <= 0)
-      enter_look_for_trigger ();
-    break;
-
-  case LOOK_FOR_TRIGGER:
-    if (found_trigger ())
-      enter_post_trigger ();
-    break;
-
-  case POST_TRIGGER:
-    d_post_trigger_count--;
-    if (d_post_trigger_count <= 0){
-      write_output_records ();
-      enter_hold_off ();
-    }
-    break;
-
-  default:
-    assert (0);
+  if (d_trigger_mode != gr_TRIG_MODE_STRIPCHART)
+  {
+         for (int i = 0; i < d_nchannels; i++)
+               d_buffer[i][d_obi] = channel_data[i];                // copy data into buffer
+
+         switch (d_state){
+         case HOLD_OFF:
+               d_hold_off_count--;
+               if (d_hold_off_count <= 0)
+                 enter_look_for_trigger ();
+               break;
+
+         case LOOK_FOR_TRIGGER:
+               if (found_trigger ())
+                 enter_post_trigger ();
+               break;
+
+         case POST_TRIGGER:
+               d_post_trigger_count--;
+               if (d_post_trigger_count <= 0){
+                 write_output_records ();
+                 enter_hold_off ();
+               }
+               break;
+
+         default:
+               assert (0);
+         }
+
+         d_obi = incr_bi (d_obi);
+  }
+  else
+  {
+         for (int i = 0; i < d_nchannels; i++)
+         {
+           for (int j = OUTPUT_RECORD_SIZE-1; j >= 0; j--)
+           {
+                       d_buffer[i][j] = d_buffer[i][j-1];
+               }
+               d_buffer[i][0] = channel_data[i];
+         }
+         write_output_records();
   }
-
-  d_obi = incr_bi (d_obi);
 }
 
 /*
index 63f6b1c987f5fb4b6a9a115c3a6a4de2bd5146ae..8e1222856dd134737c6b4e48e30a99c2eddbea3d 100644 (file)
@@ -27,6 +27,7 @@ enum gr_trigger_mode {
   gr_TRIG_MODE_FREE,
   gr_TRIG_MODE_AUTO,
   gr_TRIG_MODE_NORM,
+  gr_TRIG_MODE_STRIPCHART,
 };
 
 enum gr_trigger_slope {
index b0e80427700c649efbb25bf0e674a96be839e775..abd789a1d07a2d4d1d42b457a3267fe227358bc4 100644 (file)
@@ -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 (file)
index 0000000..680e59c
--- /dev/null
@@ -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);
+}
+
index f0516f2fd9e808387f6b687e50556b7ccca12c0a..a3f3518dee8d2a3d9593648f027de58cc821c439 100644 (file)
@@ -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
index 2fa97fad8d58c4ae118b92716640bee1ff33899e..8fb70fb3fd2fe65d696c3618eccdc806b5d02f94 100755 (executable)
@@ -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")
index 215e0cacedc431406d6e3a4b751281185e391768..90056e09feb11bec20a4263948d6a4bfcd3abd94 100755 (executable)
@@ -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")
index bb3ddb11ec19d8a08ee9a142f843df6f8b1a2fbd..c55d191e07814da46eb81c44ca51d3cb472f3c10 100755 (executable)
@@ -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")
index 2e16d879b04abcffdf2043fbe3008b10cc61b869..a9db3295a8be1b97150e5ce564dc64b3f8e775ad 100644 (file)
@@ -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")
 
index 29b9796cdc96be7883247c6837f8b042f140eb51..b8b718a09d391de0601cd0b13aaae15bdbeff8b6 100755 (executable)
@@ -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")
index ee9bae65bdcfbfafb197a5b20350a3ee5db467a6..8cfb6009988fbf17a4c045a3809c573965ad4180 100755 (executable)
@@ -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")
index ac17aff29c684aca03edf68f65000dfc22022ad4..ac5b53b577d0de042ba54d724a15e063b436c24e 100755 (executable)
@@ -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")
index b1ab8f546a20c4eca925c4cf822efa0b06236ee1..79e9cd092f503f1f559cee0bb0c26b6e7fb35e07 100755 (executable)
@@ -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")
index 10f3668798ea8739f00b59d4e311ce05840bd458..76627247b746b62ae057825cccdfd745d48830fd 100755 (executable)
@@ -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")
 
index 13d2840a06e0bcd179e4de83146bc87ca3e60e1b..27e1802e0834db20e5ba2ed4663c229b424258c8 100755 (executable)
@@ -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")
 
index 7f9f72a7bab330259ad71a1b319647d89238c698..e8ee480cc0adede464c6ce07ed2000eec986b2cb 100755 (executable)
@@ -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")
index a436c6ad6b7ecc25b52a1561a99b8a547b321289..b3575f4e6ba0785f012659c0cf6dec5917bff742 100755 (executable)
@@ -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")
         
index 8835cba5a2b00e0d1d4145d854266fdf8b7b2ba5..7cad0ae721eea11b4071597c9693ea259e5f131a 100755 (executable)
@@ -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")
index 04c0e2a4963fc59e900cdd78a37d4dd4a212f7db..97e9e329a51e513c21fdf6250a9bf392803a2a58 100755 (executable)
@@ -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")
 
index 385ffa519a4ab736abb2ac9327c9e050e754bb44..5ac115e2051f5199e7be4d34ab7b84b21fc1764f 100755 (executable)
@@ -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")
 
index b0dc470617931f1268d22fe55ce45614be2e5fd1..caf3959f496f986619a55a801a5296c65ce8bc0a 100755 (executable)
@@ -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")
index 64bbe45ce7635c928ee1b47b9162243ff1ab5bd9..a91409537620ca30beb06bee005a64b7204a2131 100755 (executable)
@@ -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")
index 412c4c48bda12a700dcf042e75e44e45344a56e9..98d80fbb03f240c77ea565eee9a5da912b5d7564 100755 (executable)
@@ -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")
         
index d4106ee478ee9bf815777457d148509dcfa219f9..b3124ad2951f98f7606198b8141b9774ef41a874 100755 (executable)
@@ -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")
         
index b92f143d59a7168d9f249e83783d79fcdacc2f7c..a25c65e5c176f5a2d2372ea75bc61df4fc30c3d2 100755 (executable)
@@ -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")
index 4466e8aab6b1bb6d71bf424052b076654ee6e4ae..c9ba54164425251fa97050e84a0a24fe63275f17 100755 (executable)
@@ -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")
index 53d1a89ba19b24495af0dfc322cb69de6e5ff0e2..829185c343b1064b5731faa7c785b5fa9be208cc 100755 (executable)
@@ -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")
         
index b506e3ed4127c4cbab0027bf7b4cfa9c331ae7e0..429e57c32d7e691c594947a0c8e9feebf7bfb934 100755 (executable)
@@ -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")
         
index fc211657f683a410de83a1bdae4d8449a6e69607..1665d9dd50869f1aa561dd1d86fa4c667282a0f5 100755 (executable)
@@ -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")
index d5dc595c9f442be05ab0fc633698a38a4accd3f3..dcb3d867e984792dcb52713e56b375bf95acdea3 100755 (executable)
@@ -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")
index b7a60597b218def0e142fbb898800c3c9b1f7916..aae233b56ed6741dec45f9b76712c249fbf99123 100755 (executable)
@@ -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")
index cc336a4d1b495ab271324b3ea2ab35232b48cde7..924a0fb52efb240300828f4c17852bfd0912b48f 100755 (executable)
@@ -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")
index 817ba94081d59674f7423c787f2d20b0098c3fb5..2235f28b1352c692bbced6e1162f545cd5ff3d04 100755 (executable)
@@ -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")
index 833285077aa5eb04757705f1e90f494d54d35ae5..0e522c16b153e8c8b00e25cf520b73bf34e8c59d 100755 (executable)
@@ -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")
         
index fbd601e346636ba7186a87d5f59208933201c67d..501a89f84159234ab3f92619602e10551401dc59 100755 (executable)
@@ -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")
index 3e0b6c5fcb6fa3e14b25de1afdcb48d8ad5550b7..1320d0ec5bf41f7ab0d09ab549d98edaa353ed07 100755 (executable)
@@ -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")
         
index ea326ce4084fd886511e37443c9be3f0559f1356..9901b71b71c4eed1c9178351901246af852427f1 100755 (executable)
@@ -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")
         
index cc25d180e5436d230c85113b48746d714764463b..2f0bbe33d30d366744ac881406df61f38faa586e 100755 (executable)
@@ -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")
     
index 91ddf7cd701d11f99f5ee59aa5df7c8b8db766fa..7d29a950754db575f26ea32b2534eb0e75e8f97b 100755 (executable)
@@ -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")
index 0171c93db490d78b4c9e3a9162e6e26e6d560ad6..5aa231623dd87ee3acafe130a3b69cf3599f8bd4 100755 (executable)
@@ -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")
 
index cb6c4c33c8fc3ac9835bbbbcf74ca8683e8d7364..e7f2778d16002388325f28c75e559cefd168e166 100755 (executable)
@@ -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")
index 646f495c4a46e253e41281d7db6eb6865cd84c68..58c5062a5750fe29dcd91bcbda398e379ebee1cb 100755 (executable)
@@ -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")
index 4dca67b22862be75f500197e930f577ef310d1b1..5a2e6a0d2692bf7a1de38928b5bfe1fdce1aec41 100755 (executable)
@@ -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")
         
index f8ed739a9822ac5d5f6abfcb6642ca2bfac3ae1c..4a575f5d63436e410dd5518a4f34a3d31b5083f6 100755 (executable)
@@ -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")
         
index d45560d3c3c7aaea0dcf4ae5a1b352b7aee42d95..d69f5ca5ba725d8db977f777fd9878dea4501255 100755 (executable)
@@ -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")
index b1b3a971db3f3231217415bc29ef32d71fcf521f..8833f755b9a71193e156fcbeb88c82e54b2cc500 100755 (executable)
@@ -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")
         
index 533f4f05123292f18340aba5497ce829229aad9b..a6683c5c39cfadd494519fb37972a9f2f99a0c04 100755 (executable)
@@ -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")
         
index 4a109663c0b77002161e08b6e94a18ac7205e316..8e4a0eefa0f00df8ce2647a36ea764581355756c 100755 (executable)
@@ -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")
index ac9c1844e8f6625bc47feeb41ee877357779c8d4..5225a9a3b6df2560f760960dc1ffa0041592bbee 100755 (executable)
@@ -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")
index 9cafa61e3288a7f04830e2ea631bc1b3db3c7815..c40a885a8621b1162fc993838a1f4250cebb501d 100755 (executable)
@@ -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")
index 01d01bde02671271ab35a1cb27eb9f4f0bf83d64..fbdabb4cbd7b4ef69875781ced63006f5565b66f 100755 (executable)
@@ -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")
index f8bf4b121ceeab666a622ae6849f4b09725706e2..3bd6160df1e59411a8ba2d9de22c2690db55a570 100755 (executable)
@@ -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")
         
index 64e751189e0e6952376ab100ec665c7d178e6992..32ecc3776e5aef9fbc6a3eeb1a489cf2495ad35e 100755 (executable)
@@ -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")
index 1ecc7ead31d97fe1b81689a32ea853250b4c7c41..2b1429980f0b3cca50e792ba69b6fd092e7bd4e5 100755 (executable)
@@ -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")
index aecf492933993e2836d4f4246f77be83b9d9f8da..241d8ec2a31a06e270fc143a2b68404f1aecb98e 100755 (executable)
@@ -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")
index 058890c4fd022099e2a516bcfa64dd891661abb9..4bb58038f4fa8a19934eb38c31037fca0e43994b 100755 (executable)
@@ -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")
index 8ad0a9bb269522d2ff3e5684d4c1af0c7aed8d84..1d2e6595c40163f0ea7ad779f695b8caa2033abb 100755 (executable)
@@ -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")
         
index 865c7c9064f1e8eafa4153f8c7e27313322c029f..47b4948ba8abec443d7246267fa601bf3922379b 100755 (executable)
@@ -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")
         
index 106e9731463b7ccbfdf3c07efedc6fcbe8c74f62..de2d8fc9532e257d637b72452495c91e46b19e75 100755 (executable)
@@ -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")
index 8a76f8144d78e4945164560bfd9c1cd60459c638..7d6ddf81b9d3858cb113df9ff1fb7bec35c8bdbb 100755 (executable)
@@ -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")
index b00b26bbe7c47bf3fccfeaaeb69b0480e190cfd6..097e394c974980ff761e886ef4f6e4db861acca0 100755 (executable)
@@ -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")
     
index edb263ade6eef7853a326348eb565f65863c8124..d1faf9d9e51ada7f7e2c8a0779877b8c9a17d693 100755 (executable)
@@ -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")
         
index 149c669038a26784f713ce1e6943c95da6149274..5d8d85c7ccc3614e913f42caf52a70e2eca0ed6a 100755 (executable)
@@ -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")
 
index 3ba5dfbce68a28a69902db633207736105746c59..d9f38e3f1e885b019ece52e3d1cd3ee4d2a847d4 100755 (executable)
@@ -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")
index a48343c6bf4970d7814b1277bec62aa7bbd6527f..8ecd83d5477f22c6a33dfa138d48dfb4dd738b22 100755 (executable)
@@ -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 (file)
index 0000000..ded77f5
--- /dev/null
@@ -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()
index 6dc1a26f833c7f579ae877abc1b994e26dcfbccb..17ee32f34dc9d75a3d1b51c02ecad320c351a605 100644 (file)
@@ -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>
 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);
 
index f744d76e69485eb16a8af9e7f64f332b84da4891..51642f81a330e26b34baf88923c9d7d3aa02aca1 100644 (file)
  */
 
 #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;
index 56e94523860df78abcbaf5d6d618729737b7b781..90fe66c2f53a97db974ae415fe1489fd5e4b0f29 100644 (file)
@@ -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
  * 
  */
 
 #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);
 
index 063e2ee45caadb6d70e32566063a3724be2a7097..16ee9c3add1a6b0af88b24de403c0e1c8708fa91 100644 (file)
@@ -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
  * 
  */
 
 #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);
 
index 8549f2a9b8ca4a32b472d6dc9b458b32aa0b3763..c7983a23ef59b0df5632005b6f33237cfbcace28 100644 (file)
@@ -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
  * 
  */
 
 #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);
 
index 5267e0d4fe5cd9e20c5255d39c92bbcf4fcebe45..184895a90d35333f6a29e11283beb64f7709ea54 100644 (file)
@@ -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
  * 
  * 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);
 
index f2a480a50beb8625f9f84c3cb5f9271ff644ec06..52dbfdc7a5f782023dce6942407c820e88ac281f 100755 (executable)
@@ -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")
index d8a3aba88b0f7e18e970620969b3a74749611d74..ad6bee27b36756dac137a0cd04b8dfec025ec686 100755 (executable)
@@ -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")
index 5427b50ec3f9932e33ca572a364f7b73edf2fefa..365dabc25e14f7ec907ceaa50068b6da3c6a9483 100755 (executable)
@@ -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")
index f6a54061ead92be0120444f6ebb1bd0fa8f692c6..20731f38d49ba41c804eb28ee87d89032958c2fb 100755 (executable)
@@ -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")
index 1a39f636e7baae326305aa9b5449aa208d1047e4..99a38d946c1f398dde4e02ee4227f783de3ecbfc 100755 (executable)
@@ -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")
index ac508407288ef2ecfa4db2b81bc5be5685edc064..4164a1965ddea376a435bebd1b566a8b54c7328d 100755 (executable)
@@ -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")
index 192c537bc88b935b6a5df4e30ef836ba2db96967..ac1e83839a0fd3003f2aebddb9748eea85b224dc 100644 (file)
@@ -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
  * 
  */
 
 #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);
 
index 5bf72b5613d625cc3209b6041b03595c99ee41ae..12a45d4c3392db66ab6beefd651c19d830110901 100755 (executable)
@@ -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")
index b85b1acadeefbf218d44f72f9a66464763df0a81..251bbad8b1cb414908e0636e668ed7ea706e54f2 100644 (file)
@@ -8,41 +8,74 @@
 
 static const long NSEC_PER_SEC = 1000000000L;
 
-static inline bool timespec_greater(const struct timespec* t1, const struct timespec* t0){
-  return ((t1->tv_sec > t0->tv_sec) || ((t1->tv_sec == t0->tv_sec) && (t1->tv_nsec > t0->tv_nsec)));
+static inline bool
+timespec_greater(const struct timespec* t1,
+                const struct timespec* t0)
+{
+  return ((t1->tv_sec > t0->tv_sec) ||
+         ((t1->tv_sec == t0->tv_sec) &&
+          (t1->tv_nsec > t0->tv_nsec)));
 }
 
-static inline bool timespec_greater(const struct timespec t1, const struct timespec t0){
-  return ((t1.tv_sec > t0.tv_sec) || ((t1.tv_sec == t0.tv_sec) && (t1.tv_nsec > t0.tv_nsec)));
+static inline bool
+timespec_greater(const struct timespec t1,
+                const struct timespec t0)
+{
+  return ((t1.tv_sec > t0.tv_sec) ||
+         ((t1.tv_sec == t0.tv_sec) &&
+          (t1.tv_nsec > t0.tv_nsec)));
 }
 
-static inline bool timespec_less(const struct timespec* t1, const struct timespec* t0){
-  return ((t1->tv_sec < t0->tv_sec) || ((t1->tv_sec == t0->tv_sec) && (t1->tv_nsec < t0->tv_nsec)));
+static inline bool
+timespec_less(const struct timespec* t1,
+             const struct timespec* t0)
+{
+  return ((t1->tv_sec < t0->tv_sec) ||
+         ((t1->tv_sec == t0->tv_sec) &&
+          (t1->tv_nsec < t0->tv_nsec)));
 }
 
-static inline bool timespec_less(const struct timespec t1, const struct timespec t0){
-  return ((t1.tv_sec < t0.tv_sec) || ((t1.tv_sec == t0.tv_sec) && (t1.tv_nsec < t0.tv_nsec)));
+static inline bool
+timespec_less(const struct timespec t1,
+             const struct timespec t0)
+{
+  return ((t1.tv_sec < t0.tv_sec) ||
+         ((t1.tv_sec == t0.tv_sec) &&
+          (t1.tv_nsec < t0.tv_nsec)));
 }
 
-static inline bool timespec_equal(const struct timespec* t1, const struct timespec* t0){
-  return ((t1->tv_sec == t0->tv_sec) && (t1->tv_nsec == t0->tv_nsec));
+static inline bool
+timespec_equal(const struct timespec* t1,
+              const struct timespec* t0)
+{
+  return ((t1->tv_sec == t0->tv_sec) &&
+         (t1->tv_nsec == t0->tv_nsec));
 }
 
-static inline bool timespec_equal(const struct timespec t1, const struct timespec t0){
-  return ((t1.tv_sec == t0.tv_sec) && (t1.tv_nsec == t0.tv_nsec));
+static inline bool
+timespec_equal(const struct timespec t1,
+              const struct timespec t0)
+{
+  return ((t1.tv_sec == t0.tv_sec) &&
+         (t1.tv_nsec == t0.tv_nsec));
 }
 
-static inline void timespec_reset(struct timespec* ret){
+static inline void
+timespec_reset(struct timespec* ret)
+{
   ret->tv_sec = 0;
   ret->tv_nsec = 0;
 }
 
-static inline void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec){
-  while (nsec > NSEC_PER_SEC){
+static inline void
+set_normalized_timespec(struct timespec *ts,
+                       time_t sec, long nsec)
+{
+  while (nsec > NSEC_PER_SEC) {
     nsec -= NSEC_PER_SEC;
     ++sec;
   }
-  while(nsec < 0){
+  while(nsec < 0) {
     nsec += NSEC_PER_SEC;
     --sec;
   }
@@ -50,10 +83,13 @@ static inline void set_normalized_timespec(struct timespec *ts, time_t sec, long
   ts->tv_nsec = nsec;
 }
 
-static inline struct timespec convert_to_timespec(const double timeValue){
+static inline struct timespec
+convert_to_timespec(const double timeValue)
+{
   struct timespec ret;
   double seconds = 0;
-  long nsec = static_cast<long>(modf(timeValue, &seconds) * static_cast<double>(NSEC_PER_SEC));
+  long nsec = static_cast<long>(modf(timeValue, &seconds) * 
+                               static_cast<double>(NSEC_PER_SEC));
   time_t sec = static_cast<time_t>(seconds);
 
   set_normalized_timespec(&ret, sec, nsec);
@@ -61,28 +97,46 @@ static inline struct timespec convert_to_timespec(const double timeValue){
   return ret;
 }
 
-static inline double convert_from_timespec(const timespec actual){
-  return (static_cast<double>(actual.tv_sec) + (static_cast<double>(actual.tv_nsec) / static_cast<double>(NSEC_PER_SEC)));
+static inline double
+convert_from_timespec(const timespec actual)
+{
+  return (static_cast<double>(actual.tv_sec) +
+         (static_cast<double>(actual.tv_nsec) /
+          static_cast<double>(NSEC_PER_SEC)));
 }
 
-static inline void timespec_add(struct timespec *ret, const struct timespec* t1, const struct timespec* t0){
+static inline void
+timespec_add(struct timespec *ret,
+            const struct timespec* t1,
+            const struct timespec* t0)
+{
   time_t sec = t1->tv_sec + t0->tv_sec;
   long nsec = t1->tv_nsec + t0->tv_nsec;
 
   set_normalized_timespec(ret, sec, nsec);
 }
 
-static inline void timespec_add(struct timespec *ret, const struct timespec t1, const struct timespec t0){
+static inline void
+timespec_add(struct timespec *ret,
+            const struct timespec t1,
+            const struct timespec t0)
+{
   return timespec_add(ret, &t1, &t0);
 }
 
-static inline struct timespec timespec_add(const struct timespec t1, const struct timespec t0){
+static inline struct timespec
+timespec_add(const struct timespec t1,
+            const struct timespec t0)
+{
   struct timespec ret;
   timespec_add(&ret, &t1, &t0);
   return ret;
 }
 
-static inline struct timespec timespec_add(const struct timespec t1, const double time0){
+static inline struct timespec
+timespec_add(const struct timespec t1,
+            const double time0)
+{
   struct timespec ret;
   struct timespec t0;
   t0 = convert_to_timespec(time0);
@@ -92,24 +146,38 @@ static inline struct timespec timespec_add(const struct timespec t1, const doubl
   return ret;
 }
 
-static inline void timespec_subtract(struct timespec *ret, const struct timespec* t1, const struct timespec* t0){
+static inline void
+timespec_subtract(struct timespec *ret,
+                 const struct timespec* t1,
+                 const struct timespec* t0)
+{
   time_t sec = t1->tv_sec - t0->tv_sec;
   long nsec = t1->tv_nsec - t0->tv_nsec;
 
   set_normalized_timespec(ret, sec, nsec);
 }
 
-static inline void timespec_subtract(struct timespec *ret, const struct timespec t1, const struct timespec t0){
+static inline void
+timespec_subtract(struct timespec *ret,
+                 const struct timespec t1,
+                 const struct timespec t0)
+{
   return timespec_subtract(ret, &t1, &t0);
 }
 
-static inline struct timespec timespec_subtract(const struct timespec t1, const struct timespec t0){
+static inline struct timespec
+timespec_subtract(const struct timespec t1,
+                 const struct timespec t0)
+{
   struct timespec ret;
   timespec_subtract(&ret, &t1, &t0);
   return ret;
 }
 
-static inline struct timespec timespec_subtract(const struct timespec t1, const double time0){
+static inline struct timespec
+timespec_subtract(const struct timespec t1,
+                 const double time0)
+{
   struct timespec ret;
   struct timespec t0;
   t0 = convert_to_timespec(time0);
@@ -119,7 +187,11 @@ static inline struct timespec timespec_subtract(const struct timespec t1, const
   return ret;
 }
 
-static inline double diff_timespec(struct timespec* ret, const struct timespec *t1, const struct timespec* t0){
+static inline double
+diff_timespec(struct timespec* ret,
+             const struct timespec *t1,
+             const struct timespec* t0)
+{
   struct timespec actual;
   time_t sec = 0;
   long nsec = 0;
@@ -141,7 +213,8 @@ static inline double diff_timespec(struct timespec* ret, const struct timespec *
     sec = t0->tv_sec - t1->tv_sec;
     nsec = t0->tv_nsec - t1->tv_nsec;
 
-    // Do nothing with the ret value as the ret value would have to store a negative, which it can't.
+    // Do nothing with the ret value as the ret value
+    // would have to store a negative, which it can't.
 
     set_normalized_timespec(&actual, sec, nsec);
     
@@ -149,23 +222,39 @@ static inline double diff_timespec(struct timespec* ret, const struct timespec *
   }
 }
 
-static inline double diff_timespec(struct timespec* ret, const struct timespec t1, const struct timespec t0){
+static inline double
+diff_timespec(struct timespec* ret,
+             const struct timespec t1,
+             const struct timespec t0)
+{
   return diff_timespec(ret, &t1, &t0);
 }
 
-static inline double diff_timespec(const struct timespec t1, const struct timespec t0){
+static inline double
+diff_timespec(const struct timespec t1,
+             const struct timespec t0)
+{
   return diff_timespec(NULL, &t1, &t0);
 }
 
 
-static inline double diff_timespec(const struct timespec* t1, const struct timespec* t0){
+static inline double
+diff_timespec(const struct timespec* t1,
+             const struct timespec* t0)
+{
   return diff_timespec(NULL, t1, t0);
 }
 
 
-static inline void get_highres_clock(struct timespec* ret){
+#ifdef CLOCK_REALTIME
+// If we can use clock_gettime, use it;
+// otherwise, use gettimeofday
+static inline void
+get_highres_clock(struct timespec* ret)
+{
   if(clock_gettime(CLOCK_REALTIME, ret) != 0){
-    // Unable to get high resolution time - fail over to low resolution time
+    // Unable to get high resolution time - 
+    // fail over to low resolution time
     timeval lowResTime;
     gettimeofday(&lowResTime, NULL);
     ret->tv_sec = lowResTime.tv_sec;
@@ -173,17 +262,37 @@ static inline void get_highres_clock(struct timespec* ret){
   }
 }
 
-static inline struct timespec get_highres_clock(){
+#else
+
+// Trick timer functions into thinking it has an nsec timer
+// but only use the low resolution (usec) timer.
+static inline void
+get_highres_clock(struct timespec* ret)
+{
+  timeval lowResTime;
+  gettimeofday(&lowResTime, NULL);
+  ret->tv_sec = lowResTime.tv_sec;
+  ret->tv_nsec = lowResTime.tv_usec*1000;
+}
+#endif
+
+static inline struct timespec
+get_highres_clock()
+{
   struct timespec ret;
   get_highres_clock(&ret);
   return ret;
 }
 
-static inline bool timespec_empty(const struct timespec* ret){
+static inline bool
+timespec_empty(const struct timespec* ret)
+{
   return ( (ret->tv_sec == 0 ) &&  (ret->tv_nsec == 0) );
 }
 
-static inline bool timespec_empty(const struct timespec ret){
+static inline bool
+timespec_empty(const struct timespec ret)
+{
   return timespec_empty(&ret);
 }
 
index 1c44e23adaeb8445091c5dfedfcabeb0a92099c1..2cb0f42beae5c4a1dbed947b24ffe7eccf455fba 100755 (executable)
@@ -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")
index 306bf994df2259fa87811f4f87d1f2245e9a4c5f..cfeefea061371700dd587d50d703dd20273bbef2 100755 (executable)
@@ -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")
index db2d32624ab0dcef8878438641aa246dcdf98b1e..06e630330aaf4feeeae139d54288620e69289d33 100755 (executable)
@@ -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")
index bc6664a1ba42f72746c035e76e943812ca6625de..cc994b1e9dbcefe2aa3f92930891e0a38ebc4d43 100755 (executable)
@@ -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")
index d1fa091f73f6d8c69e5409dfe688899be207683e..2a79fad44b8f5831a4dee3e96b97b2740254000b 100644 (file)
@@ -32,6 +32,7 @@
 
 %include <usrp2/tune_result.h>
 %include <usrp2/mimo_config.h>
+%include <usrp2/metadata.h>
 
 %template(uint32_t_vector) std::vector<uint32_t>;
 
@@ -163,6 +164,7 @@ public:
   bool write_gpio(uint16_t value, uint16_t mask);
   %rename(_real_read_gpio) read_gpio;
   bool read_gpio(uint16_t *value);
+  bool start_streaming_at(usrp2::fpga_timestamp time);
 };
 
 // ----------------------------------------------------------------
index 1e7c54dcdb16d8c0cb62f0281c39af9303b0c3bf..75cc1f4a6bebb5857ce4fe1ee9df03f2f8680c5c 100644 (file)
@@ -67,12 +67,20 @@ usrp2_sink_16sc::work(int noutput_items,
     return 0;
 
   usrp2::tx_metadata metadata;
-  metadata.timestamp = -1;
-  metadata.send_now = 1;
+
+  // Set TX metadata to either start time or now
+  if (d_should_wait == true) {
+    metadata.timestamp = d_tx_time;
+    metadata.send_now = 0;
+    d_should_wait = false;
+  }
+  else {
+    metadata.timestamp = -1;
+    metadata.send_now = 1;
+  }
   metadata.start_of_burst = 1;
 
-  bool ok = d_u2->tx_16sc(0,  // FIXME: someday, streams will have channel numbers
-                         in, noutput_items, &metadata);
+  bool ok = d_u2->tx_16sc(0, in, noutput_items, &metadata);
   if (!ok){
     std::cerr << "usrp2_sink_16sc: tx_16sc failed" << std::endl;
     return -1; // say we're done
index b1e28a8297ee83468801a8ebd57a43e916d86938..fa75b380571dc960fe4ea56449917f2d5c295362 100644 (file)
@@ -67,12 +67,20 @@ usrp2_sink_32fc::work(int noutput_items,
     return 0;
 
   usrp2::tx_metadata metadata;
-  metadata.timestamp = -1;
-  metadata.send_now = 1;
+
+  // Set TX metadata to either start time or now
+  if (d_should_wait == true) {
+    metadata.timestamp = d_tx_time;
+    metadata.send_now = 0;
+    d_should_wait = false;
+  }
+  else {
+    metadata.timestamp = -1;
+    metadata.send_now = 1;
+  }
   metadata.start_of_burst = 1;
 
-  bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel numbers
-                         in, noutput_items, &metadata);
+  bool ok = d_u2->tx_32fc(0, in, noutput_items, &metadata);
   if (!ok){
     std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl;
     return -1; // say we're done
index ce473f2365e08b132237f219921d6d4b52c6d142..c9b34a54a93669974226ec79abba05bc87f7a132 100644 (file)
@@ -36,7 +36,9 @@ usrp2_sink_base::usrp2_sink_base(const char *name,
   : usrp2_base(name,
                input_signature,
               gr_make_io_signature(0, 0, 0),
-              ifc, mac)
+              ifc, mac),
+    d_should_wait(false),
+    d_tx_time(0)
 {
   // NOP
 }
@@ -155,3 +157,10 @@ bool usrp2_sink_base::read_gpio(uint16_t *value)
 {
   return d_u2->read_gpio(usrp2::GPIO_TX_BANK, value);
 }
+
+bool usrp2_sink_base::start_streaming_at(usrp2::fpga_timestamp time)
+{
+  d_should_wait = true;
+  d_tx_time = time;
+  return true;
+}
index 38dc4f2364a60fef6cbadc39c8394afcca9ed06a..d831d4df6951d4ee2e250e2f1059c610f820262b 100644 (file)
@@ -37,6 +37,9 @@ protected:
                  const std::string &mac)
     throw (std::runtime_error);
 
+  bool d_should_wait;
+  usrp2::fpga_timestamp d_tx_time;
+
 public:
   ~usrp2_sink_base();
 
@@ -139,6 +142,11 @@ public:
    * \brief Read daughterboard GPIO pin values
    */
   bool read_gpio(uint16_t *value);
+
+  /*!
+   * \brief First samples begin streaming to USRP2 at given time
+   */
+  bool start_streaming_at(usrp2::fpga_timestamp time);
 };
 
 #endif /* INCLUDED_USRP2_SINK_BASE_H */
index 98da85f6b32d552be2dc2cf93d422a71e39bef0a..8f82a60b1955f8f2b86d45fffa136acb17a599e8 100755 (executable)
@@ -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")
index 17a7dc0de550fa8ae5fa32da1f938d3f5fd7edd8..3641ae6448f7ff4f4203c82e2210ea135d8d4579 100644 (file)
@@ -25,6 +25,8 @@
 import wx
 from gnuradio import gr
 
+RUN_ALWAYS = gr.prefs().get_bool ('wxgui', 'run_always', False)
+
 class wxgui_hb(object):
        """
        The wxgui hier block helper/wrapper class:
@@ -47,7 +49,10 @@ class wxgui_hb(object):
                        assert points[0] == self or points[0][0] == self
                        copy = gr.copy(self._hb.input_signature().sizeof_stream_item(0))
                        handler = self._handler_factory(copy.set_enabled)
-                       handler(False) #initially disable the copy block
+                       if RUN_ALWAYS == False:
+                               handler(False) #initially disable the copy block
+                       else:
+                               handler(True) #initially enable the copy block
                        self._bind_to_visible_event(win=self.win, handler=handler)
                        points = list(points)
                        points.insert(1, copy) #insert the copy block into the chain
@@ -67,7 +72,10 @@ class wxgui_hb(object):
                        if cache[0] == visible: return
                        cache[0] = visible
                        #print visible, handler
-                       handler(visible)
+                       if RUN_ALWAYS == False:
+                               handler(visible)
+                       else:
+                               handler(True)
                return callback
 
        @staticmethod
index c03b71f1e0c84494791265be416f9eef29ea2d55..a9917782f4f736b86f7cea5eaaa8cd327b638338 100644 (file)
@@ -38,6 +38,7 @@ import forms
 DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'scope_rate', 30)
 PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
 SLIDER_STEPS = 100
+DEFAULT_TRIG_MODE = gr.prefs().get_long('wxgui', 'trig_mode', gr.gr_TRIG_MODE_AUTO)
 DEFAULT_WIN_SIZE = (600, 300)
 COUPLING_MODES = (
        ('DC', False),
@@ -47,6 +48,7 @@ TRIGGER_MODES = (
        ('Freerun', gr.gr_TRIG_MODE_FREE),
        ('Auto', gr.gr_TRIG_MODE_AUTO),
        ('Normal', gr.gr_TRIG_MODE_NORM),
+       ('Stripchart', gr.gr_TRIG_MODE_STRIPCHART),
 )
 TRIGGER_SLOPES = (
        ('Pos +', gr.gr_TRIG_SLOPE_POS),
@@ -432,6 +434,7 @@ class scope_window(wx.Panel, pubsub.pubsub):
                msg_key,
                 use_persistence,
                 persist_alpha,
+               trig_mode,
        ):
                pubsub.pubsub.__init__(self)
                #check num inputs
@@ -471,11 +474,16 @@ class scope_window(wx.Panel, pubsub.pubsub):
                self[FRAME_RATE_KEY] = frame_rate
                self[TRIGGER_LEVEL_KEY] = 0
                self[TRIGGER_CHANNEL_KEY] = 0
-               self[TRIGGER_MODE_KEY] = gr.gr_TRIG_MODE_AUTO
+               self[TRIGGER_MODE_KEY] = trig_mode
+               
                self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
                self[T_FRAC_OFF_KEY] = 0.5
                self[USE_PERSISTENCE_KEY] = use_persistence
                self[PERSIST_ALPHA_KEY] = persist_alpha
+               
+               if self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_STRIPCHART:
+                       self[T_FRAC_OFF_KEY] = 0.0
+
                for i in range(num_inputs):
                        self.proxy(common.index_key(AC_COUPLE_KEY, i), controller, common.index_key(ac_couple_key, i))
                #init panel and plot
index ebf9b29398479ff260b7f72b089f77571f1ca37e..15be23d5aee8c0f865a7ebb3115fce8857ff7acb 100644 (file)
@@ -76,6 +76,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
                xy_mode=False,
                ac_couple=False,
                num_inputs=1,
+               trig_mode=scope_window.DEFAULT_TRIG_MODE,
                frame_rate=scope_window.DEFAULT_FRAME_RATE,
                 use_persistence=False,
                 persist_alpha=None,
@@ -132,6 +133,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
                        v_scale=v_scale,
                        v_offset=v_offset,
                        xy_mode=xy_mode,
+                       trig_mode=trig_mode,
                        ac_couple_key=AC_COUPLE_KEY,
                        trigger_level_key=TRIGGER_LEVEL_KEY,
                        trigger_mode_key=TRIGGER_MODE_KEY,
index b7904e4d9742412269345dd870c8bb6657c9f89f..6536ada10100287b3348c8e8b6bea7e0227a9c14 100644 (file)
@@ -38,6 +38,7 @@ import forms
 SLIDER_STEPS = 100
 AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
 DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'waterfall_rate', 30)
+DEFAULT_COLOR_MODE = gr.prefs().get_string('wxgui', 'waterfall_color', 'rgb1')
 DEFAULT_WIN_SIZE = (600, 300)
 DIV_LEVELS = (1, 2, 5, 10, 20)
 MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200
@@ -156,6 +157,9 @@ class control_panel(wx.Panel):
        def _on_incr_time_scale(self, event):
                old_rate = self.parent[FRAME_RATE_KEY]
                self.parent[FRAME_RATE_KEY] *= 0.75
+               if self.parent[FRAME_RATE_KEY] < 1.0:
+                       self.parent[FRAME_RATE_KEY] = 1.0
+               
                if self.parent[FRAME_RATE_KEY] == old_rate:
                        self.parent[DECIMATION_KEY] += 1
        def _on_decr_time_scale(self, event):
@@ -217,6 +221,7 @@ class waterfall_window(wx.Panel, pubsub.pubsub):
                self[REF_LEVEL_KEY] = ref_level
                self[BASEBAND_FREQ_KEY] = baseband_freq
                self[COLOR_MODE_KEY] = COLOR_MODES[0][1]
+               self[COLOR_MODE_KEY] = DEFAULT_COLOR_MODE
                self[RUNNING_KEY] = True
                #setup the box with plot and controls
                self.control_panel = control_panel(self)
@@ -280,6 +285,8 @@ class waterfall_window(wx.Panel, pubsub.pubsub):
                #grid parameters
                sample_rate = self[SAMPLE_RATE_KEY]
                frame_rate = self[FRAME_RATE_KEY]
+               if frame_rate < 1.0 :
+                       frame_rate = 1.0
                baseband_freq = self[BASEBAND_FREQ_KEY]
                num_lines = self[NUM_LINES_KEY]
                y_divs = self[Y_DIVS_KEY]
index 2596eae45600c74013af035c18b07594c1368f67..18420a013320aa60aabe2adf9b87c72207486539 100644 (file)
@@ -71,6 +71,7 @@ dist_ourdata_DATA = \
        gr_agc2_xx.xml \
        gr_agc_xx.xml \
        gr_and_xx.xml \
+       gr_and_const_xx.xml \
        gr_argmax_xx.xml \
        gr_binary_slicer_fb.xml \
        gr_channel_model.xml \
index 8d91258e516f08417a64f361c0ff2007b57da3db..610a881026c12075b7c6ddfbb67bc42281cb990e 100644 (file)
@@ -58,6 +58,7 @@
 
                <block>gr_add_const_vxx</block>
                <block>gr_multiply_const_vxx</block>
+               <block>gr_and_const_xx</block>
 
                <block>gr_not_xx</block>
                <block>gr_and_xx</block>
index fb3ae57042dbe939ac4718eb74619218eae79552..55b20d4e82db2b051c5c673ba03731ad47c58ebb 100644 (file)
@@ -9,6 +9,11 @@
        <key>gr_agc2_xx</key>
        <import>from gnuradio import gr</import>
        <make>gr.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make>
+    <callback>set_attack_rate($attack_rate)</callback>
+    <callback>set_decay_rate($decay_rate)</callback>
+    <callback>set_reference($reference)</callback>
+    <callback>set_gain($gain)</callback>
+    <callback>set_max_gain($max_gain)</callback>
        <param>
                <name>Type</name>
                <key>type</key>
diff --git a/grc/blocks/gr_and_const_xx.xml b/grc/blocks/gr_and_const_xx.xml
new file mode 100644 (file)
index 0000000..dc96493
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## And Const Block:
+##     all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+       <name>And Const</name>
+       <key>gr_and_const_xx</key>
+       <import>from gnuradio import gr</import>
+       <make>gr.and_const_$(type.fcn)($const)</make>
+       <callback>set_k($const)</callback>
+       <param>
+               <name>IO Type</name>
+               <key>type</key>
+               <type>enum</type>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>fcn:ii</opt>
+               </option>
+               <option>
+                       <name>Short</name>
+                       <key>short</key>
+                       <opt>fcn:ss</opt>
+               </option>
+               <option>
+                       <name>Byte</name>
+                       <key>byte</key>
+                       <opt>fcn:bb</opt>
+               </option>
+       </param>
+       <param>
+               <name>Constant</name>
+               <key>const</key>
+               <value>0</value>
+               <type>int</type>
+       </param>
+       <sink>
+               <name>in</name>
+               <type>$type</type>
+       </sink>
+       <source>
+               <name>out</name>
+               <type>$type</type>
+       </source>
+</block>
index 880dc27590c013447038f718849701c334505ca6..0081c93f8f5a25c15582c0f2acc73acfe36415e7 100644 (file)
@@ -8,7 +8,9 @@
        <name>File Sink</name>
        <key>gr_file_sink</key>
        <import>from gnuradio import gr</import>
-       <make>gr.file_sink($type.size*$vlen, $file)</make>
+       <make>gr.file_sink($type.size*$vlen, $file)
+self.$(id).set_unbuffered($unbuffered)</make>
+       <callback>set_unbuffered($unbuffered)</callback>
        <param>
                <name>File</name>
                <key>file</key>
                <value>1</value>
                <type>int</type>
        </param>
+       <param>
+               <name>Unbuffered</name>
+               <key>unbuffered</key>
+               <value>False</value>
+               <type>bool</type>
+               <option>
+                               <name>Off</name>
+                               <key>False</key>
+               </option>
+               <option>
+                               <name>On</name>
+                               <key>True</key>
+               </option>
+       </param>
+
        <check>$vlen &gt; 0</check>
        <sink>
                <name>in</name>
index eba45f48981af825c5ec658017b3e221b2e00f43..50cd977be21c8ee3c0ef031e03fded2ad515609d 100644 (file)
@@ -20,6 +20,7 @@ scopesink2.$(type.fcn)(
        ac_couple=$ac_couple,
        xy_mode=$xy_mode,
        num_inputs=$num_inputs,
+       trig_mode=$trig_mode,
 #if $win_size()
        size=$win_size,
 #end if
@@ -134,6 +135,27 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
                <value></value>
                <type>notebook</type>
        </param>
+       <param>
+               <name>Trigger Mode</name>
+               <key>trig_mode</key>
+               <type>enum</type>
+               <option>
+                       <name>Auto</name>
+                       <key>gr.gr_TRIG_MODE_AUTO</key>
+               </option>
+               <option>
+                       <name>Normal</name>
+                       <key>gr.gr_TRIG_MODE_NORM</key>
+               </option>
+               <option>
+                       <name>Freerun</name>
+                       <key>gr.gr_TRIG_MODE_FREE</key>
+               </option>
+               <option>
+                       <name>Stripchart</name>
+                       <key>gr.gr_TRIG_MODE_STRIPCHART</key>
+               </option>
+       </param>
        <check>not $win_size or len($win_size) == 2</check>
        <check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
        <sink>
index 23bb70bf54db8ef94a816e1b41e78cfdec70c40a..f6aa97a93ad63f94a37dd965a5beb3f3964451b1 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008,2009 Free Software Foundation, Inc.
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -22,7 +22,6 @@
 include $(top_srcdir)/Makefile.common
 
 ourdatadir = $(pkgdatadir)/grc/freedesktop
-
 dist_ourdata_DATA = \
        grc-icon-256.png \
        grc-icon-128.png \
@@ -30,11 +29,12 @@ dist_ourdata_DATA = \
        grc-icon-48.png \
        grc-icon-32.png \
        gnuradio-grc.xml \
-       gnuradio-gnuradio-companion.desktop \
+       gnuradio-grc.desktop \
        gnuradio-usrp2_probe.desktop \
        gnuradio-usrp_probe.desktop
 
-dist_bin_SCRIPTS = grc_setup_freedesktop
+pkglibexecdir = $(libexecdir)/$(PACKAGE)
+dist_pkglibexec_SCRIPTS = grc_setup_freedesktop
 
 grc_setup_freedesktop: $(srcdir)/grc_setup_freedesktop.in Makefile
        sed -e 's|@SRCDIR[@]|$(ourdatadir)|g' $< > $@
@@ -46,10 +46,10 @@ install-data-hook:
        @printf "\n*** GRC Post-Install Message ***\
        \nTo install icons, mime type, and menu items\
        \nfor a freedesktop.org system (Gnome/KDE/Xfce):\
-       \n  >>> sudo grc_setup_freedesktop install\n\n"
+       \n  >>> sudo $(pkglibexecdir)/grc_setup_freedesktop install\n\n"
 
 uninstall-hook:
        @printf "\n*** GRC Post-Uninstall Message ***\
        \nTo uninstall icons, mime type, and menu items\
        \nfor a freedesktop.org system (Gnome/KDE/Xfce):\
-       \n  >>> sudo grc_setup_freedesktop uninstall\n\n"
+       \n  >>> sudo $(pkglibexecdir)/grc_setup_freedesktop uninstall\n\n"
diff --git a/grc/freedesktop/gnuradio-gnuradio-companion.desktop b/grc/freedesktop/gnuradio-gnuradio-companion.desktop
deleted file mode 100644 (file)
index 5fd0497..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Type=Application
-Name=GRC
-Exec=gnuradio-companion %F
-Categories=Development;
-MimeType=application/gnuradio-grc;
-Icon=gnuradio-grc
diff --git a/grc/freedesktop/gnuradio-grc.desktop b/grc/freedesktop/gnuradio-grc.desktop
new file mode 100644 (file)
index 0000000..5fd0497
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=GRC
+Exec=gnuradio-companion %F
+Categories=Development;
+MimeType=application/gnuradio-grc;
+Icon=gnuradio-grc
index a0c5ac193bde67f06bf58ae60d6ea4564202d86f..ab4ce82ef883c20ee5238a3acca407b5a793b59c 100644 (file)
@@ -1,4 +1,24 @@
 #!/bin/bash
+#
+# Copyright 2008, 2009, 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.
+#
 ##################################################
 # setup grc on a freedesktop platform
 # $1 should be install or uninstall
@@ -8,7 +28,7 @@
 ##################################################
 
 ICON_SIZES="32 48 64 128 256"
-MENU_ITEMS="gnuradio-companion usrp2_probe usrp_probe"
+MENU_ITEMS="grc usrp2_probe usrp_probe"
 if [ -n "$2" ]; then
        SRCDIR="$2"
 else
@@ -39,11 +59,12 @@ case "$1" in
        echo "Begin freedesktop uninstall..."
        for size in ${ICON_SIZES}; do \
                echo "Uninstall icon: ${size}x${size}"
-               xdg-icon-resource uninstall --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
-               xdg-icon-resource uninstall --context mimetypes --size ${size} application-gnuradio-grc; \
-               xdg-icon-resource uninstall --context apps --theme gnome --size ${size} gnuradio-grc; \
-               xdg-icon-resource uninstall --context apps --size ${size} gnuradio-grc; \
+               xdg-icon-resource uninstall --noupdate --context mimetypes --theme gnome --size ${size} application-gnuradio-grc; \
+               xdg-icon-resource uninstall --noupdate --context mimetypes --size ${size} application-gnuradio-grc; \
+               xdg-icon-resource uninstall --noupdate --context apps --theme gnome --size ${size} gnuradio-grc; \
+               xdg-icon-resource uninstall --noupdate --context apps --size ${size} gnuradio-grc; \
        done
+       xdg-icon-resource forceupdate
        echo "Uninstall mime type"
        xdg-mime uninstall ${SRCDIR}/gnuradio-grc.xml
        echo "Uninstall menu items"
index dd39b095de5a0c14920ee1db2bed655c43e5ae1a..bd03eb5cdbfc7d078578a59fd8690be23e0fd4b4 100644 (file)
@@ -75,42 +75,48 @@ class Block(_Block, _GUIBlock):
                Add and remove ports to adjust for the nports.
                """
                _Block.rewrite(self)
+
+               def insert_port(get_ports, get_port, key):
+                       prev_port = get_port(str(int(key)-1))
+                       get_ports().insert(
+                               get_ports().index(prev_port)+1,
+                               prev_port.copy(new_key=key),
+                       )
+                       #restore integer contiguity after insertion
+                       for i, port in enumerate(get_ports()): port._key = str(i)
+
+               def remove_port(get_ports, get_port, key):
+                       port = get_port(key)
+                       for connection in port.get_connections():
+                               self.get_parent().remove_element(connection)
+                       get_ports().remove(port)
+                       #restore integer contiguity after insertion
+                       for i, port in enumerate(get_ports()): port._key = str(i)
+
                #adjust nports
                for get_ports, get_port in (
                        (self.get_sources, self.get_source),
                        (self.get_sinks, self.get_sink),
                ):
-                       #how many streaming (non-message) ports?
-                       num_ports = len(filter(lambda p: p.get_type() != 'msg', get_ports()))
-                       #do nothing for 0 ports
-                       if not num_ports: continue
-                       #get the nports setting
-                       port0 = get_port(str(0))
-                       nports = port0.get_nports()
-                       #do nothing for no nports
-                       if not nports: continue
-                       #do nothing if nports is already num ports
-                       if nports == num_ports: continue
-                       #remove excess ports and connections
-                       if nports < num_ports:
-                               #remove the connections
-                               for key in map(str, range(nports, num_ports)):
-                                       port = get_port(key)
-                                       for connection in port.get_connections():
-                                               self.get_parent().remove_element(connection)
-                               #remove the ports
-                               for key in map(str, range(nports, num_ports)):
-                                       get_ports().remove(get_port(key))
-                               continue
-                       #add more ports
-                       if nports > num_ports:
-                               for key in map(str, range(num_ports, nports)):
-                                       prev_port = get_port(str(int(key)-1))
-                                       get_ports().insert(
-                                               get_ports().index(prev_port)+1,
-                                               prev_port.copy(new_key=key),
-                                       )
-                               continue
+                       master_ports = filter(lambda p: p.get_nports(), get_ports())
+                       for i, master_port in enumerate(master_ports):
+                               nports = master_port.get_nports()
+                               index_first = get_ports().index(master_port)
+                               try: index_last = get_ports().index(master_ports[i+1])
+                               except IndexError: index_last = len(get_ports())
+                               num_ports = index_last - index_first
+                               #do nothing if nports is already num ports
+                               if nports == num_ports: continue
+                               #remove excess ports and connections
+                               if nports < num_ports:
+                                       for key in map(str, range(index_first+nports, index_first+num_ports)):
+                                               remove_port(get_ports, get_port, key)
+                                       continue
+                               #add more ports
+                               if nports > num_ports:
+                                       for key in map(str, range(index_first+num_ports, index_first+nports)):
+                                               insert_port(get_ports, get_port, key)
+                                       continue
 
        def port_controller_modify(self, direction):
                """
@@ -119,10 +125,8 @@ class Block(_Block, _GUIBlock):
                @return true for change
                """
                changed = False
-               #concat the nports string from the private nports settings of both port0
-               nports_str = \
-                       (self.get_sinks() and self.get_sinks()[0]._nports or '') + \
-                       (self.get_sources() and self.get_sources()[0]._nports or '')
+               #concat the nports string from the private nports settings of all ports
+               nports_str = ' '.join([port._nports for port in self.get_ports()])
                #modify all params whose keys appear in the nports string
                for param in self.get_params():
                        if param.is_enum() or param.get_key() not in nports_str: continue
index 6965371df8a9e922dbeb808d78da53bf93c81a59..6e5a5c59f2a24045750caa8598e120291dcecaa0 100644 (file)
@@ -167,5 +167,7 @@ class Port(_Port, _GUIPort):
 
        def copy(self, new_key=None):
                n = self._n.copy()
+               #remove nports from the key so the copy cannot be a duplicator
+               if n.has_key('nports'): n.pop('nports')
                if new_key: n['key'] = new_key
                return self.__class__(self.get_parent(), n, self._dir)
index c371b023b539b79ec257133efe28bb36b6e837c5..514b24d8b0f26b6a44aa2f24f6b3b7267f1af557 100644 (file)
@@ -163,6 +163,27 @@ pmt_t pmt_from_long(long x);
  */
 long pmt_to_long(pmt_t x);
 
+/*
+ * ------------------------------------------------------------------------
+ *                            uint64_t
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is an uint64 number, else false
+bool pmt_is_uint64(pmt_t x);
+
+//! Return the pmt value that represents the uint64 \p x.
+pmt_t pmt_from_uint64(uint64_t x);
+
+/*!
+ * \brief Convert pmt to uint64 if possible.
+ *
+ * When \p x represents an exact integer that fits in a uint64,
+ * return that uint64.  Else raise an exception, either wrong_type
+ * when x is not an exact uint64, or out_of_range when it doesn't fit.
+ */
+uint64_t pmt_to_uint64(pmt_t x);
+
 /*
  * ------------------------------------------------------------------------
  *                             Reals
index aa1688d24a8b69f18fda47fb9393e3cb5b43f8a8..f9cf6b4bf681b3172786e6d4df0304d312f95023 100644 (file)
@@ -105,6 +105,12 @@ _integer(pmt_t x)
   return dynamic_cast<pmt_integer*>(x.get());
 }
 
+static pmt_uint64 *
+_uint64(pmt_t x)
+{
+  return dynamic_cast<pmt_uint64*>(x.get());
+}
+
 static pmt_real *
 _real(pmt_t x)
 {
@@ -304,6 +310,40 @@ pmt_to_long(pmt_t x)
   throw pmt_wrong_type("pmt_to_long", x);
 }
 
+////////////////////////////////////////////////////////////////////////////
+//                             Uint64
+////////////////////////////////////////////////////////////////////////////
+
+pmt_uint64::pmt_uint64(uint64_t value) : d_value(value) {}
+
+bool
+pmt_is_uint64(pmt_t x)
+{
+  return x->is_uint64();
+}
+
+
+pmt_t
+pmt_from_uint64(uint64_t x)
+{
+  return pmt_t(new pmt_uint64(x));
+}
+
+uint64_t
+pmt_to_uint64(pmt_t x)
+{
+  if(x->is_uint64())
+    return _uint64(x)->value();
+  if(x->is_integer())
+    {
+    long tmp = _integer(x)->value();
+    if(tmp >= 0)
+        return (uint64_t) tmp;
+    }
+
+  throw pmt_wrong_type("pmt_to_uint64", x);
+}
+
 ////////////////////////////////////////////////////////////////////////////
 //                              Real
 ////////////////////////////////////////////////////////////////////////////
@@ -929,6 +969,9 @@ pmt_eqv(const pmt_t& x, const pmt_t& y)
   if (x->is_integer() && y->is_integer())
     return _integer(x)->value() == _integer(y)->value();
 
+  if (x->is_uint64() && y->is_uint64())
+    return _uint64(x)->value() == _uint64(y)->value();
+
   if (x->is_real() && y->is_real())
     return _real(x)->value() == _real(y)->value();
 
@@ -947,6 +990,9 @@ pmt_eqv_raw(pmt_base *x, pmt_base *y)
   if (x->is_integer() && y->is_integer())
     return _integer(x)->value() == _integer(y)->value();
 
+  if (x->is_uint64() && y->is_uint64())
+    return _uint64(x)->value() == _uint64(y)->value();
+
   if (x->is_real() && y->is_real())
     return _real(x)->value() == _real(y)->value();
 
@@ -1328,6 +1374,7 @@ pmt_dump_sizeof()
   printf("sizeof(pmt_bool)           = %3zd\n", sizeof(pmt_bool));
   printf("sizeof(pmt_symbol)         = %3zd\n", sizeof(pmt_symbol));
   printf("sizeof(pmt_integer)        = %3zd\n", sizeof(pmt_integer));
+  printf("sizeof(pmt_uint64)         = %3zd\n", sizeof(pmt_uint64));
   printf("sizeof(pmt_real)           = %3zd\n", sizeof(pmt_real));
   printf("sizeof(pmt_complex)        = %3zd\n", sizeof(pmt_complex));
   printf("sizeof(pmt_null)           = %3zd\n", sizeof(pmt_null));
index 50683ffb525365ec10d6d39debe350be27d4c59b..ea28e37b41cc9630084947c1dd6c039ab8809216 100644 (file)
@@ -47,6 +47,7 @@ public:
   virtual bool is_symbol()  const { return false; }
   virtual bool is_number()  const { return false; }
   virtual bool is_integer() const { return false; }
+  virtual bool is_uint64()  const { return false; }
   virtual bool is_real()    const { return false; }
   virtual bool is_complex() const { return false; }
   virtual bool is_null()    const { return false; }
@@ -118,6 +119,19 @@ public:
   long value() const { return d_value; }
 };
 
+class pmt_uint64 : public pmt_base
+{
+public:
+  uint64_t             d_value;
+
+  pmt_uint64(uint64_t value);
+  //~pmt_uint64(){}
+
+  bool is_number()  const { return true; }
+  bool is_uint64() const { return true; }
+  uint64_t value() const { return d_value; }
+};
+
 class pmt_real : public pmt_base
 {
 public:
index 179e6b72cb4f0450bfde2ced2e9711e38d717b79..b909c1b64b8210f5f182ebd73baef4c7050d4fc3 100644 (file)
@@ -64,6 +64,8 @@ pmt_write(pmt_t obj, std::ostream &port)
   else if (pmt_is_number(obj)){
     if (pmt_is_integer(obj))
       port << pmt_to_long(obj);
+    else if (pmt_is_uint64(obj))
+      port << pmt_to_uint64(obj);
     else if (pmt_is_real(obj))
       port << pmt_to_double(obj);
     else if (pmt_is_complex(obj)){
index f2414c72cdc18528b9c3aebcf63298822473c573..985361f13f36e5fa7e0286703757b5b18eb07fe1 100644 (file)
@@ -103,6 +103,19 @@ qa_pmt_prims::test_integers()
   CPPUNIT_ASSERT_EQUAL(1L, pmt_to_long(p1));
 }
 
+void
+qa_pmt_prims::test_uint64s()
+{
+  pmt_t p1 = pmt_from_uint64((uint64_t)1);
+  pmt_t m1 = pmt_from_uint64((uint64_t)8589934592ULL);
+  CPPUNIT_ASSERT(!pmt_is_uint64(PMT_T));
+  CPPUNIT_ASSERT(pmt_is_uint64(p1));
+  CPPUNIT_ASSERT(pmt_is_uint64(m1));
+  CPPUNIT_ASSERT_THROW(pmt_to_uint64(PMT_T), pmt_wrong_type);
+  CPPUNIT_ASSERT_EQUAL((uint64_t)8589934592ULL, (uint64_t)pmt_to_uint64(m1));
+  CPPUNIT_ASSERT_EQUAL((uint64_t)1ULL, (uint64_t)pmt_to_uint64(p1));
+}
+
 void
 qa_pmt_prims::test_reals()
 {
index 29ba02f11cb28bcf50d0e547a4d46c593be9047d..efc5c6050650ecc04eba810570f135013872ec8e 100644 (file)
@@ -31,6 +31,7 @@ class qa_pmt_prims : public CppUnit::TestCase {
   CPPUNIT_TEST(test_symbols);
   CPPUNIT_TEST(test_booleans);
   CPPUNIT_TEST(test_integers);
+  CPPUNIT_TEST(test_uint64s);
   CPPUNIT_TEST(test_reals);
   CPPUNIT_TEST(test_complexes);
   CPPUNIT_TEST(test_pairs);
@@ -52,6 +53,7 @@ class qa_pmt_prims : public CppUnit::TestCase {
   void test_symbols();
   void test_booleans();
   void test_integers();
+  void test_uint64s();
   void test_reals();
   void test_complexes();
   void test_pairs();
index 669303447c6d5dad78831d363a495f5f33b40710..f4b9fc4e2d7d03ebb23a53c3285d6a1cc6a85ade 100644 (file)
@@ -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
  * 
  */
 
 #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);
+}
+
index 8fb9143eb7a25fcfbea75cbd3c5f4a03d2d9cf88..0c908e3d55b05ba688e8952da054d960b0d7ceab 100755 (executable)
@@ -65,6 +65,7 @@ daughterboards = {
     'rfx900_mimo_b'   : ((FLEX_900_TX_MIMO_B, 0x0000),     (FLEX_900_RX_MIMO_B, 0x0000)),
     'rfx1200_mimo_b'  : ((FLEX_1200_TX_MIMO_B, 0x0000),    (FLEX_1200_RX_MIMO_B, 0x0000)),
     'rfx1800_mimo_b'  : ((FLEX_1800_TX_MIMO_B, 0x0000),    (FLEX_1800_RX_MIMO_B, 0x0000)),
+    'rfx2200_mimo_b'  : ((FLEX_2200_TX_MIMO_B, 0x0000),    (FLEX_2200_RX_MIMO_B, 0x0000)),
     'rfx2400_mimo_b'  : ((FLEX_2400_TX_MIMO_B, 0x0000),    (FLEX_2400_RX_MIMO_B, 0x0000)),
     'lftx'            : ((LF_TX, 0x0000),           None),
     'lfrx'            : (None,                      (LF_RX, 0x0000)),
index 0c834402d0e44f8fa4f70bec409bc85672fef007..70a55514ee5188fa4c0938567577cb229b796805 100644 (file)
@@ -138,6 +138,18 @@ protected:
 
 //----------------------------------------------------------------------
 
+class _2200_common : public _AD4360_common
+{
+ public:
+  _2200_common();
+  ~_2200_common() {}
+  double freq_min();
+  double freq_max();
+};
+
+//----------------------------------------------------------------------
+
 class _2400_common : public _AD4360_common
 {
  public:
@@ -212,6 +224,34 @@ public:
 
 //------------------------------------------------------------    
 
+class db_flexrf_2200_tx : public flexrf_base_tx
+{
+ public:
+  db_flexrf_2200_tx(usrp_basic_sptr usrp, int which);
+  ~db_flexrf_2200_tx();
+
+  // Wrapper calls to d_common functions
+  bool _compute_regs(double freq, int &retR, int &retcontrol,
+                    int &retN, double &retfreq);
+};
+
+class db_flexrf_2200_rx : public flexrf_base_rx
+{
+public:
+  db_flexrf_2200_rx(usrp_basic_sptr usrp, int which);
+  ~db_flexrf_2200_rx();
+  
+  float gain_min();
+  float gain_max();
+  float gain_db_per_step();
+  bool i_and_q_swapped();
+
+  bool _compute_regs(double freq, int &retR, int &retcontrol,
+                    int &retN, double &retfreq);
+};
+
+//------------------------------------------------------------    
+
 class db_flexrf_2400_tx : public flexrf_base_tx
 {
  public:
index 07ac2be3bc22e1cafc1479e5dee61e2d31b9c245..2819c19bd79f73c443a3c0c13fd690e3b76f5947 100644 (file)
@@ -639,6 +639,38 @@ _AD4360_common::_prescaler()
 
 //----------------------------------------------------------------------
 
+_2200_common::_2200_common()
+  : _AD4360_common()
+{
+  // Band-specific R-Register Values
+  d_R_DIV = 16;  // bits 15:2
+   
+  // Band-specific C-Register values
+  d_P = 1;        // bits 23,22   Div by 16/17
+  d_CP2 = 7;      // bits 19:17
+  d_CP1 = 7;      // bits 16:14
+
+  // Band specifc N-Register Values
+  d_DIVSEL = 0;   // bit 23
+  d_DIV2 = 0;     // bit 22
+  d_CPGAIN = 0;   // bit 21
+  d_freq_mult = 1;
+}
+
+double
+_2200_common::freq_min()
+{
+  return 2000e6;
+}
+
+double
+_2200_common::freq_max()
+{
+  return 2400e6;
+}
+
+//----------------------------------------------------------------------
+
 _2400_common::_2400_common()
   : _AD4360_common()
 {
@@ -811,6 +843,72 @@ _400_rx::_400_rx()
 
 //------------------------------------------------------------    
 
+db_flexrf_2200_tx::db_flexrf_2200_tx(usrp_basic_sptr usrp, int which)
+  : flexrf_base_tx(usrp, which)
+{
+  d_common = new _2200_common();
+}
+
+db_flexrf_2200_tx::~db_flexrf_2200_tx()
+{
+}
+
+bool
+db_flexrf_2200_tx::_compute_regs(double freq, int &retR, int &retcontrol,
+                                int &retN, double &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(), freq, retR,
+                                retcontrol, retN, retfreq);
+}
+
+
+
+db_flexrf_2200_rx::db_flexrf_2200_rx(usrp_basic_sptr usrp, int which)
+  : flexrf_base_rx(usrp, which)
+{
+  d_common = new _2200_common();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
+}
+
+db_flexrf_2200_rx::~db_flexrf_2200_rx()
+{
+}
+
+float
+db_flexrf_2200_rx::gain_min()
+{
+  return usrp()->pga_min();
+}
+
+float
+db_flexrf_2200_rx::gain_max()
+{
+  return usrp()->pga_max()+70;
+}
+
+float
+db_flexrf_2200_rx::gain_db_per_step()
+{
+  return 0.05;
+}
+
+
+bool
+db_flexrf_2200_rx::i_and_q_swapped()
+{
+  return true;
+}
+
+bool
+db_flexrf_2200_rx::_compute_regs(double freq, int &retR, int &retcontrol,
+                                int &retN, double &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(), freq, retR,
+                                retcontrol, retN, retfreq);
+}
+
+//------------------------------------------------------------    
+
 db_flexrf_2400_tx::db_flexrf_2400_tx(usrp_basic_sptr usrp, int which)
   : flexrf_base_tx(usrp, which)
 {
index 5193a5fa0ef18b66f13985864d229205471c3681..2548d737e5cf0d6c1485d362c62bedac3b9ba421 100644 (file)
@@ -61,6 +61,9 @@
 "Flex 1200 Tx MIMO B"  0x002a
 "Flex 2400 Tx MIMO B"  0x002b
 
+"Flex 2200 Rx MIMO B"  0x002c
+"Flex 2200 Tx MIMO B"  0x002d
+
 "Flex 1800 Rx"         0x0030
 "Flex 1800 Tx"         0x0031
 "Flex 1800 Rx MIMO A"  0x0032
index 546559010de4bc42a2b6236a77f9d3ebf8197b39..d07d3c1fb4c0a3cf7f9e3146c478cb83f23877ec 100644 (file)
@@ -120,6 +120,16 @@ struct db_rfx_1800_tx {
   struct db_rfx_common common;
 };
 
+struct db_rfx_2200_rx {
+  struct db_base       base;
+  struct db_rfx_common common;
+};
+
+struct db_rfx_2200_tx {
+  struct db_base       base;
+  struct db_rfx_common common;
+};
+
 struct db_rfx_2400_rx {
   struct db_base       base;
   struct db_rfx_common common;
@@ -387,6 +397,70 @@ struct db_rfx_1800_tx db_rfx_1800_tx = {
 };
 
 
+struct db_rfx_2200_rx db_rfx_2200_rx = {
+  .base.dbid = 0x002c,
+  .base.is_tx = false,
+  .base.output_enables = 0x00E0,
+  .base.used_pins = 0x00FF,
+  .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2000e6),
+  .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2400e6),
+  .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
+  .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70),
+  .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034),
+  .base.is_quadrature = true,
+  .base.i_and_q_swapped = true,
+  .base.spectrum_inverted = false,
+  .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+  .base.init = rfx_init_rx,
+  .base.set_freq = rfx_set_freq,
+  .base.set_gain = rfx_set_gain_rx,
+  .base.set_tx_enable = 0,
+  .base.atr_mask = 0x00E0,
+  .base.atr_txval = 0,
+  .base.atr_rxval = MIX_EN,
+  // .base.atr_tx_delay =
+  // .base.atr_rx_delay =
+  .base.set_antenna = 0,
+  .common.DIV2 = 0,
+  .common.CP1 = 7,
+  .common.CP2 = 7,
+  .common.spi_mask = SPI_SS_RX_DB,
+  .common.freq_mult = 1
+};
+
+
+struct db_rfx_2200_tx db_rfx_2200_tx = {
+  .base.dbid = 0x002d,
+  .base.is_tx = true,
+  .base.output_enables = 0x00E0,
+  .base.used_pins = 0x00FF,
+  .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2000e6),
+  .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2400e6),
+  //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+  //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+  //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+  .base.is_quadrature = true,
+  .base.i_and_q_swapped = false,
+  .base.spectrum_inverted = false,
+  .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
+  .base.init = rfx_init_tx,
+  .base.set_freq = rfx_set_freq,
+  .base.set_gain = rfx_set_gain_tx,
+  .base.set_tx_enable = rfx_set_tx_enable,
+  .base.atr_mask = 0x00E0,
+  .base.atr_txval = MIX_EN, 
+  .base.atr_rxval = ANT_SW,
+  // .base.atr_tx_delay =
+  // .base.atr_rx_delay =
+  .base.set_antenna = 0,
+  .common.DIV2 = 0,
+  .common.CP1 = 7,
+  .common.CP2 = 7,
+  .common.spi_mask = SPI_SS_TX_DB,
+  .common.freq_mult = 1
+};
+
+
 struct db_rfx_2400_rx db_rfx_2400_rx = {
   .base.dbid = 0x0027,
   .base.is_tx = false,
index 01a47b5d9233cedff83f6428b8f8d7130b2d4db2..70d6d74f92cd15540af6b4d810aef1f125b95e74 100644 (file)
@@ -1,4 +1,4 @@
 MAJOR_VERSION=3
 API_COMPAT=3
-MINOR_VERSION=0
-MAINT_VERSION=0
+MINOR_VERSION=1
+MAINT_VERSION=git