ocaml-multicore / multicoretests

PBT testsuite and libraries for testing multicore OCaml
https://ocaml-multicore.github.io/multicoretests/
BSD 2-Clause "Simplified" License
37 stars 16 forks source link

Dynarray tests #463

Open OlivierNicole opened 3 months ago

OlivierNicole commented 3 months ago

(This PR is based on top of #462, which it depends on.)

The new module Dynarray has a rather tricky implementation as it is not designed for parallel use, but still strives to guarantee memory safety even in the event of such incorrect use. This implies a lot of subtle invariants to maintain. My local runs of this branch have exposed a bug in the initial implementation (https://github.com/ocaml/ocaml/pull/12885#discussion_r1568976695).

jmid commented 2 months ago

Thanks a bunch for sharing this! :pray:

Here's a CI summary as I was seeing several red lights:

Out of 36 workflows the 29 test-running ones failed with compile-time errors

jmid commented 2 months ago

I just pushed a few changes, partly to address some of the red lights. I still expect a 32-bit 0xdeadbeef out-of-range though.

OlivierNicole commented 2 months ago

Thanks for taking care of that!

I still expect a 32-bit 0xdeadbeef out-of-range though.

We should probably replace it with 0xcafe, or something.

Also, the Lin test was triggering segfaults, presumably due to a leftover “operation” fake which was doing some extremely unsafe things, probably to trigger exactly that, and should be removed. Sorry for leaving it in the PR, I just pushed a commit to remove it.

OlivierNicole commented 2 months ago

Remaining problems:

I don’t have the bandwidth to look at it today, but hopefully shortly.

OlivierNicole commented 1 month ago

When devising a system to maintain a pool of Dynarrays as my SUT, I have neglected an issue with shrinking.

Some commands cause a new Dynarray to be added to the pool and others take one or more Dynarrays as input. These Dynarray arguments are represented as list indices; when generating commands, care is taken to generate indices that are valid indices in the current list of arrays, given the previous commands.

But when shrinking, some of the commands are arbitrarily removed, which leads to some of these indices to become invalid at the moment of the command’s execution and causes unexpected exceptions.