[foreign] RFR: add test for C stdlib

John Rose john.r.rose at oracle.com
Mon Jun 11 20:39:02 UTC 2018


On Jun 11, 2018, at 1:11 PM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
> 
> In other words, I recommend to look at this not in the way we would look at normally if we were to write unit tests for the functions themselves, but rather, trying to think about thorny cases for the binder. For instance, in the printf case, there are two cases that the binder needs to work through (i) empty variadic list, (ii) non-empty variadic list. Under (ii) we could refine more by trying to stress the various argument types being passed to the binder, to see if the binder can infer layouts accordingly. Etc.

We agree on this.  My suggestion to add some more calls is to
try and trip up the binder, not the libc library.

In the case of printf, we should test a very long argument list,
with a couple hundred operands.

In the case of qsort, I'm suggesting a long sort in order to
thoroughly exercise the callback engine.

Here are the sorts of binder bugs I want to catch, especially
for varargs:

1. don't pass the right value (trivial to catch with a unary call)
2. pass the right values in the wrong order (hence the printf suggestions)
3. pass the right values in the wrong place after built-in critical number (such as the number of argument registers)
4. pass the right values in the wrong place in a tricky interleaved mix of float and non-float arguments (assuming distinct int and float argument regs)

— John


More information about the panama-dev mailing list