The test do block is designed to verify that the formula is set correctly, and not to run test samples. If the tests do not take too long, you can run them as part of the installation:
def install # ... system "make", "test" # ... end
To answer your question, there is no reliable way to get the original unpacked directory, because it was destroyed after installation, and the user may have deleted the cached tarball (e.g. brew cleanup ), so you have to reload it.
The solution is to copy the necessary test files somewhere during the install step, then use them directly or copy them in the current directory during testing, for example:
def install # ... libexec.install "tests" end test do cp_r (libexec/"tests"), "." cd "tests" do # I'm assuming the Makefile paths can be given # as variables here. system "make", "test", "LIB=#{lib}", "INCLUDE=#{include}" end end
bfontaine
source share