I just discovered that ppx_expect expects that source files are located in the directory from which the test runner was launched. That is never the case under Bazel. I can’t think of a workaround; I suspect the only solution is to change ppx_expect.
Any volunteers? I think it’s a good design problem, not specific to either dune or bazel. My first take on it is that ppx_expect needs to obtain the path containing the source from the build system, somehow.
Fatal error: exception Sys_error(“/private/var/…/test_mark.ml: No such file or directory”)`
It’s clear that the executable is looking for the source file in the directory from which it was launched. To verify this I inserted a line of code to print the CWD.
If I copy the executable to the source dir lib_test/expect, and run it from there, then the test succeeds, and writes a corrected file to the same directory.
I think this is a regression with the latest ppx_expect release. Try with ppx_expect.v0.16.0, if it works, open an issue GitHub · Where software is built upstream.