[PATCH] testsuite: Use printk for all test output where possible.
Chris Johns
chrisj at rtems.org
Thu Oct 19 20:59:16 UTC 2017
On 19/10/2017 21:52, Sebastian Huber wrote:
> 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
>
Good idea. I added links to TAP (http://testanything.org/). We should review
what already exists.
> 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:
It was floating point or something heavy the tests used that caused me to use
the function I did. I am happy for this to change and printk to be the function
used if the floats are resolved.
>
> 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",
Thanks for the list. I had not looked.
Do you know which tests need direct printk calls for threading reasons? I would
like to make sure those calls and are marked in some way.
>
> 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
>
Could we add a '%f' hook in printk these tests can set? It might be simpler than
a generic interface in something we wish to keep small and simple.
Chris
More information about the devel
mailing list