ocaml/testsuite/tests/unboxed-primitive-args
Nicolás Ojeda Bär e20736dda0
unboxed-primitive-args: test does not require unix (#9517)
2020-04-30 18:26:24 +02:00
..
README Fix compilation of the unboxed-primitive-args test on arm32 2015-08-26 09:12:33 +00:00
common.ml s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01:00
common.mli Remove copyright notices in test files. 2016-05-03 07:37:48 -04:00
gen_test.ml Remove copyright notices in test files. 2016-05-03 07:37:48 -04:00
test.ml unboxed-primitive-args: test does not require unix (#9517) 2020-04-30 18:26:24 +02:00
test.reference Migrate the unboxed-primitive-args test to ocamltest 2018-04-26 08:08:20 +02:00
test_common.c Update tests/unboxed-primitive-args: bigarray.h is now in caml/ 2017-03-13 19:15:10 +01:00
test_common.h Update headers for the new license. 2016-02-18 16:59:16 +01:00

README

This directory contains tests to check that OCaml values are correctly
passed between OCaml and C when a primitive takes some or all of its
arguments unboxed/untagged and/or return its result unboxed/untagged.

To test one primitive we do:
- write all its argument and expected result in buffer A
- call the C external using arguments read from buffer A
- the C function write all the arguments it receive into buffer B
- the C function read the result from buffer A and returns it
- on the OCaml side we write the received result into buffer B
- the test is successful if A and B have the same contents

Between each call, we call a function with 128 value arguments set to
0 and a function with 32 unboxed float arguments set to 0., just to
clean-up the registers and stacks in case garbage would make a test
succeed. We don't pass more floats as it doesn't build on arm32.

We construct the set of primitives to test as follow:
- all combination of unboxed int32/int64/float arguments for functions
  taking up to 6 arguments (with more than 6 ocamlopt takes a really
  long time to compile the test files)
- a bunch of manual tests for the rest and specific patterns.
  The list is [Gen_test.manual_tests]

We test the set of primitives a thousand times, with different random
data each time.