OpenCL-CTS icon indicating copy to clipboard operation
OpenCL-CTS copied to clipboard

printf is very undertested

Open airlied opened this issue 4 years ago • 4 comments

The printf tests don't cover

  • multiple arguments
  • no arguments
  • data before format specifier

airlied avatar Nov 19 '20 00:11 airlied

It should also cover more special cases. E.g. both of these two:

printf("") printf("%s", "")

.. should print an empty string. Furthermore, i think the test of printf with NaN is problematic. This test

{"%f","sqrt(-1.0f)"},

expects a -nan to be printed, however it makes two assumptions, 1) that the sqrt operation returns a negative nan (not positive), and 2) that printf prints the sign of the nan. AFAICT, both are incorrect; the IEEE 754 does not assign any meaning to sign bit of the NaN, and printing out the sign is optional.

franz avatar Jan 31 '23 09:01 franz

printf("%%") could be interesting to test as well.

pjaaskel avatar Jan 31 '23 15:01 pjaaskel

Can we put this to the "mobica-backlog"? Thanks!

pjaaskel avatar Jan 31 '23 16:01 pjaaskel

Based on previous discussion and spec investigation below is a work plan to extend the current framework of printf tests. I will appreciate any suggestions and corrections:

New set of printf tests with multiple arguments. It will take into account:

  • [x] various types of arguments test
  • [x] no arguments test
  • [x] additional data before/after format specifiers

New tests related to printout formatting:

  • [x] verification of space flag prefixing
  • [x] verification of zero flag padding

Corrections for previous tests:

  • [x] Completing vector tests to take into account all vector variants and conversions specifiers
  • [x] Completing all floating precision printf tests with missing conversions %a, %A, %F
  • [ ] Completing TYPE_INT test with long arguments
  • [x] Completing floating precision printf tests with TYPE_DOUBLE and TYPE_DOUBLE_LIMITS
  • [x] Completing string tests with special cases and precision number
  • [ ] Completing all non-vector conversions with length modifiers tests
  • [x] Correction for nan/inf printf tests

shajder avatar Apr 05 '24 07:04 shajder