janestreet / ppx_expect

Cram like framework for OCaml
MIT License
141 stars 28 forks source link

Using ppx_expect when there is no libc #15

Open emillon opened 5 years ago

emillon commented 5 years ago

Hello,

This is a bit of an open question - sorry for the large scope.

I'm trying to build a library that has expect tests as part of a mirage unikernel. I'm not interested in running the tests (just stripping the test nodes would work), but at the moment it's preventing compilation because ppx_expect has some C stubs that refer to some functions that are not available in mirage, like dup or dup2.

How do you think we could support this use case?

Thanks!

hannesm commented 5 years ago

I think this is related to the discussion in https://github.com/ocaml/dune/issues/897, but please correct me if I'm wrong.

ghost commented 4 years ago

Whoops, completely missed this issue. We are now monitoring github issues with our internal review tool, so we should follow up more promptly in the future.

So thinking again about this, as long as you are happy to keep an opam dependency on ppx_expect even when tests are disabled, there is a pretty simple change we could do in dune to avoid the runtime dependency. If you also want to avoid the opam dependency, it is a bit more work.

emillon commented 4 years ago

It's great to see that a solution is possible. In the context of Mirage and opam metadata, I think that depending on ppx_expect in release mode is a bit heavy since it brings base. But if this can be made a test-dependency it's probably OK. This would also solve coinstallability problems, for cases where two libraries depend on incompatible versions of base just for tests.

It seems OK to wait for the solution described in https://github.com/ocaml/dune/issues/897#issuecomment-605952330.