view test/callback_suite/README.txt @ 509:f3d44195dbdf

callback_suite: - further, big refactoring to make the test data setup be a lot more in line with call_suite and call_suite_aggrs - added support to test void return values (was missing in prev version)
author Tassilo Philipp
date Sat, 09 Apr 2022 23:00:24 +0200
parents 1aa2af848e8a
children 95f6f43178ed
line wrap: on
line source

Callback Test Suite
-------------------


CONFIGURE SUITE

  needs lua: edit config.lua and run "make config".


DESCRIPTION

Generates a set of callback invokers in C using lua as a preprocessor.

The invokers pass random arguments to the callback to test, from a set of
reference values which are argument type- and position-specific.


The Callback Invocation Body

Example:
The body for a signature of type  "dpdf)p" at case id 19 is:

void f19(void* addr) 
{ 
  V_p[4] = ((CONFIG_API p(*)(d,p,d,f))addr)(K_d[0],K_p[1],K_d[2],K_f[3]);
}            ^^^^^^^^^^- specific calling convention
                        ^^^^^^^^^^^^^- signature
     ^- return type                   ^^^^- dyncallback object
                                              ^- args from reference values (to be retrieved in handler)

The K_? values are the reference values, which are supposed to be copied to
V_?, and are compared for identity after invocation. The arguments are copied
to V_? in the callback handler, called through "addr".

The reference values stored in K_? are generated once, randomly, at startup.


Testing for exotic calling conventions on Windows

Specify 'api' and 'ccprefix' accordingly:


"__stdcall"  "_s"
"__fastcall" "_f" for gcc compiler
             "_F" for microsoft compiler

See the dyncall documentation for other/more calling convention prefixes.