[rtems commit] cpukit, testsuite: Add rtems_printf and rtems_printer support.

Chris Johns chrisj at rtems.org
Wed May 25 23:04:03 UTC 2016


On 25/05/2016 21:30, Sebastian Huber wrote:
> I get now an undefined reference error:
>
> Making all in loopback
> gmake[6]: Entering directory
> `/build/git-build/b-sis/sparc-rtems4.12/c/sis/testsuites/samples/loopback'
> sparc-rtems4.12-gcc -B../../../../../sis/lib/ -specs bsp_specs -qrtems
> -mcpu=cypress -O2 -g -ffunction-sections -fdata-sections -Wall
> -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes
> -Wnested-externs  -Wl,--gc-sections -mcpu=cypress   -o loopback.exe init.o
> ../../../../../sis/lib/librtemscpu.a(testbeginend.o): In function
> `rtems_test_begin':
> /home/EB/sebastian_h/git-rtems/c/src/../../cpukit/libmisc/testsupport/testbeginend.c:23:
> undefined reference to `rtems_test_printer'
> /home/EB/sebastian_h/git-rtems/c/src/../../cpukit/libmisc/testsupport/testbeginend.c:23:
> undefined reference to `rtems_test_printer'
> ../../../../../sis/lib/librtemscpu.a(testbeginend.o): In function
> `rtems_test_end':
> /home/EB/sebastian_h/git-rtems/c/src/../../cpukit/libmisc/testsupport/testbeginend.c:31:
> undefined reference to `rtems_test_printer'
> /home/EB/sebastian_h/git-rtems/c/src/../../cpukit/libmisc/testsupport/testbeginend.c:31:
> undefined reference to `rtems_test_printer'
>

Sorry about this, it looks like my --enable-network build is not 
working. I will take a look.

> Why is it defined multiple times in the individual tests and not in
> libmisc?

I could have gone one of two ways and decided to be specific for now. I 
did not want to add a new global to all tests yet and create a further 
variation on how to print in the tests. I wanted to narrow the focus and 
limit the options so we have a chance at cleaning this stuff up.

The testsuite is not great in this area and that is being polite. The 
tmacros.h defines to replace printf, puts etc is not great and prone to 
errors. The test code does not have a single approach to printed output, 
you could use a define and include tmacros.h, or use *_begink/*_endk and 
then implicitly manage the calls to printk, and/or a combination of 
these. I am not sure if a single approach can be used for all tests or 
if it matters. I did not have time to review the tests and see what 
could be done.

I see a second bigger pass over the code to remove the support from 
tmacros.h and add it to libmisc and to change all prints, where ever 
possible to rtems_printf, and rtems_puts (which will need to be added). 
There could even be a test version of these added which uses the 
rtems_printer. Each test will need a printer defined in Init and the 
output path defined.

Chris



More information about the devel mailing list