Thicket thicket
cambridge
REPOS 4

Projects covers Forester, Merry, xdge and ocaml-crockford.

W39.2026 · 21–27 Sep / Issue

Results of cram tests are cached but depend on environment

tangled · jonmsterling.com/ocaml-forester · did:plc:jjiv56ot7d6sgethto3jr3r5

I noticed something unfortunate when running the tests. Here's what I did:

  1. I accidentally had another instance of Forester already running.
  2. I ran the tests. They failed because they could not bind port 8080 (Fatal error: exception Unix.Unix_error(Unix.EADDRINUSE, "bind", "")).
  3. I killed my other process, and ran the tests again. The results were cached rather than running again.
  4. I tried running dune runtest --force and it had no impact. It still uses the cached results.

Basically, caching is not suitable for cram tests because they depend on the environment. We should find a way to ensure that the cram tests always run every time.

Comments

did:plc:jjiv56ot7d6sgethto3jr3r5

It looks like dune clean will get rid of the cache. God, I hate the OCaml ecosystem so much. It's so crazy that dune runtest --force does not do what it says it does.


did:plc:jjiv56ot7d6sgethto3jr3r5

I'm closing this because we can use dune clean, but let it be known that this was my last straw and I'm never creating a new project in OCaml again 😂


did:plc:4gj3ihsdh6fn3aqq5bdnw5w3

Yeah... I run the tests in the pre-commit hook. It copies the entire index into a temp directory and kills all running instances of forester, which works around this issue.