Jbuilder split runtest for packages

jbuilder

#1

Hi,

I am trying to create an async backend for the ocaml-redis library. I’ve split the test/jbuild executables section into 3 different executables to align with the 3 different backends the library supports.

My problem now is that when I try to build them, a jbuilder runtest -p <pkg> requires both lwt and async, whereas it should just run the test that corresponds to <pkg>.

Any ideas on how to achieve that?


#2

I’m not sure, but I think you should add package to your runtest alias

(alias
 ((name   runtest)
  (package _name_)
  (deps   (test_lwt.exe))
  (action (run ${<}))))

#3

I’ve already tried that, but if I do that and run it with -p <pkg> it complains that it can’t find the redis library. On IRC I was told that I am misunderstanding the purpose of the -p flag, which means that it does only considers the packages that I pass. But even when I add -p redis,redis-lwt it then still wants to build the test_async.exe and fails.


#4

Ah, I think you have to separate your executables into the distinct stanzas, since at the moment all of them depend on both redis_sync and redis_lwt. Something like that: