[PATCH] testsuite: Use printk for all test output where possible.

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Oct 19 10:52:27 UTC 2017


On 19/10/17 09:29, Chris Johns wrote:
> On 19/10/17 5:01 pm, Sebastian Huber wrote:
>> On 19/10/17 07:45, Chris Johns wrote:
>>> - Remove the printf support leaving the direct printk support configured
>>>     with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf
>>>     call to printk.
>> What is the benefit of this buffered IO compared to printk?
>>
> I implemented IO buffering to start with and the testing failed so I added the
> '\n' detection and flushing.
>
> I wanted to use vsniprintf to make sure the same output is generated. If the
> output is the same as printk we can use printk.

We should really think about a test framework for RTEMS. I added a 
ticket for this:

https://devel.rtems.org/ticket/3199

I think the only legitimate use case for the full featured printf() etc. 
is the output of a floating point number. This is only used in a couple 
of spots:

testsuites/samples/paranoia/paranoia.c:    printf ("Radix = %f .\n", Radix);
testsuites/samples/paranoia/paranoia.c:        printf ("The number of 
significant digits of the Radix is %f .\n",
testsuites/samples/paranoia/paranoia.c:                    printf 
("Because of unusual Radix = %f", Radix);
testsuites/benchmarks/whetstone/whetstone.c:    printf("Loops: %ld, 
Iterations: %d, Duration: %f sec.\n",
testsuites/libtests/mathf/domathf.c:#define PRI "%f"
testsuites/libtests/complex/docomplex.c:#define PRI "%f"
testsuites/libtests/complex/docomplexf.c:#define PRI "%f"
testsuites/libtests/math/domath.c:#define PRI "%f"
testsuites/smptests/smpmigration01/init.c:        "\tcpu %zu cycle 
deviation %f\n",
testsuites/sptests/spcpucounter01/init.c:      "ns busy wait relative to 
clock tick: %f\n",
testsuites/sptests/spcpucounter01/init.c:      "ticks busy wait relative 
to clock tick: %f\n",

Some printf() implementations support custom format handlers. We can use 
something similar in the test framework.

https://www.gnu.org/software/libc/manual/html_node/Printf-Extension-Example.html

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list