On Tue, Oct 16, 2012 at 03:14:31AM -0700, nexy_sm wrote:
Do you mean some kind of tutorial or what?
Well, that means that my test don’t work, since you said that make install
isn’t necesary.
So, let’s start again, what might be a problem?
That’s still impossible to tell from what you’ve written.
I’ve just checked that gr_modtool and the tutorial are correct.
Here’s what I did:
- Create an out-of-tree module
~/tmp % gr_modtool.py create test
Module directory is “./gr-test”.
Creating directory…
Copying howto example…
Unpacking…
Replacing occurences of ‘howto’ to ‘test’… Done.
Use ‘gr_modtool add’ to add a new block to this currently empty module.
- Then, I add a sync-block:
~/tmp% cd gr-test
tmp/gr-test % gr_modtool.py add -t sync square_ff
Operating in directory .
GNU Radio module name identified: test
Code is of type: sync
Block/code identifier: square_ff
Enter valid argument list, including default arguments:
Add Python QA code? [Y/n]
Add C++ QA code? [Y/n] n
Traversing lib…
Adding file ‘square_ff_impl.h’…
Adding file ‘square_ff_impl.cc’…
Adding file ‘square_ff.h’…
Traversing swig…
Editing swig/test_swig.i…
Traversing python…
Adding file ‘qa_square_ff.py’…
Editing python/CMakeLists.txt…
Traversing grc…
Adding file ‘test_square_ff.xml’…
Editing grc/CMakeLists.txt…
- Next, I edit the work() function of the block (this only needs one
line to be changed) to look like this:
Before this is done, the ‘make’ command won’t work!
{
const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
for (int i = 0; i < noutput_items; i++) {
out[i] = in[i] * in[i];
}
// Tell runtime system how many output items we produced.
return noutput_items;
}
-
Finally, I edit the file python/qa_square_ff.py such that the test
case contains this:
Before this is done, the ‘make test’ or ‘ctest’ commands won’t work!
def test_001_t (self):
test_data = (1, 2, 3, 4)
correct_res = (1, 4, 9, 16)
sink = gr.vector_sink_f()
self.tb.connect(gr.vector_source_f(test_data), test.square_ff(),
sink)
self.tb.run()
self.assertEqual(sink.data(), correct_res)
Then, I go to the build directory and invoke the make process:
gr-test/build % cmake … # Output omitted
gr-test/build % make # Output omitted
gr-test/build % make test
Running tests…
Test project /home/braun/tmp/gr-test/build
Start 1: test_test
1/2 Test #1: test_test … Passed 0.02 sec
Start 2: qa_square_ff
2/2 Test #2: qa_square_ff … Passed 0.23 sec
100% tests passed, 0 tests failed out of 2
The End.
This entire process took me less than 10 minutes. If you’re taking
longer, you’re wasting time.
Other notes:
- I never installed
- The only editing necessary was three lines in the work() function and
the
test case in qa_square_ff
So go through your module once again, start from scratch and it will
work.
MB
–
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)
Dipl.-Ing. Martin B.
Research Associate
Kaiserstraße 12
Building 05.01
76131 Karlsruhe
Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu
KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association