summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/filter/.gitignore12
-rw-r--r--gnuradio-core/src/lib/filter/Makefile.am27
-rw-r--r--gnuradio-core/src/lib/filter/Makefile.gen17
-rw-r--r--gnuradio-core/src/lib/filter/filter.i2
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_all.py2
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py64
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc15
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc3
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc2
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.cc169
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h98
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.i38
-rw-r--r--gnuradio-core/src/lib/filter/gr_sincos.c4
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir.h6
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t121
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t131
-rw-r--r--gnuradio-core/src/lib/filter/qa_filter.cc12
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc160
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc167
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc168
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc156
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc147
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h46
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc167
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h46
-rw-r--r--gnuradio-core/src/lib/general/gr_circular_file.cc7
-rw-r--r--gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.cc4
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.cc8
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.i8
-rw-r--r--gnuradio-core/src/lib/general/gri_agc2_cc.i5
-rw-r--r--gnuradio-core/src/lib/general/gri_agc2_ff.i10
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_XX.cc.t2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t4
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t4
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink.cc3
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.cc6
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.h7
-rw-r--r--gnuradio-core/src/lib/io/gr_file_sink_base.i5
-rw-r--r--gnuradio-core/src/lib/io/gr_oscope_guts.cc69
-rw-r--r--gnuradio-core/src/lib/io/gr_trigger_mode.h1
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am5
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.cc24
-rw-r--r--gnuradio-core/src/lib/runtime/gr_unittests.h67
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.am4
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio.i2
-rw-r--r--gnuradio-core/src/python/gnuradio/Makefile.am3
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py27
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py26
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py26
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py25
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_agc.py6
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_argmax.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_classify.py7
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_copy.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_delay.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_feval.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fft.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py5
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_goertzel.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_head.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py2
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_hilbert.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_iir.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_integrate.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_interleave.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_max.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_message.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_mute.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_nlog10.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_noise.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_regenerate.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_repeat.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_scrambler.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_sig_source.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_skiphead.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py4
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_wavefile.py6
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr_unittest.py59
-rw-r--r--gnuradio-core/src/python/gnuradio/gr_xmlrunner.py385
-rw-r--r--gnuradio-core/src/tests/test_all.cc13
-rw-r--r--gnuradio-core/src/tests/test_atsc.cc12
-rw-r--r--gnuradio-core/src/tests/test_filter.cc12
-rw-r--r--gnuradio-core/src/tests/test_general.cc14
-rw-r--r--gnuradio-core/src/tests/test_runtime.cc12
123 files changed, 2874 insertions, 248 deletions
diff --git a/gnuradio-core/src/lib/filter/.gitignore b/gnuradio-core/src/lib/filter/.gitignore
index 2d009f154..faaf02cb8 100644
--- a/gnuradio-core/src/lib/filter/.gitignore
+++ b/gnuradio-core/src/lib/filter/.gitignore
@@ -211,4 +211,16 @@
/gr_rational_resampler_base_scc.cc
/gr_rational_resampler_base_scc.h
/gr_rational_resampler_base_scc.i
+/gri_fir_filter_with_buffer_ccc.cc
+/gri_fir_filter_with_buffer_ccc.h
+/gri_fir_filter_with_buffer_ccf.cc
+/gri_fir_filter_with_buffer_ccf.h
+/gri_fir_filter_with_buffer_fcc.cc
+/gri_fir_filter_with_buffer_fcc.h
+/gri_fir_filter_with_buffer_fff.cc
+/gri_fir_filter_with_buffer_fff.h
+/gri_fir_filter_with_buffer_fsf.cc
+/gri_fir_filter_with_buffer_fsf.h
+/gri_fir_filter_with_buffer_scc.cc
+/gri_fir_filter_with_buffer_scc.h
/stamp-*
diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am
index 23c1dadc3..6d2ec1c7e 100644
--- a/gnuradio-core/src/lib/filter/Makefile.am
+++ b/gnuradio-core/src/lib/filter/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001,2002,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -44,6 +44,7 @@ code_generator = \
generate_gr_fir_sysconfig_generic.py \
generate_gr_fir_util.py \
generate_gr_freq_xlating_fir_filter_XXX.py \
+ generate_gri_fir_filter_with_buffer_XXX.py \
generate_utils.py \
gr_fir_XXX.cc.t \
gr_fir_XXX.h.t \
@@ -60,7 +61,10 @@ code_generator = \
gr_rational_resampler_base_XXX.i.t \
gr_freq_xlating_fir_filter_XXX.cc.t \
gr_freq_xlating_fir_filter_XXX.h.t \
- gr_freq_xlating_fir_filter_XXX.i.t
+ gr_freq_xlating_fir_filter_XXX.i.t \
+ gri_fir_filter_with_buffer_XXX.cc.t \
+ gri_fir_filter_with_buffer_XXX.h.t
+
# Source built by Python into $(builddir)
BUILT_SOURCES = \
@@ -205,6 +209,7 @@ libfilter_la_common_SOURCES = \
float_dotprod_generic.c \
short_dotprod_generic.c \
gr_pfb_channelizer_ccf.cc \
+ gr_pfb_synthesis_filterbank_ccf.cc\
gr_pfb_decimator_ccf.cc \
gr_pfb_interpolator_ccf.cc \
gr_pfb_arb_resampler_ccf.cc \
@@ -220,7 +225,13 @@ libfilter_qa_la_common_SOURCES = \
qa_gr_fir_scc.cc \
qa_gr_rotator.cc \
qa_gri_mmse_fir_interpolator.cc \
- qa_gri_mmse_fir_interpolator_cc.cc
+ qa_gri_mmse_fir_interpolator_cc.cc \
+ qa_gri_fir_filter_with_buffer_ccf.cc \
+ qa_gri_fir_filter_with_buffer_ccc.cc \
+ qa_gri_fir_filter_with_buffer_fcc.cc \
+ qa_gri_fir_filter_with_buffer_fff.cc \
+ qa_gri_fir_filter_with_buffer_fsf.cc \
+ qa_gri_fir_filter_with_buffer_scc.cc
if MD_CPU_generic
libfilter_la_SOURCES = $(libfilter_la_common_SOURCES) $(generic_CODE)
@@ -288,6 +299,7 @@ grinclude_HEADERS = \
short_dotprod_x86.h \
sse_debug.h \
gr_pfb_channelizer_ccf.h \
+ gr_pfb_synthesis_filterbank_ccf.h\
gr_pfb_decimator_ccf.h \
gr_pfb_interpolator_ccf.h \
gr_pfb_arb_resampler_ccf.h \
@@ -324,7 +336,13 @@ noinst_HEADERS = \
qa_gr_fir_scc.h \
qa_gr_rotator.h \
qa_gri_mmse_fir_interpolator.h \
- qa_gri_mmse_fir_interpolator_cc.h
+ qa_gri_mmse_fir_interpolator_cc.h \
+ qa_gri_fir_filter_with_buffer_ccf.h \
+ qa_gri_fir_filter_with_buffer_ccc.h \
+ qa_gri_fir_filter_with_buffer_fcc.h \
+ qa_gri_fir_filter_with_buffer_fff.h \
+ qa_gri_fir_filter_with_buffer_fsf.h \
+ qa_gri_fir_filter_with_buffer_scc.h
if PYTHON
@@ -344,6 +362,7 @@ swiginclude_HEADERS = \
gr_single_pole_iir_filter_ff.i \
gr_single_pole_iir_filter_cc.i \
gr_pfb_channelizer_ccf.i \
+ gr_pfb_synthesis_filterbank_ccf.i\
gr_pfb_decimator_ccf.i \
gr_pfb_interpolator_ccf.i \
gr_pfb_arb_resampler_ccf.i \
diff --git a/gnuradio-core/src/lib/filter/Makefile.gen b/gnuradio-core/src/lib/filter/Makefile.gen
index 6809274fa..909899c05 100644
--- a/gnuradio-core/src/lib/filter/Makefile.gen
+++ b/gnuradio-core/src/lib/filter/Makefile.gen
@@ -40,7 +40,14 @@ GENERATED_H = \
gr_rational_resampler_base_fcc.h \
gr_rational_resampler_base_fff.h \
gr_rational_resampler_base_fsf.h \
- gr_rational_resampler_base_scc.h
+ gr_rational_resampler_base_scc.h \
+ gri_fir_filter_with_buffer_ccc.h \
+ gri_fir_filter_with_buffer_ccf.h \
+ gri_fir_filter_with_buffer_fcc.h \
+ gri_fir_filter_with_buffer_fff.h \
+ gri_fir_filter_with_buffer_fsf.h \
+ gri_fir_filter_with_buffer_scc.h
+
GENERATED_I = \
gr_fir_filter_ccc.i \
@@ -107,5 +114,11 @@ GENERATED_CC = \
gr_rational_resampler_base_fcc.cc \
gr_rational_resampler_base_fff.cc \
gr_rational_resampler_base_fsf.cc \
- gr_rational_resampler_base_scc.cc
+ gr_rational_resampler_base_scc.cc \
+ gri_fir_filter_with_buffer_ccc.cc \
+ gri_fir_filter_with_buffer_ccf.cc \
+ gri_fir_filter_with_buffer_fcc.cc \
+ gri_fir_filter_with_buffer_fff.cc \
+ gri_fir_filter_with_buffer_fsf.cc \
+ gri_fir_filter_with_buffer_scc.cc
diff --git a/gnuradio-core/src/lib/filter/filter.i b/gnuradio-core/src/lib/filter/filter.i
index bdfb8fa8d..645607cba 100644
--- a/gnuradio-core/src/lib/filter/filter.i
+++ b/gnuradio-core/src/lib/filter/filter.i
@@ -33,6 +33,7 @@
#include <gr_goertzel_fc.h>
#include <gr_cma_equalizer_cc.h>
#include <gr_pfb_channelizer_ccf.h>
+#include <gr_pfb_synthesis_filterbank_ccf.h>
#include <gr_pfb_decimator_ccf.h>
#include <gr_pfb_interpolator_ccf.h>
#include <gr_pfb_arb_resampler_ccf.h>
@@ -52,6 +53,7 @@
%include "gr_goertzel_fc.i"
%include "gr_cma_equalizer_cc.i"
%include "gr_pfb_channelizer_ccf.i"
+%include "gr_pfb_synthesis_filterbank_ccf.i"
%include "gr_pfb_decimator_ccf.i"
%include "gr_pfb_interpolator_ccf.i"
%include "gr_pfb_arb_resampler_ccf.i"
diff --git a/gnuradio-core/src/lib/filter/generate_all.py b/gnuradio-core/src/lib/filter/generate_all.py
index b34e13c73..ceed2b851 100755
--- a/gnuradio-core/src/lib/filter/generate_all.py
+++ b/gnuradio-core/src/lib/filter/generate_all.py
@@ -30,6 +30,7 @@ import generate_gr_fir_sysconfig_generic
import generate_gr_fir_sysconfig
import generate_gr_fir_util
import generate_gr_fir_XXX
+import generate_gri_fir_filter_with_buffer_XXX
def generate_all():
generate_gr_fir_XXX.generate()
@@ -40,6 +41,7 @@ def generate_all():
generate_gr_fir_sysconfig_generic.generate()
generate_gr_fir_sysconfig.generate()
generate_gr_fir_util.generate()
+ generate_gri_fir_filter_with_buffer_XXX.generate()
output_glue('filter')
if __name__ == '__main__':
diff --git a/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py b/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py
new file mode 100755
index 000000000..f586b0c27
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/generate_gri_fir_filter_with_buffer_XXX.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# -*- python -*-
+#
+# 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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gri_fir_filter_with_buffer_XXX',]
+
+def code3_to_acc_code (code3):
+ if i_code (code3) == 'c' or o_code (code3) == 'c' or tap_code (code3) == 'c':
+ return 'c'
+ if i_code (code3) == 'f' or o_code (code3) == 'f' or tap_code (code3) == 'f':
+ return 'f'
+ if i_code (code3) == 'i' or o_code (code3) == 'i' or tap_code (code3) == 'i':
+ return 'i'
+ return 'i' # even short short short needs int accumulator
+
+def code3_to_input_cast (code3):
+ if i_code (code3) == 's' and o_code (code3) == 'c':
+ return '(float)'
+ return ''
+
+def expand_h_cc (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['INPUT_CAST'] = code3_to_input_cast (code3)
+ acc_code = code3_to_acc_code (code3)
+ d['ACC_TYPE'] = char_to_type[acc_code]
+ return d
+
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc (r, s)
+
+
+if __name__ == '__main__':
+ generate ()
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
index add106b69..84b0c578f 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
@@ -35,7 +35,7 @@ gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
unsigned int filter_size)
{
return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_ccf (rate, taps,
- filter_size));
+ filter_size));
}
@@ -71,7 +71,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
// Create an FIR filter for each channel and zero out the taps
std::vector<float> vtaps(0, d_int_rate);
- for(int i = 0; i < d_int_rate; i++) {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
}
@@ -81,6 +81,8 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
create_diff_taps(taps, dtaps);
create_taps(taps, d_taps, d_filters);
create_taps(dtaps, d_dtaps, d_diff_filters);
+
+ set_relative_rate(rate);
}
gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
@@ -95,8 +97,6 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
std::vector< std::vector<float> > &ourtaps,
std::vector<gr_fir_ccf*> &ourfilter)
{
- int i,j;
-
unsigned int ntaps = newtaps.size();
d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
@@ -112,10 +112,10 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
}
// Partition the filter
- for(i = 0; i < d_int_rate; i++) {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
// Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
- for(j = 0; j < d_taps_per_filter; j++) {
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
}
@@ -171,7 +171,8 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
return 0; // history requirements may have changed.
}
- int i = 0, j, count = d_start_index;
+ int i = 0, count = d_start_index;
+ unsigned int j;
gr_complex o0, o1;
// Restore the last filter position
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
index f86782dad..db16a634b 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
@@ -55,11 +55,12 @@ gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans,
// This tests the specified input sample rate to see if it conforms to this
// requirement within a few significant figures.
double intp = 0;
- double x = (10000.0*rint(numchans / oversample_rate)) / 10000.0;
double fltp = modf(numchans / oversample_rate, &intp);
if(fltp != 0.0)
throw std::invalid_argument("gr_pfb_channelizer: oversample rate must be N/i for i in [1, N]");
+ set_relative_rate(1.0/intp);
+
d_filters = std::vector<gr_fir_ccf*>(d_numchans);
// Create an FIR filter for each channel and zero out the taps
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
index 8a0ad1c4c..e20bc38bb 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
@@ -132,7 +132,7 @@ gr_pfb_interpolator_ccf::work (int noutput_items,
int i = 0, count = 0;
while(i < noutput_items) {
- for(int j = 0; j < d_rate; j++) {
+ for(unsigned int j = 0; j < d_rate; j++) {
out[i] = d_filters[j]->filter(&in[count]);
i++;
}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.cc
new file mode 100644
index 000000000..9fad1bd0d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.cc
@@ -0,0 +1,169 @@
+/* -*- 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 <gr_pfb_synthesis_filterbank_ccf.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <cstring>
+
+gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf
+ (unsigned int numchans, const std::vector<float> &taps)
+{
+ return gr_pfb_synthesis_filterbank_ccf_sptr
+ (new gr_pfb_synthesis_filterbank_ccf (numchans, taps));
+}
+
+
+gr_pfb_synthesis_filterbank_ccf::gr_pfb_synthesis_filterbank_ccf
+ (unsigned int numchans, const std::vector<float> &taps)
+ : gr_sync_interpolator ("pfb_synthesis_filterbank_ccf",
+ gr_make_io_signature (1, numchans, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ numchans),
+ d_updated (false), d_numchans(numchans)
+{
+ d_filters = std::vector<gri_fir_filter_with_buffer_ccf*>(d_numchans);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_numchans);
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ d_filters[i] = new gri_fir_filter_with_buffer_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the IFFT to handle the input channel rotations
+ d_fft = new gri_fft_complex (d_numchans, true);
+}
+
+gr_pfb_synthesis_filterbank_ccf::~gr_pfb_synthesis_filterbank_ccf ()
+{
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_synthesis_filterbank_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_numchans);
+
+ // Make a vector of the taps plus fill it out with 0's to fill
+ // each polyphase filter with exactly d_taps_per_filter
+ std::vector<float> tmp_taps;
+ tmp_taps = taps;
+ while((float)(tmp_taps.size()) < d_numchans*d_taps_per_filter) {
+ tmp_taps.push_back(0.0);
+ }
+
+ // Partition the filter
+ for(i = 0; i < d_numchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = tmp_taps[i + j*d_numchans]; // add taps to channels in reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter+1);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_synthesis_filterbank_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_numchans; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n\n");
+ }
+}
+
+
+int
+gr_pfb_synthesis_filterbank_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex*) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+ int numsigs = input_items.size();
+ int ndiff = d_numchans - numsigs;
+ unsigned int nhalf = (unsigned int)ceil((float)numsigs/2.0f);
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ unsigned int n, i;
+ for(n = 0; n < noutput_items/d_numchans; n++) {
+ // fill up the populated channels based on the
+ // number of real input streams
+ for(i = 0; i < nhalf; i++) {
+ in = (gr_complex*)input_items[i];
+ d_fft->get_inbuf()[i] = (in+i)[n];
+ }
+
+ // Make the ndiff channels around N/2 0
+ for(; i < nhalf+ndiff; i++) {
+ d_fft->get_inbuf()[i] = gr_complex(0,0);
+ }
+
+ // Finish off channels with data
+ for(; i < d_numchans; i++) {
+ in = (gr_complex*)input_items[i-ndiff];
+ d_fft->get_inbuf()[i] = (in+i)[n];
+ }
+
+ // spin through IFFT
+ d_fft->execute();
+
+ for(i = 0; i < d_numchans; i++) {
+ out[d_numchans-i-1] = d_filters[d_numchans-i-1]->filter(d_fft->get_outbuf()[i]);
+ }
+
+ out += d_numchans;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h
new file mode 100644
index 000000000..f5b1cbb94
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.h
@@ -0,0 +1,98 @@
+/* -*- 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.
+ */
+
+
+#ifndef INCLUDED_GR_PFB_SYNTHESIS_FILTERBANK_CCF_H
+#define INCLUDED_GR_PFB_SYNTHESIS_FILTERBANK_CCF_H
+
+#include <gr_sync_interpolator.h>
+#include <gri_fir_filter_with_buffer_ccf.h>
+
+class gr_pfb_synthesis_filterbank_ccf;
+typedef boost::shared_ptr<gr_pfb_synthesis_filterbank_ccf> gr_pfb_synthesis_filterbank_ccf_sptr;
+gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf
+ (unsigned int numchans, const std::vector<float> &taps);
+
+class gri_fft_complex;
+
+
+/*!
+ * \class gr_pfb_synthesis_filterbank_ccf
+ *
+ * \brief Polyphase synthesis filterbank with
+ * gr_complex input, gr_complex output and float taps
+ *
+ * \ingroup filter_blk
+ */
+
+class gr_pfb_synthesis_filterbank_ccf : public gr_sync_interpolator
+{
+ private:
+ /*!
+ * Build the polyphase synthesis filterbank.
+ * \param numchans (unsigned integer) Specifies the number of
+ channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter to
+ populate the filterbank.
+ */
+ friend gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf
+ (unsigned int numchans, const std::vector<float> &taps);
+
+ bool d_updated;
+ unsigned int d_numchans;
+ unsigned int d_taps_per_filter;
+ gri_fft_complex *d_fft;
+ std::vector< gri_fir_filter_with_buffer_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+
+
+ /*!
+ * Build the polyphase synthesis filterbank.
+ * \param numchans (unsigned integer) Specifies the number of
+ channels <EM>M</EM>
+ * \param taps (vector/list of floats) The prototype filter
+ to populate the filterbank.
+ */
+ gr_pfb_synthesis_filterbank_ccf (unsigned int numchans,
+ const std::vector<float> &taps);
+
+public:
+ ~gr_pfb_synthesis_filterbank_ccf ();
+
+ /*!
+ * Resets the filterbank's filter taps with the new prototype filter
+ * \param taps (vector/list of floats) The prototype filter to
+ populate the filterbank.
+ */
+ void set_taps (const std::vector<float> &taps);
+
+ /*!
+ * Print all of the filterbank taps to screen.
+ */
+ void print_taps();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.i
new file mode 100644
index 000000000..02a9f0255
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gr_pfb_synthesis_filterbank_ccf.i
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,pfb_synthesis_filterbank_ccf);
+
+gr_pfb_synthesis_filterbank_ccf_sptr gr_make_pfb_synthesis_filterbank_ccf
+ (unsigned int numchans, const std::vector<float> &taps);
+
+class gr_pfb_synthesis_filterbank_ccf : public gr_sync_interpolator
+{
+ private:
+ gr_pfb_synthesis_filterbank_ccf (unsigned int numchans,
+ const std::vector<float> &taps);
+
+ public:
+ ~gr_pfb_synthesis_filterbank_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+};
diff --git a/gnuradio-core/src/lib/filter/gr_sincos.c b/gnuradio-core/src/lib/filter/gr_sincos.c
index 240a84852..57b26b22f 100644
--- a/gnuradio-core/src/lib/filter/gr_sincos.c
+++ b/gnuradio-core/src/lib/filter/gr_sincos.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,7 +24,9 @@
#include "config.h"
#endif
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE // ask for GNU extensions if available
+#endif
#include <gr_sincos.h>
#include <math.h>
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
index bd59e53ac..da919b35c 100644
--- a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
@@ -71,12 +71,12 @@ public:
d_prev_output = 0;
}
- tap_type prev_output () { return d_prev_output; }
+ o_type prev_output () { return d_prev_output; }
protected:
tap_type d_alpha;
tap_type d_one_minus_alpha;
- tap_type d_prev_output;
+ o_type d_prev_output;
};
@@ -87,7 +87,7 @@ template<class o_type, class i_type, class tap_type>
o_type
gr_single_pole_iir<o_type, i_type, tap_type>::filter (const i_type input)
{
- tap_type output;
+ o_type output;
output = d_alpha * input + d_one_minus_alpha * d_prev_output;
d_prev_output = output;
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
new file mode 100644
index 000000000..154068840
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
@@ -0,0 +1,121 @@
+/* -*- 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 <@NAME@.h>
+
+@NAME@::@NAME@(const std::vector<@TAP_TYPE@> &taps)
+{
+ d_buffer = NULL;
+ set_taps(taps);
+}
+
+@NAME@::~@NAME@()
+{
+ if(d_buffer != NULL)
+ free(d_buffer);
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_taps = gr_reverse(taps);
+
+ if(d_buffer != NULL) {
+ free(d_buffer);
+ d_buffer = NULL;
+ }
+
+ // FIXME: memalign this to 16-byte boundaries for SIMD later
+ size_t t = sizeof(@I_TYPE@) * 2 * d_taps.size();
+ d_buffer = (@I_TYPE@*)malloc(t);
+ memset(d_buffer, 0x00, t);
+ d_idx = 0;
+}
+
+@O_TYPE@
+@NAME@::filter (@I_TYPE@ input)
+{
+ unsigned int i;
+
+ d_buffer[d_idx] = input;
+ d_buffer[d_idx+ntaps()] = input;
+
+ // using the later for the case when ntaps=0;
+ // profiling shows this doesn't make a difference
+ //d_idx = (d_idx + 1) % ntaps();
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+
+ @ACC_TYPE@ out = 0;
+ for(i = 0; i < ntaps(); i++) {
+ out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i];
+ }
+ return (@O_TYPE@)out;
+}
+
+@O_TYPE@
+@NAME@::filter (const @I_TYPE@ input[], unsigned long dec)
+{
+ unsigned int i;
+
+ for(i = 0; i < dec; i++) {
+ d_buffer[d_idx] = input[i];
+ d_buffer[d_idx+ntaps()] = input[i];
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+ }
+
+ @ACC_TYPE@ out = 0;
+ for(i = 0; i < ntaps(); i++) {
+ out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i];
+ }
+ return (@O_TYPE@)out;
+}
+
+void
+@NAME@::filterN (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n)
+{
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(input[i]);
+ }
+}
+
+void
+@NAME@::filterNdec (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n,
+ unsigned long decimate)
+{
+ unsigned long j = 0;
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j], decimate);
+ j += decimate;
+ }
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
new file mode 100644
index 000000000..23d64b65d
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
@@ -0,0 +1,131 @@
+/* -*- 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.
+ */
+
+/*
+ * WARNING: This file is automatically generated by generate_gri_fir_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <vector>
+#include <gr_types.h>
+#include <gr_reverse.h>
+#include <string.h>
+#include <cstdio>
+
+/*!
+ * \brief FIR with internal buffer for @I_TYPE@ input,
+ @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter
+ *
+ */
+
+class @NAME@ {
+
+protected:
+ std::vector<@TAP_TYPE@> d_taps; // reversed taps
+ @I_TYPE@ *d_buffer;
+ unsigned int d_idx;
+
+public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ @NAME@ (const std::vector<@TAP_TYPE@> &taps);
+
+ ~@NAME@ ();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input is a single input value of the filter type
+ *
+ * \returns the filtered input value.
+ */
+ @O_TYPE@ filter (@I_TYPE@ input);
+
+
+ /*!
+ * \brief compute a single output value; designed for decimating filters.
+ *
+ * \p input is a single input value of the filter type. The value of dec is the
+ * decimating value of the filter, so input[] must have dec valid values.
+ * The filter pushes dec number of items onto the circ. buffer before computing
+ * a single output.
+ *
+ * \returns the filtered input value.
+ */
+ @O_TYPE@ filter (const @I_TYPE@ input[], unsigned long dec);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ void filterN (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n, unsigned long decimate);
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned ntaps () const { return d_taps.size (); }
+
+ /*!
+ * \return current taps
+ */
+ const std::vector<@TAP_TYPE@> get_taps () const
+ {
+ return gr_reverse(d_taps);
+ }
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/filter/qa_filter.cc b/gnuradio-core/src/lib/filter/qa_filter.cc
index 878d48023..0d03cb0ee 100644
--- a/gnuradio-core/src/lib/filter/qa_filter.cc
+++ b/gnuradio-core/src/lib/filter/qa_filter.cc
@@ -36,6 +36,12 @@
#include <qa_gri_mmse_fir_interpolator.h>
#include <qa_gri_mmse_fir_interpolator_cc.h>
#include <qa_gr_rotator.h>
+#include <qa_gri_fir_filter_with_buffer_ccf.h>
+#include <qa_gri_fir_filter_with_buffer_ccc.h>
+#include <qa_gri_fir_filter_with_buffer_fcc.h>
+#include <qa_gri_fir_filter_with_buffer_fff.h>
+#include <qa_gri_fir_filter_with_buffer_fsf.h>
+#include <qa_gri_fir_filter_with_buffer_scc.h>
CppUnit::TestSuite *
qa_filter::suite ()
@@ -51,6 +57,12 @@ qa_filter::suite ()
s->addTest (qa_gri_mmse_fir_interpolator::suite ());
s->addTest (qa_gri_mmse_fir_interpolator_cc::suite ());
s->addTest (qa_gr_rotator::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_ccf::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_ccc::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_fcc::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_fff::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_fsf::suite ());
+ s->addTest (qa_gri_fir_filter_with_buffer_scc::suite ());
return s;
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
new file mode 100644
index 000000000..e87d93ebf
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
@@ -0,0 +1,160 @@
+/* -*- 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 <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_ccc.h>
+#include <gri_fir_filter_with_buffer_ccc.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef gr_complex i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_complex (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_ccc *f1 = new gri_fir_filter_with_buffer_ccc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
new file mode 100644
index 000000000..f9f206f66
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_ccc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
new file mode 100644
index 000000000..c25853b1e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
@@ -0,0 +1,167 @@
+/* -*- 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 <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_ccf.h>
+#include <gri_fir_filter_with_buffer_ccf.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef gr_complex i_type;
+typedef gr_complex o_type;
+typedef float tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_ccf::test_decimate (unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_complex (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_ccf *f1 = new gri_fir_filter_with_buffer_ccf(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
new file mode 100644
index 000000000..924b4bc2e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_CCF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_ccf : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccf);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_CCF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
new file mode 100644
index 000000000..19f270200
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
@@ -0,0 +1,168 @@
+/* -*- 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 <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_fcc.h>
+#include <gri_fir_filter_with_buffer_fcc.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef float i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t1()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t2()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t3()
+{
+ test_decimate(5);
+}
+
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_fcc::test_decimate(unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_fcc *f1 = new gri_fir_filter_with_buffer_fcc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
new file mode 100644
index 000000000..6201800f9
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_fcc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fcc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FCC_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
new file mode 100644
index 000000000..8401e484b
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
@@ -0,0 +1,156 @@
+/* -*- 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 <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_fff.h>
+#include <gri_fir_filter_with_buffer_fff.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef float i_type;
+typedef float o_type;
+typedef float tap_type;
+typedef float acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 32767);
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_fff::test_decimate(unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_fff *f1 = new gri_fir_filter_with_buffer_fff(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_output[o], actual_output[o],
+ fabsf (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
new file mode 100644
index 000000000..54a9cdc53
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FFF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_fff : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fff);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FFF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
new file mode 100644
index 000000000..091505380
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
@@ -0,0 +1,147 @@
+/* -*- 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 <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_fsf.h>
+#include <gri_fir_filter_with_buffer_fsf.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef float i_type;
+typedef short o_type;
+typedef float tap_type;
+typedef float acc_type;
+
+using std::vector;
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_floats (float *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (float) rint (uniform () * 128);
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += input[i] * taps[i];
+ }
+ return (o_type)sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_fsf::test_decimate (unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_floats (input, INPUT_LEN);
+ random_floats (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_fsf *f1 = new gri_fir_filter_with_buffer_fsf(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_EQUAL(expected_output[o], actual_output[o]);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
new file mode 100644
index 000000000..9c901464e
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_FSF_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_fsf : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fsf);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_FSF_H_ */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
new file mode 100644
index 000000000..03cd71022
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
@@ -0,0 +1,167 @@
+/* -*- 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 <gr_types.h>
+#include <qa_gri_fir_filter_with_buffer_scc.h>
+#include <gri_fir_filter_with_buffer_scc.h>
+#include <string.h>
+#include <iostream>
+#include <cmath>
+#include <cppunit/TestAssert.h>
+#include <random.h>
+#include <malloc16.h>
+#include <string.h>
+
+typedef short i_type;
+typedef gr_complex o_type;
+typedef gr_complex tap_type;
+typedef gr_complex acc_type;
+
+using std::vector;
+
+#define ERR_DELTA (1e-5)
+
+#define NELEM(x) (sizeof (x) / sizeof (x[0]))
+
+static float
+uniform ()
+{
+ return 2.0 * ((float) random () / RANDOM_MAX - 0.5); // uniformly (-1, 1)
+}
+
+static void
+random_shorts (short *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++)
+ buf[i] = (short) rint (uniform () * 16384);
+}
+
+static void
+random_complex (gr_complex *buf, unsigned n)
+{
+ for (unsigned i = 0; i < n; i++){
+ float re = rint (uniform () * 32767);
+ float im = rint (uniform () * 32767);
+ buf[i] = gr_complex (re, im);
+ }
+}
+
+static o_type
+ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
+{
+ acc_type sum = 0;
+ for (int i = 0; i < ntaps; i++) {
+ sum += (float)input[i] * taps[i];
+ }
+
+ return sum;
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t1 ()
+{
+ test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t2 ()
+{
+ test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t3 ()
+{
+ test_decimate(5);
+}
+
+//
+// Test for ntaps in [0,9], and input lengths in [0,17].
+// This ensures that we are building the shifted taps correctly,
+// and exercises all corner cases on input alignment and length.
+//
+void
+qa_gri_fir_filter_with_buffer_scc::test_decimate (unsigned int decimate)
+{
+ const int MAX_TAPS = 9;
+ const int OUTPUT_LEN = 17;
+ const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN;
+
+ // Mem aligned buffer not really necessary, but why not?
+ i_type *input = (i_type *)malloc16Align(INPUT_LEN * sizeof(i_type));
+ i_type *dline = (i_type*)malloc16Align(INPUT_LEN * sizeof(i_type));
+ o_type expected_output[OUTPUT_LEN];
+ o_type actual_output[OUTPUT_LEN];
+ tap_type taps[MAX_TAPS];
+
+ srandom (0); // we want reproducibility
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+
+ for (int n = 0; n <= MAX_TAPS; n++){
+ for (int ol = 0; ol <= OUTPUT_LEN; ol++){
+
+ // cerr << "@@@ n:ol " << n << ":" << ol << endl;
+
+ // build random test case
+ random_shorts (input, INPUT_LEN);
+ random_complex (taps, MAX_TAPS);
+
+ // compute expected output values
+ memset(dline, 0, INPUT_LEN*sizeof(i_type));
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ // use an actual delay line for this test
+ for(int dd = 0; dd < (int)decimate; dd++) {
+ for(int oo = INPUT_LEN-1; oo > 0; oo--)
+ dline[oo] = dline[oo-1];
+ dline[0] = input[decimate*o+dd];
+ }
+ expected_output[o] = ref_dotprod (dline, taps, n);
+ }
+
+ // build filter
+ vector<tap_type> f1_taps(&taps[0], &taps[n]);
+ gri_fir_filter_with_buffer_scc *f1 = new gri_fir_filter_with_buffer_scc(f1_taps);
+
+ // zero the output, then do the filtering
+ memset (actual_output, 0, sizeof (actual_output));
+ f1->filterNdec (actual_output, input, ol/decimate, decimate);
+
+ // check results
+ //
+ // we use a sloppy error margin because on the x86 architecture,
+ // our reference implementation is using 80 bit floating point
+ // arithmetic, while the SSE version is using 32 bit float point
+ // arithmetic.
+
+ for (int o = 0; o < (int)(ol/decimate); o++){
+ CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
+ abs (expected_output[o]) * ERR_DELTA);
+ }
+ delete f1;
+ }
+ }
+ free16Align(input);
+}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
new file mode 100644
index 000000000..970ca3749
--- /dev/null
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
@@ -0,0 +1,46 @@
+/* -*- 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.
+ */
+#ifndef _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_
+#define _QA_GRI_FIR_FILTER_WITH_BUFFER_SCC_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gri_fir_filter_with_buffer_scc : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_scc);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void test_decimate(unsigned int decimate);
+
+ void t1 ();
+ void t2 ();
+ void t3 ();
+
+};
+
+
+#endif /* _QA_GR_FIR_FILTER_WITH_BUFFER_SCC_H_ */
diff --git a/gnuradio-core/src/lib/general/gr_circular_file.cc b/gnuradio-core/src/lib/general/gr_circular_file.cc
index 468b49a10..c9222597a 100644
--- a/gnuradio-core/src/lib/general/gr_circular_file.cc
+++ b/gnuradio-core/src/lib/general/gr_circular_file.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -66,7 +66,10 @@ gr_circular_file::gr_circular_file (const char *filename,
exit (1);
}
#ifdef HAVE_MMAP /* FIXME */
- ftruncate (d_fd, size + HEADER_SIZE);
+ if(ftruncate (d_fd, size + HEADER_SIZE) != 0) {
+ perror (filename);
+ exit (1);
+ }
#endif
}
else {
diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
index ff997e7a9..c32398e6d 100644
--- a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
@@ -161,8 +161,9 @@ gr_fll_band_edge_cc::work (int noutput_items,
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
- float *frq, *phs;
- gr_complex *err;
+ float *frq = NULL;
+ float *phs = NULL;
+ gr_complex *err = NULL;
if(output_items.size() > 2) {
frq = (float *) output_items[1];
phs = (float *) output_items[2];
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
index 89ef18869..a392abd06 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_complex.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
@@ -52,12 +52,12 @@ gr_float_to_complex::work (int noutput_items,
switch (input_items.size ()){
case 1:
- for (int j = 0; j < noutput_items*d_vlen; j++)
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
out[j] = gr_complex (r[j], 0);
break;
case 2:
- for (int j = 0; j < noutput_items*d_vlen; j++)
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
out[j] = gr_complex (r[j], i[j]);
break;
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc
index ea7e9405f..1670eb7cf 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.cc
+++ b/gnuradio-core/src/lib/general/gr_skiphead.cc
@@ -27,7 +27,7 @@
#include <gr_io_signature.h>
#include <string.h>
-gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip)
+gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip)
: gr_block ("skiphead",
gr_make_io_signature(1, 1, itemsize),
gr_make_io_signature(1, 1, itemsize)),
@@ -36,7 +36,7 @@ gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip)
}
gr_skiphead_sptr
-gr_make_skiphead (size_t itemsize, size_t nitems_to_skip)
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip)
{
return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip));
}
@@ -55,11 +55,11 @@ gr_skiphead::general_work(int noutput_items,
while (ii < ninput_items){
- long long ni_total = ii + d_nitems; // total items processed so far
+ uint64_t ni_total = ii + d_nitems; // total items processed so far
if (ni_total < d_nitems_to_skip){ // need to skip some more
int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total,
- (long long)(ninput_items - ii));
+ (uint64_t)(ninput_items - ii));
ii += n_to_skip;
}
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h
index 965feff9b..933c126e3 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.h
+++ b/gnuradio-core/src/lib/general/gr_skiphead.h
@@ -39,11 +39,11 @@ typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr;
class gr_skiphead : public gr_block
{
- friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
- gr_skiphead (size_t itemsize, size_t nitems_to_skip);
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
- long long d_nitems_to_skip;
- long long d_nitems; // total items seen
+ uint64_t d_nitems_to_skip;
+ uint64_t d_nitems; // total items seen
public:
@@ -54,7 +54,7 @@ class gr_skiphead : public gr_block
};
gr_skiphead_sptr
-gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
#endif /* INCLUDED_GR_SKIPHEAD_H */
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i
index 52c0808f0..45cbd0437 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.i
+++ b/gnuradio-core/src/lib/general/gr_skiphead.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2007 Free Software Foundation, Inc.
+ * Copyright 2005,2007,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,9 +22,9 @@
GR_SWIG_BLOCK_MAGIC(gr,skiphead);
-gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
+gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
class gr_skiphead : public gr_block {
- friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
- gr_skiphead (size_t itemsize, size_t nitems_to_skip);
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
};
diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.i b/gnuradio-core/src/lib/general/gri_agc2_cc.i
index e7d6da97f..0f97f1d8e 100644
--- a/gnuradio-core/src/lib/general/gri_agc2_cc.i
+++ b/gnuradio-core/src/lib/general/gri_agc2_cc.i
@@ -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);
};
diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.i b/gnuradio-core/src/lib/general/gri_agc2_ff.i
index 3825ce225..d04b638a6 100644
--- a/gnuradio-core/src/lib/general/gri_agc2_ff.i
+++ b/gnuradio-core/src/lib/general/gri_agc2_ff.i
@@ -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);
};
diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
index 58a25325a..0e8b23ee1 100644
--- a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
@@ -52,7 +52,7 @@ int
int ninputs = input_items.size ();
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc += ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
index 1200145fa..ea245b57b 100644
--- a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
@@ -53,13 +53,13 @@ int
int ninputs = input_items.size ();
if (ninputs == 1){ // compute reciprocal
- for (int i = 0; i < noutput_items*d_vlen; i++)
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
*optr++ = (@O_TYPE@) ((@O_TYPE@) 1 /
((@I_TYPE@ *) input_items[0])[i]);
}
else {
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc /= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
index 13ec0c8b3..5d270c763 100644
--- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
@@ -52,7 +52,7 @@ int
int ninputs = input_items.size ();
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc *= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
index f0ed75217..1dcdf81ad 100644
--- a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
@@ -53,12 +53,12 @@ int
int ninputs = input_items.size ();
if (ninputs == 1){ // negate
- for (int i = 0; i < noutput_items*d_vlen; i++)
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
*optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i];
}
else {
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc -= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc b/gnuradio-core/src/lib/io/gr_file_sink.cc
index 706837c7a..aab0158e7 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_file_sink.cc
@@ -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;
}
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.cc b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
index 5ddeeb4d5..c43304b0d 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink_base.cc
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
@@ -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;
+}
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.h b/gnuradio-core/src/lib/io/gr_file_sink_base.h
index 0c028d7fd..7b96cdb7f 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink_base.h
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.h
@@ -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);
};
diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.i b/gnuradio-core/src/lib/io/gr_file_sink_base.i
index 05a3353bb..ed4342482 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink_base.i
+++ b/gnuradio-core/src/lib/io/gr_file_sink_base.i
@@ -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);
};
diff --git a/gnuradio-core/src/lib/io/gr_oscope_guts.cc b/gnuradio-core/src/lib/io/gr_oscope_guts.cc
index 80f78240d..ce7feca13 100644
--- a/gnuradio-core/src/lib/io/gr_oscope_guts.cc
+++ b/gnuradio-core/src/lib/io/gr_oscope_guts.cc
@@ -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);
}
/*
diff --git a/gnuradio-core/src/lib/io/gr_trigger_mode.h b/gnuradio-core/src/lib/io/gr_trigger_mode.h
index 63f6b1c98..8e1222856 100644
--- a/gnuradio-core/src/lib/io/gr_trigger_mode.h
+++ b/gnuradio-core/src/lib/io/gr_trigger_mode.h
@@ -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 {
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index b0e804277..f67e8843d 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2003,2004,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright 2003,2004,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
include $(top_srcdir)/Makefile.common
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(GRUEL_INCLUDES) $(WITH_INCLUDES)
+AM_CPPFLAGS = $(GRUEL_INCLUDES) $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
noinst_LTLIBRARIES = libruntime.la libruntime-qa.la
@@ -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_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc
index e0be2db62..5f7412248 100644
--- a/gnuradio-core/src/lib/runtime/gr_preferences.cc
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2003,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -77,11 +77,20 @@ gr_preferences::get (const char *key)
static char buf[1024];
FILE *fp = fopen (pathname (key), "r");
- if (fp == 0)
+ if (fp == 0) {
+ perror (pathname (key));
return 0;
+ }
memset (buf, 0, sizeof (buf));
- fread (buf, 1, sizeof (buf) - 1, fp);
+ size_t ret = fread (buf, 1, sizeof (buf) - 1, fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return 0;
+ }
+ }
fclose (fp);
return buf;
}
@@ -97,6 +106,13 @@ gr_preferences::set (const char *key, const char *value)
return;
}
- fwrite (value, 1, strlen (value), fp);
+ size_t ret = fwrite (value, 1, strlen (value), fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return;
+ }
+ }
fclose (fp);
};
diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h
new file mode 100644
index 000000000..70aa6f294
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_unittests.h
@@ -0,0 +1,67 @@
+/* -*- 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 *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 (path, 0750);
+}
+
+static void
+get_unittest_path (const char *filename, char *fullpath, size_t pathsize)
+{
+ char path[200];
+ snprintf (path, sizeof(path), "./.unittests");
+ snprintf (fullpath, pathsize, "%s/%s", path, filename);
+
+ ensure_unittest_path(path);
+}
+
diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am
index 242f27d9c..1a50b8c8e 100644
--- a/gnuradio-core/src/lib/swig/Makefile.am
+++ b/gnuradio-core/src/lib/swig/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright 2001,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
include $(top_srcdir)/Makefile.common
if PYTHON
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) -I$(srcdir) \
+AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \
$(WITH_INCLUDES)
EXTRA_DIST = gen-swig-bug-fix
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i
index 7d0241f1c..e15a0059c 100644
--- a/gnuradio-core/src/lib/swig/gnuradio.i
+++ b/gnuradio-core/src/lib/swig/gnuradio.i
@@ -46,6 +46,8 @@
typedef std::complex<float> gr_complex;
typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
// instantiate the required template specializations
diff --git a/gnuradio-core/src/python/gnuradio/Makefile.am b/gnuradio-core/src/python/gnuradio/Makefile.am
index f0516f2fd..a3f3518de 100644
--- a/gnuradio-core/src/python/gnuradio/Makefile.am
+++ b/gnuradio-core/src/python/gnuradio/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2004,2007,2008,2009 Free Software Foundation, Inc.
+# Copyright 2004,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,6 +34,7 @@ grpython_PYTHON = \
ofdm_packet_utils.py \
packet_utils.py \
gr_unittest.py \
+ gr_xmlrunner.py \
optfir.py \
usrp_options.py \
window.py
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
index e40d9636a..5e4e06871 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, optfir
class pfb_arb_resampler_ccf(gr.hier_block2):
'''
@@ -31,15 +31,36 @@ class pfb_arb_resampler_ccf(gr.hier_block2):
streams. This block is provided to be consistent with the interface to the
other PFB block.
'''
- def __init__(self, rate, taps, flt_size=32):
+ def __init__(self, rate, taps=None, flt_size=32, atten=100):
gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._rate = rate
- self._taps = taps
self._size = flt_size
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ #self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._size, self._size, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
self.connect(self, self.pfb)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
index a479ed48e..3ddc1749a 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, optfir
class pfb_channelizer_ccf(gr.hier_block2):
'''
@@ -29,15 +29,35 @@ class pfb_channelizer_ccf(gr.hier_block2):
This simplifies the interface by allowing a single input stream to connect to this block.
It will then output a stream for each channel.
'''
- def __init__(self, numchans, taps, oversample_rate=1):
+ def __init__(self, numchans, taps=None, oversample_rate=1, atten=100):
gr.hier_block2.__init__(self, "pfb_channelizer_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(numchans, numchans, gr.sizeof_gr_complex)) # Output signature
self._numchans = numchans
- self._taps = taps
self._oversample_rate = oversample_rate
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(1, self._numchans, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._numchans)
self.pfb = gr.pfb_channelizer_ccf(self._numchans, self._taps,
self._oversample_rate)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
index 176d0473e..2e36e7bc1 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, optfir
class pfb_decimator_ccf(gr.hier_block2):
'''
@@ -29,15 +29,35 @@ class pfb_decimator_ccf(gr.hier_block2):
This simplifies the interface by allowing a single input stream to connect to this block.
It will then output a stream that is the decimated output stream.
'''
- def __init__(self, decim, taps, channel=0):
+ def __init__(self, decim, taps=None, channel=0, atten=100):
gr.hier_block2.__init__(self, "pfb_decimator_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._decim = decim
- self._taps = taps
self._channel = channel
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.1
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(1, self._decim, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._decim)
self.pfb = gr.pfb_decimator_ccf(self._decim, self._taps, self._channel)
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
index db2944042..a6094f7f4 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
+from gnuradio import gr, optfir
class pfb_interpolator_ccf(gr.hier_block2):
'''
@@ -31,7 +31,7 @@ class pfb_interpolator_ccf(gr.hier_block2):
streams. This block is provided to be consistent with the interface to the
other PFB block.
'''
- def __init__(self, interp, taps):
+ def __init__(self, interp, taps=None, atten=100):
gr.hier_block2.__init__(self, "pfb_interpolator_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
@@ -39,6 +39,27 @@ class pfb_interpolator_ccf(gr.hier_block2):
self._interp = interp
self._taps = taps
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.4
+ tb = 0.2
+ ripple = 0.99
+ made = False
+ while not made:
+ try:
+ self._taps = optfir.low_pass(self._interp, self._interp, bw, bw+tb, ripple, atten)
+ made = True
+ except RuntimeError:
+ ripple += 0.01
+ made = False
+ print("Warning: set ripple to %.4f dB. If this is a problem, adjust the attenuation or create your own filter taps." % (ripple))
+
+ # Build in an exit strategy; if we've come this far, it ain't working.
+ if(ripple >= 1.0):
+ raise RuntimeError("optfir could not generate an appropriate filter.")
+
self.pfb = gr.pfb_interpolator_ccf(self._interp, self._taps)
self.connect(self, self.pfb)
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py
index 2fa97fad8..8fb70fb3f 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_add_and_friends.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
from gnuradio import gr, gr_unittest
-class test_head (gr_unittest.TestCase):
+class test_add_and_friends (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -126,4 +126,4 @@ class test_head (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_add_and_friends, "test_add_and_friends.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py
index 215e0cace..90056e09f 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_add_v_and_friends.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -350,4 +350,4 @@ class test_add_v_and_friends(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_add_v_and_friends, "test_add_v_and_friends.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py
index bb3ddb11e..c55d191e0 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_agc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,7 +25,7 @@ import math
test_output = False
-class test_sig_source (gr_unittest.TestCase):
+class test_agc (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -430,4 +430,4 @@ class test_sig_source (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_agc, "test_agc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
index 2e16d879b..a9db3295a 100644
--- a/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_argmax.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@ from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_arg_max (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -73,5 +73,5 @@ class test_sig_source (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_arg_max, "test_arg_max.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
index 29b9796cd..b8b718a09 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_bin_statistics.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -227,4 +227,4 @@ class xtest_bin_statistics(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(xtest_bin_statistics, "test_bin_statistics.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py
index ee9bae65b..8cfb60099 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2008 Free Software Foundation, Inc.
+# Copyright 2004,2007,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
from gnuradio import gr, gr_unittest
-class test_head (gr_unittest.TestCase):
+class test_boolean_operators (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -159,4 +159,4 @@ class test_head (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_boolean_operators, "test_boolean_operators.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_classify.py b/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
index ac17aff29..ac5b53b57 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_classify.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -38,7 +38,7 @@ def np2(k):
return m
-class qa_classify(gr_unittest.TestCase):
+class test_classify(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
@@ -178,5 +178,4 @@ class qa_classify(gr_unittest.TestCase):
assert sum < 1e-6
if __name__ == '__main__':
- gr_unittest.main()
-
+ gr_unittest.run(test_classify, "test_classify.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py b/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py
index b1ab8f546..79e9cd092 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_cma_equalizer.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -46,4 +46,4 @@ class test_cma_equalizer_fir(gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual(expected_data, result)
if __name__ == "__main__":
- gr_unittest.main() \ No newline at end of file
+ gr_unittest.run(test_cma_equalizer_fir, "test_cma_equalizer_fir.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py b/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py
index 10f366879..76627247b 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_complex_to_xxx.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -138,5 +138,5 @@ class test_complex_ops (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_complex_ops, "test_complex_ops.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py b/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py
index 13d2840a0..27e1802e0 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_constellation_decoder_cb.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_head (gr_unittest.TestCase):
+class test_constellation_decoder (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -49,5 +49,5 @@ class test_head (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_constellation_decoder, "test_constellation_decoder.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py
index 7f9f72a7b..e8ee480cc 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_copy.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_copy.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2009 Free Software Foundation, Inc.
+# Copyright 2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -55,4 +55,4 @@ class test_copy(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_copy, "test_copy.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py b/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py
index a436c6ad6..b3575f4e6 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_correlate_access_code.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -79,5 +79,5 @@ class test_correlate_access_code(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_correlate_access_code, "test_correlate_access_code.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py
index 8835cba5a..7cad0ae72 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_delay.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_delay.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -62,4 +62,4 @@ class test_delay (gr_unittest.TestCase):
self.assertEqual (expected_result, dst_data)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_delay, "test_delay.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py
index 04c0e2a49..97e9e329a 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -31,7 +31,7 @@ def make_random_int_tuple(L, min, max):
return tuple(result)
-class test_encoder (gr_unittest.TestCase):
+class test_diff_encoder (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -82,5 +82,5 @@ class test_encoder (gr_unittest.TestCase):
self.assertEqual(expected_result, actual_result)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_diff_encoder, "test_diff_encoder.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py
index 385ffa519..5ac115e20 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_complex_ops (gr_unittest.TestCase):
+class test_diff_phasor (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -46,5 +46,5 @@ class test_complex_ops (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
index b0dc47061..caf3959f4 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -47,4 +47,4 @@ class test_ccsds_27 (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_ccsds_27, "test_ccsds_27.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_feval.py b/gnuradio-core/src/python/gnuradio/gr/qa_feval.py
index 64bbe45ce..a91409537 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_feval.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_feval.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -107,4 +107,4 @@ class test_feval(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_feval, "test_feval.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py
index 412c4c48b..98d80fbb0 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_fft.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fft.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,7 +29,7 @@ primes = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311)
-class test_fft_filter(gr_unittest.TestCase):
+class test_fft(gr_unittest.TestCase):
def setUp(self):
pass
@@ -154,5 +154,5 @@ class test_fft_filter(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_fft, "test_fft.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py
index d4106ee47..b3124ad29 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fft_filter.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005,2007 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -275,5 +275,5 @@ class test_fft_filter(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_fft_filter, "test_fft_filter.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py
index b92f143d5..a25c65e5c 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_filter_delay_fc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class qa_filter_delay_fc (gr_unittest.TestCase):
+class test_filter_delay_fc (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -314,4 +314,4 @@ class qa_filter_delay_fc (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_filter_delay_fc, "test_filter_delay_fc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py
index 4466e8aab..c9ba54164 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fractional_interpolator.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,5 +35,4 @@ class test_fractional_resampler (gr_unittest.TestCase):
op2 = gr.fractional_interpolator_cc(0.0, 1.0)
if __name__ == '__main__':
- gr_unittest.main()
-
+ gr_unittest.run(test_fractional_resampler, "test_fractional_resampler.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py
index 53d1a89ba..829185c34 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -52,5 +52,5 @@ class test_frequency_modulator (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_frequency_modulator, "test_frequency_modulator.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py
index b506e3ed4..429e57c32 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -71,5 +71,5 @@ class test_bytes_to_syms (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
index fc211657f..1665d9dd5 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -91,4 +91,4 @@ def auto_correlate(data):
return R
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_glfsr_source, "test_glfsr_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py
index d5dc595c9..dcb3d867e 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_goertzel.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -61,4 +61,4 @@ class test_goertzel(gr_unittest.TestCase):
self.assertAlmostEqual(expected_result, actual_result, places=4)
if __name__ == '__main__':
- gr_unittest.main()
+ gr_unittest.run(test_goertzel, "test_goertzel.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_head.py b/gnuradio-core/src/python/gnuradio/gr/qa_head.py
index b7a60597b..aae233b56 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_head.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_head.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -44,4 +44,4 @@ class test_head (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_head, "test_head.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
index cc336a4d1..924a0fb52 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_hier_block2.py
@@ -366,4 +366,4 @@ class test_hier_block2(gr_unittest.TestCase):
if __name__ == "__main__":
- gr_unittest.main()
+ gr_unittest.run(test_hier_block2, "test_hier_block2.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py
index 817ba9408..2235f28b1 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_hilbert.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_hilbert (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -113,4 +113,4 @@ class test_sig_source (gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_hilbert, "test_hilbert.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py
index 833285077..0e522c16b 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_iir.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_iir.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -155,5 +155,5 @@ class test_iir (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_iir, "test_iir.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py
index fbd601e34..501a89f84 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_integrate.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -72,4 +72,4 @@ class test_integrate (gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_integrate, "test_integrate.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py
index 3e0b6c5fc..1320d0ec5 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_interleave.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -77,5 +77,5 @@ class test_interleave (gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual (expected_result3, dst3.data ())
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_interleave, "test_interleave.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py
index ea326ce40..9901b71b7 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_interp_fir_filter.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -50,5 +50,5 @@ class test_interp_fir_filter (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_interp_fir_filter, "test_interp_fir_filter.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py
index cc25d180e..2f0bbe33d 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludge_copy.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -87,5 +87,5 @@ class test_kludge_copy(gr_unittest.TestCase):
self.assertRaises(ValueError, self.tb.run)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_kludge_copy, "test_kludge_copy.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
index 91ddf7cd7..7d29a9507 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2008 Free Software Foundation, Inc.
+# Copyright 2005,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
from gnuradio import gr, gr_unittest
-class test_head (gr_unittest.TestCase):
+class test_kludged_imports (gr_unittest.TestCase):
def setUp(self):
pass
@@ -40,4 +40,4 @@ class test_head (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_kludged_imports, "test_kludged_imports.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_max.py b/gnuradio-core/src/python/gnuradio/gr/qa_max.py
index 0171c93db..5aa231623 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_max.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_max.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@ from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_max (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -66,5 +66,5 @@ class test_sig_source (gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_max, "test_max.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_message.py b/gnuradio-core/src/python/gnuradio/gr/qa_message.py
index cb6c4c33c..e7f2778d1 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_message.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_message.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -128,4 +128,4 @@ class test_message (gr_unittest.TestCase):
self.assertEquals(tuple(map(ord, '0123456789')), dst.data())
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_message, "test_message.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_mute.py b/gnuradio-core/src/python/gnuradio/gr/qa_mute.py
index 646f495c4..58c5062a5 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_mute.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_mute.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005,2007 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
from gnuradio import gr, gr_unittest
-class test_head (gr_unittest.TestCase):
+class test_mute (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -86,4 +86,4 @@ class test_head (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_mute, "test_mute.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py
index 4dca67b22..5a2e6a0d2 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_nlog10.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2007 Free Software Foundation, Inc.
+# Copyright 2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
from gnuradio import gr, gr_unittest
-class test_single_pole_iir(gr_unittest.TestCase):
+class test_nlog10(gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -43,5 +43,5 @@ class test_single_pole_iir(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_nlog10, "test_nlog10.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py
index f8ed739a9..4a575f5d6 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_noise.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,5 +35,5 @@ class test_noise_source(gr_unittest.TestCase):
op = gr.noise_source_f(gr.GR_GAUSSIAN, 10, 10)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_noise_source, "test_noise_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py b/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py
index d45560d3c..d69f5ca5b 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_ofdm_insert_preamble.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
from pprint import pprint
-class testing (gr_unittest.TestCase):
+class test_ofdm_insert_preamble (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -176,4 +176,4 @@ class testing (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_ofdm_insert_preamble, "test_ofdm_insert_preamble.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py b/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py
index b1b3a971d..8833f755b 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_packed_to_unpacked.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2007 Free Software Foundation, Inc.
+# Copyright 2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -401,5 +401,5 @@ class test_packing(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_packing, "test_packing.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py
index 533f4f051..a6683c5c3 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pipe_fittings.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2007 Free Software Foundation, Inc.
+# Copyright 2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -139,5 +139,5 @@ class test_pipe_fittings(gr_unittest.TestCase):
self.assertEqual(expected_results, dst.data())
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_pipe_fittings, "test_pipe_fittings.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
index 4a109663c..8e4a0eefa 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_pll_carriertracking (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block()
@@ -155,4 +155,4 @@ class test_sig_source (gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_pll_carriertracking, "test_pll_carriertracking.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
index ac9c1844e..5225a9a3b 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_pll_freqdet (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block()
@@ -158,4 +158,4 @@ class test_sig_source (gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 3)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_pll_freqdet, "test_pll_freqdet.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
index 9cafa61e3..c40a885a8 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_pll_refout (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block()
@@ -155,4 +155,4 @@ class test_sig_source (gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_pll_refout, "test_pll_refout.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
index 01d01bde0..fbdabb4cb 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -47,4 +47,4 @@ class test_pn_correlator_cc(gr_unittest.TestCase):
self.assertEqual(data[-1], (1.0+0j))
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_pn_correlator_cc, "test_pn_correlator_cc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py
index f8bf4b121..3bd6160df 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_rational_resampler.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2006,2007 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -294,5 +294,5 @@ class test_rational_resampler (gr_unittest.TestCase):
if __name__ == '__main__':
pass
# FIXME: Disabled, see ticket:210
- # gr_unittest.main()
+ # gr_unittest.run(test_rational_resampler, "test_rational_resampler.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
index 64e751189..32ecc3776 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_sig_source (gr_unittest.TestCase):
+class test_regenerate (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -87,4 +87,4 @@ class test_sig_source (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_regenerate, "test_regenerate.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
index 1ecc7ead3..2b1429980 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -45,4 +45,4 @@ class test_repeat (gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_repeat, "test_repeat.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py
index aecf49293..241d8ec2a 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -61,4 +61,4 @@ class test_scrambler(gr_unittest.TestCase):
self.assertEqual(src_data, dst.data())
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_scrambler, "test_scrambler.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
index 058890c4f..4bb58038f 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -154,4 +154,4 @@ class test_sig_source (gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_sig_source, "test_sig_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py
index 8ad0a9bb2..1d2e6595c 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2007 Free Software Foundation, Inc.
+# Copyright 2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -68,5 +68,5 @@ class test_single_pole_iir(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_single_pole_iir, "test_single_pole_iir.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py
index 865c7c906..47b4948ba 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_single_pole_iir_cc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2005,2006,2007 Free Software Foundation, Inc.
+# Copyright 2005,2006,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -68,5 +68,5 @@ class test_single_pole_iir_cc(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_single_pole_iir_cc, "test_single_pole_iir_cc.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py
index 106e97314..de2d8fc95 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_skiphead.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -99,4 +99,4 @@ class test_skiphead (gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_skiphead, "test_skiphead.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py
index 8a76f8144..7d6ddf81b 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_stream_mux.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005,2007 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,7 +22,7 @@
from gnuradio import gr, gr_unittest
-class test_head (gr_unittest.TestCase):
+class test_stream_mux (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -165,4 +165,4 @@ class test_head (gr_unittest.TestCase):
self.assertEqual (exp_data, result_data)
if __name__ == '__main__':
- gr_unittest.main()
+ gr_unittest.run(test_stream_mux, "test_stream_mux.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
index b00b26bbe..097e394c9 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
from threading import Timer
-class test_sink_source(gr_unittest.TestCase):
+class test_udp_sink_source(gr_unittest.TestCase):
def setUp(self):
self.tb_snd = gr.top_block()
@@ -95,5 +95,5 @@ class test_sink_source(gr_unittest.TestCase):
#print "tb_rcv stopped by Timer"
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_udp_sink_source, "test_udp_sink_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
index edb263ade..d1faf9d9e 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -53,5 +53,5 @@ class test_unpack(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_unpack, "test_unpack.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
index 149c66903..5d8d85c7c 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_vector_sink_source.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
from gnuradio import gr, gr_unittest
import math
-class test_sink_source(gr_unittest.TestCase):
+class test_vector_sink_source(gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -61,5 +61,5 @@ class test_sink_source(gr_unittest.TestCase):
self.assertRaises(ValueError, lambda : gr.vector_source_f(src_data, False, 3))
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_vector_sink_source, "test_vector_sink_source.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
index 3ba5dfbce..d9f38e3f1 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_wavefile.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -27,7 +27,7 @@ from os.path import getsize
g_in_file = os.path.join (os.getenv ("srcdir"), "test_16bit_1chunk.wav")
-class qa_wavefile(gr_unittest.TestCase):
+class test_wavefile(gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
@@ -66,4 +66,4 @@ class qa_wavefile(gr_unittest.TestCase):
if __name__ == '__main__':
- gr_unittest.main ()
+ gr_unittest.run(test_wavefile, "test_wavefile.xml")
diff --git a/gnuradio-core/src/python/gnuradio/gr_unittest.py b/gnuradio-core/src/python/gnuradio/gr_unittest.py
index a48343c6b..c2c4df2ba 100755
--- a/gnuradio-core/src/python/gnuradio/gr_unittest.py
+++ b/gnuradio-core/src/python/gnuradio/gr_unittest.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,8 @@
#
import unittest
-import sys
+import gr_xmlrunner
+import sys, os, stat
class TestCase(unittest.TestCase):
"""A subclass of unittest.TestCase that adds additional assertions
@@ -37,7 +38,7 @@ class TestCase(unittest.TestCase):
Note that decimal places (from zero) is usually not the same
as significant digits (measured from the most signficant digit).
- """
+ """
if round(second.real-first.real, places) != 0:
raise self.failureException, \
(msg or '%s != %s within %s places' % (`first`, `second`, `places` ))
@@ -106,6 +107,58 @@ 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 ./.unittests/python
+ '''
+
+ # Run this is given a file name
+ if(filename is not None):
+ basepath = "./.unittests"
+ path = basepath + "/python"
+
+ if not os.path.exists(basepath):
+ os.makedirs(basepath, 0750)
+
+ xmlrunner = None
+ # only proceed if .unittests is writable
+ st = os.stat(basepath)[stat.ST_MODE]
+ if(st & stat.S_IWUSR > 0):
+ # Test if path exists; if not, build it
+ if not os.path.exists(path):
+ os.makedirs(path, 0750)
+
+ # Just for safety: make sure we can write here, too
+ st = os.stat(path)[stat.ST_MODE]
+ if(st & stat.S_IWUSR > 0):
+ # 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)
+
+ # use the xmlrunner if we can write the the directory
+ if(xmlrunner is not None):
+ xmlrunner.run(suite)
+
+ main()
+
+ # This will run and fail make check if problem
+ # but does not output to screen.
+ #main(testRunner = xmlrunner)
+
+ else:
+ # If no filename is given, just run the test
+ main()
+
+
##############################################################################
# Executing this module from the command line
##############################################################################
diff --git a/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
new file mode 100644
index 000000000..ded77f5f3
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
@@ -0,0 +1,385 @@
+"""
+XML Test Runner for PyUnit
+"""
+
+# Written by Sebastian Rittau <srittau@jroger.in-berlin.de> and placed in
+# the Public Domain. With contributions by Paolo Borelli and others.
+# Added to GNU Radio Oct. 3, 2010
+
+from __future__ import with_statement
+
+__version__ = "0.1"
+
+import os.path
+import re
+import sys
+import time
+import traceback
+import unittest
+from xml.sax.saxutils import escape
+
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+
+class _TestInfo(object):
+
+ """Information about a particular test.
+
+ Used by _XMLTestResult.
+
+ """
+
+ def __init__(self, test, time):
+ (self._class, self._method) = test.id().rsplit(".", 1)
+ self._time = time
+ self._error = None
+ self._failure = None
+
+ @staticmethod
+ def create_success(test, time):
+ """Create a _TestInfo instance for a successful test."""
+ return _TestInfo(test, time)
+
+ @staticmethod
+ def create_failure(test, time, failure):
+ """Create a _TestInfo instance for a failed test."""
+ info = _TestInfo(test, time)
+ info._failure = failure
+ return info
+
+ @staticmethod
+ def create_error(test, time, error):
+ """Create a _TestInfo instance for an erroneous test."""
+ info = _TestInfo(test, time)
+ info._error = error
+ return info
+
+ def print_report(self, stream):
+ """Print information about this test case in XML format to the
+ supplied stream.
+
+ """
+ stream.write(' <testcase classname="%(class)s" name="%(method)s" time="%(time).4f">' % \
+ {
+ "class": self._class,
+ "method": self._method,
+ "time": self._time,
+ })
+ if self._failure is not None:
+ self._print_error(stream, 'failure', self._failure)
+ if self._error is not None:
+ self._print_error(stream, 'error', self._error)
+ stream.write('</testcase>\n')
+
+ def _print_error(self, stream, tagname, error):
+ """Print information from a failure or error to the supplied stream."""
+ text = escape(str(error[1]))
+ stream.write('\n')
+ stream.write(' <%s type="%s">%s\n' \
+ % (tagname, _clsname(error[0]), text))
+ tb_stream = StringIO()
+ traceback.print_tb(error[2], None, tb_stream)
+ stream.write(escape(tb_stream.getvalue()))
+ stream.write(' </%s>\n' % tagname)
+ stream.write(' ')
+
+
+def _clsname(cls):
+ return cls.__module__ + "." + cls.__name__
+
+
+class _XMLTestResult(unittest.TestResult):
+
+ """A test result class that stores result as XML.
+
+ Used by XMLTestRunner.
+
+ """
+
+ def __init__(self, classname):
+ unittest.TestResult.__init__(self)
+ self._test_name = classname
+ self._start_time = None
+ self._tests = []
+ self._error = None
+ self._failure = None
+
+ def startTest(self, test):
+ unittest.TestResult.startTest(self, test)
+ self._error = None
+ self._failure = None
+ self._start_time = time.time()
+
+ def stopTest(self, test):
+ time_taken = time.time() - self._start_time
+ unittest.TestResult.stopTest(self, test)
+ if self._error:
+ info = _TestInfo.create_error(test, time_taken, self._error)
+ elif self._failure:
+ info = _TestInfo.create_failure(test, time_taken, self._failure)
+ else:
+ info = _TestInfo.create_success(test, time_taken)
+ self._tests.append(info)
+
+ def addError(self, test, err):
+ unittest.TestResult.addError(self, test, err)
+ self._error = err
+
+ def addFailure(self, test, err):
+ unittest.TestResult.addFailure(self, test, err)
+ self._failure = err
+
+ def print_report(self, stream, time_taken, out, err):
+ """Prints the XML report to the supplied stream.
+
+ The time the tests took to perform as well as the captured standard
+ output and standard error streams must be passed in.a
+
+ """
+ stream.write('<testsuite errors="%(e)d" failures="%(f)d" ' % \
+ { "e": len(self.errors), "f": len(self.failures) })
+ stream.write('name="%(n)s" tests="%(t)d" time="%(time).3f">\n' % \
+ {
+ "n": self._test_name,
+ "t": self.testsRun,
+ "time": time_taken,
+ })
+ for info in self._tests:
+ info.print_report(stream)
+ stream.write(' <system-out><![CDATA[%s]]></system-out>\n' % out)
+ stream.write(' <system-err><![CDATA[%s]]></system-err>\n' % err)
+ stream.write('</testsuite>\n')
+
+
+class XMLTestRunner(object):
+
+ """A test runner that stores results in XML format compatible with JUnit.
+
+ XMLTestRunner(stream=None) -> XML test runner
+
+ The XML file is written to the supplied stream. If stream is None, the
+ results are stored in a file called TEST-<module>.<class>.xml in the
+ current working directory (if not overridden with the path property),
+ where <module> and <class> are the module and class name of the test class.
+
+ """
+
+ def __init__(self, stream=None):
+ self._stream = stream
+ self._path = "."
+
+ def run(self, test):
+ """Run the given test case or test suite."""
+ class_ = test.__class__
+ classname = class_.__module__ + "." + class_.__name__
+ if self._stream == None:
+ filename = "TEST-%s.xml" % classname
+ stream = file(os.path.join(self._path, filename), "w")
+ stream.write('<?xml version="1.0" encoding="utf-8"?>\n')
+ else:
+ stream = self._stream
+
+ result = _XMLTestResult(classname)
+ start_time = time.time()
+
+ with _fake_std_streams():
+ test(result)
+ try:
+ out_s = sys.stdout.getvalue()
+ except AttributeError:
+ out_s = ""
+ try:
+ err_s = sys.stderr.getvalue()
+ except AttributeError:
+ err_s = ""
+
+ time_taken = time.time() - start_time
+ result.print_report(stream, time_taken, out_s, err_s)
+ if self._stream is None:
+ stream.close()
+
+ return result
+
+ def _set_path(self, path):
+ self._path = path
+
+ path = property(lambda self: self._path, _set_path, None,
+ """The path where the XML files are stored.
+
+ This property is ignored when the XML file is written to a file
+ stream.""")
+
+
+class _fake_std_streams(object):
+
+ def __enter__(self):
+ self._orig_stdout = sys.stdout
+ self._orig_stderr = sys.stderr
+ sys.stdout = StringIO()
+ sys.stderr = StringIO()
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ sys.stdout = self._orig_stdout
+ sys.stderr = self._orig_stderr
+
+
+class XMLTestRunnerTest(unittest.TestCase):
+
+ def setUp(self):
+ self._stream = StringIO()
+
+ def _try_test_run(self, test_class, expected):
+
+ """Run the test suite against the supplied test class and compare the
+ XML result against the expected XML string. Fail if the expected
+ string doesn't match the actual string. All time attributes in the
+ expected string should have the value "0.000". All error and failure
+ messages are reduced to "Foobar".
+
+ """
+
+ runner = XMLTestRunner(self._stream)
+ runner.run(unittest.makeSuite(test_class))
+
+ got = self._stream.getvalue()
+ # Replace all time="X.YYY" attributes by time="0.000" to enable a
+ # simple string comparison.
+ got = re.sub(r'time="\d+\.\d+"', 'time="0.000"', got)
+ # Likewise, replace all failure and error messages by a simple "Foobar"
+ # string.
+ got = re.sub(r'(?s)<failure (.*?)>.*?</failure>', r'<failure \1>Foobar</failure>', got)
+ got = re.sub(r'(?s)<error (.*?)>.*?</error>', r'<error \1>Foobar</error>', got)
+ # And finally Python 3 compatibility.
+ got = got.replace('type="builtins.', 'type="exceptions.')
+
+ self.assertEqual(expected, got)
+
+ def test_no_tests(self):
+ """Regression test: Check whether a test run without any tests
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ pass
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="0" time="0.000">
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_success(self):
+ """Regression test: Check whether a test run with a successful test
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ pass
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_failure(self):
+ """Regression test: Check whether a test run with a failing test
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ self.assert_(False)
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="1" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000">
+ <failure type="exceptions.AssertionError">Foobar</failure>
+ </testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_error(self):
+ """Regression test: Check whether a test run with a erroneous test
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ raise IndexError()
+ self._try_test_run(TestTest, """<testsuite errors="1" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000">
+ <error type="exceptions.IndexError">Foobar</error>
+ </testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_stdout_capture(self):
+ """Regression test: Check whether a test run with output to stdout
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stdout.write("Test\n")
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
+ <system-out><![CDATA[Test
+]]></system-out>
+ <system-err><![CDATA[]]></system-err>
+</testsuite>
+""")
+
+ def test_stderr_capture(self):
+ """Regression test: Check whether a test run with output to stderr
+ matches a previous run.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stderr.write("Test\n")
+ self._try_test_run(TestTest, """<testsuite errors="0" failures="0" name="unittest.TestSuite" tests="1" time="0.000">
+ <testcase classname="__main__.TestTest" name="test_foo" time="0.000"></testcase>
+ <system-out><![CDATA[]]></system-out>
+ <system-err><![CDATA[Test
+]]></system-err>
+</testsuite>
+""")
+
+ class NullStream(object):
+ """A file-like object that discards everything written to it."""
+ def write(self, buffer):
+ pass
+
+ def test_unittests_changing_stdout(self):
+ """Check whether the XMLTestRunner recovers gracefully from unit tests
+ that change stdout, but don't change it back properly.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stdout = XMLTestRunnerTest.NullStream()
+
+ runner = XMLTestRunner(self._stream)
+ runner.run(unittest.makeSuite(TestTest))
+
+ def test_unittests_changing_stderr(self):
+ """Check whether the XMLTestRunner recovers gracefully from unit tests
+ that change stderr, but don't change it back properly.
+
+ """
+ class TestTest(unittest.TestCase):
+ def test_foo(self):
+ sys.stderr = XMLTestRunnerTest.NullStream()
+
+ runner = XMLTestRunner(self._stream)
+ runner.run(unittest.makeSuite(TestTest))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc
index 6dc1a26f8..17ee32f34 100644
--- a/gnuradio-core/src/tests/test_all.cc
+++ b/gnuradio-core/src/tests/test_all.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,7 +21,9 @@
*/
#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+#include <gr_unittests.h>
#include <qa_runtime.h>
#include <qa_general.h>
#include <qa_filter.h>
@@ -32,13 +34,18 @@
int
main (int argc, char **argv)
{
-
- CppUnit::TextTestRunner runner;
+ char path[200];
+ get_unittest_path ("gnuradio_core_all.xml", path, 200);
+
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(path);
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_runtime::suite ());
runner.addTest (qa_general::suite ());
runner.addTest (qa_filter::suite ());
// runner.addTest (qa_atsc::suite ());
+ runner.setOutputter(xmlout);
bool was_successful = runner.run ("", false);
diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc
index f744d76e6..51642f81a 100644
--- a/gnuradio-core/src/tests/test_atsc.cc
+++ b/gnuradio-core/src/tests/test_atsc.cc
@@ -21,16 +21,24 @@
*/
#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
#include <qa_atsc.h>
int
main (int argc, char **argv)
{
+ char path[200];
+ get_unittest_path ("gnuradio_core_atsc.xml", path, 200);
- CppUnit::TextTestRunner runner;
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(path);
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_atsc::suite ());
-
+ runner.setOutputter(xmlout);
+
bool was_successful = runner.run ("", false);
return was_successful ? 0 : 1;
diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc
index 56e945238..2781cfb35 100644
--- a/gnuradio-core/src/tests/test_filter.cc
+++ b/gnuradio-core/src/tests/test_filter.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,15 +21,23 @@
*/
#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
#include <qa_filter.h>
int
main (int argc, char **argv)
{
+ char path[200];
+ get_unittest_path ("gnuradio_core_filter.xml", path, 200);
- CppUnit::TextTestRunner runner;
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(path);
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_filter::suite ());
+ runner.setOutputter(xmlout);
bool was_successful = runner.run ("", false);
diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc
index 063e2ee45..16ee9c3ad 100644
--- a/gnuradio-core/src/tests/test_general.cc
+++ b/gnuradio-core/src/tests/test_general.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,15 +21,23 @@
*/
#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
#include <qa_general.h>
int
main (int argc, char **argv)
{
-
- CppUnit::TextTestRunner runner;
+ char path[200];
+ get_unittest_path ("gnuradio_core_general.xml", path, 200);
+
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(path);
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_general::suite ());
+ runner.setOutputter(xmlout);
bool was_successful = runner.run ("", false);
diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc
index 8549f2a9b..c7983a23e 100644
--- a/gnuradio-core/src/tests/test_runtime.cc
+++ b/gnuradio-core/src/tests/test_runtime.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,15 +21,23 @@
*/
#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gr_unittests.h>
#include <qa_runtime.h>
int
main (int argc, char **argv)
{
+ char path[200];
+ get_unittest_path ("gnuradio_core_runtime.xml", path, 200);
- CppUnit::TextTestRunner runner;
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(path);
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_runtime::suite ());
+ runner.setOutputter(xmlout);
bool was_successful = runner.run ("", false);