Debian Codegraph @

testsuite/tests/unboxed-primitive-args/README

raw
1 This directory contains tests to check that OCaml values are correctly
2 passed between OCaml and C when a primitive takes some or all of its
3 arguments unboxed/untagged and/or return its result unboxed/untagged.
4
5 To test one primitive we do:
6 - write all its argument and expected result in buffer A
7 - call the C external using arguments read from buffer A
8 - the C function write all the arguments it receive into buffer B
9 - the C function read the result from buffer A and returns it
10 - on the OCaml side we write the received result into buffer B
11 - the test is successful if A and B have the same contents
12
13 Between each call, we call a function with 128 value arguments set to
14 0 and a function with 32 unboxed float arguments set to 0., just to
15 clean-up the registers and stacks in case garbage would make a test
16 succeed. We don't pass more floats as it doesn't build on arm32.
17
18 We construct the set of primitives to test as follow:
19 - all combination of unboxed int32/int64/float arguments for functions
20 taking up to 6 arguments (with more than 6 ocamlopt takes a really
21 long time to compile the test files)
22 - a bunch of manual tests for the rest and specific patterns.
23 The list is [Gen_test.manual_tests]
24
25 We test the set of primitives a thousand times, with different random
26 data each time.