Ppx_inline_test and Makefiles

[I’m debugging (dune’s _build/log is useful here) and will undoubtedly be able to figure it out) but thought I’d ask just in case somebody else already figured it out]

I want to be able to run tests written using ppx_inline_test from a Makefile, using ocamlfind (of course). There seems to be no documentation on how to do this – does anybody have an example or hints?

ETA: nevermind, I figured it out. Here’s a simple Makefile that worked for me:


all: test_inline_test.ppx

test_inline_test.ppx: test_inline_test.ppx.byte
	./$< inline-test-runner foo -source-tree-root . -diff-cmd -

test_inline_test.ppx.byte: test_inline_test.cmo
	ocamlfind ocamlc -custom -package ppx_inline_test.runtime-lib,ppx_inline_test.runner.lib -linkpkg -linkall test_inline_test.cmo -o test_inline_test.ppx.byte

test_inline_test.cmo: test_inline_test.ml
	ocamlfind ppx_inline_test/ppx.exe -inline-test-lib foo ./test_inline_test.ml > test_inline_test.pp.ml
	ocamlfind ocamlc -verbose -package ppx_inline_test.runtime-lib -c test_inline_test.pp.ml -o test_inline_test.cmo

It would be great to add instructions to project’s README – for future generations.

Agreed :slight_smile: https://github.com/janestreet/ppx_inline_test/pull/25